Cleanup/Housekeeping (#242)
This commit is contained in:
parent
90ede0659f
commit
741e8d8300
228 changed files with 6292 additions and 2690 deletions
164
LICENSE
164
LICENSE
|
|
@ -11,30 +11,30 @@
|
||||||
software and other kinds of works.
|
software and other kinds of works.
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
The licenses for most software and other practical works are designed
|
||||||
to take away your freedom to share and change the works. By contrast,
|
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
|
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
|
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
|
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
|
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
|
any other work released this way by its authors. You can apply it to
|
||||||
your programs, too.
|
your programs, too.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
have the freedom to distribute copies of free software (and charge for
|
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
|
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
|
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.
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
To protect your rights, we need to prevent others from denying you
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
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
|
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
|
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
|
or can get the source code. And you must show them these terms so they
|
||||||
know their rights.
|
know their rights.
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
|
@ -42,19 +42,19 @@ know their rights.
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
that there is no warranty for this free software. For both users' and
|
that there is no warranty for this free software. For both users' and
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
changed, so that their problems will not be attributed erroneously to
|
changed, so that their problems will not be attributed erroneously to
|
||||||
authors of previous versions.
|
authors of previous versions.
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
Some devices are designed to deny users access to install or run
|
||||||
modified versions of the software inside them, although the manufacturer
|
modified versions of the software inside them, although the manufacturer
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
protecting users' freedom to change the software. The systematic
|
protecting users' freedom to change the software. The systematic
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
products. If such problems arise substantially in other domains, we
|
products. If such problems arise substantially in other domains, we
|
||||||
stand ready to extend this provision to those domains in future versions
|
stand ready to extend this provision to those domains in future versions
|
||||||
of the GPL, as needed to protect the freedom of users.
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ of the GPL, as needed to protect the freedom of users.
|
||||||
States should not allow patents to restrict development and use of
|
States should not allow patents to restrict development and use of
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
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
|
avoid the special danger that patents applied to a free program could
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
patents cannot be used to render the program non-free.
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
|
|
@ -78,12 +78,12 @@ modification follow.
|
||||||
works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
"recipients" may be individuals or organizations.
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
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
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
earlier work or a work "based on" the earlier work.
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
|
@ -92,12 +92,12 @@ on the Program.
|
||||||
To "propagate" a work means to do anything with it that, without
|
To "propagate" a work means to do anything with it that, without
|
||||||
permission, would make you directly or secondarily liable for
|
permission, would make you directly or secondarily liable for
|
||||||
infringement under applicable copyright law, except executing it on a
|
infringement under applicable copyright law, except executing it on a
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
distribution (with or without modification), making available to the
|
distribution (with or without modification), making available to the
|
||||||
public, and in some countries other activities as well.
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
To "convey" a work means any kind of propagation that enables other
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
|
@ -105,14 +105,14 @@ to the extent that it includes a convenient and prominently visible
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
tells the user that there is no warranty for the work (except to the
|
tells the user that there is no warranty for the work (except to the
|
||||||
extent that warranties are provided), that licensees may convey 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
|
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
|
the interface presents a list of user commands or options, such as a
|
||||||
menu, a prominent item in the list meets this criterion.
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
1. Source Code.
|
1. Source Code.
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
The "source code" for a work means the preferred form of the work
|
||||||
for making modifications to it. "Object code" means any non-source
|
for making modifications to it. "Object code" means any non-source
|
||||||
form of a work.
|
form of a work.
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
|
@ -125,7 +125,7 @@ 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
|
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
|
Component, and (b) serves only to enable use of the work with that
|
||||||
Major Component, or to implement a Standard Interface for which an
|
Major Component, or to implement a Standard Interface for which an
|
||||||
implementation is available to the public in source code form. A
|
implementation is available to the public in source code form. A
|
||||||
"Major Component", in this context, means a major essential component
|
"Major Component", in this context, means a major essential component
|
||||||
(kernel, window system, and so on) of the specific operating system
|
(kernel, window system, and so on) of the specific operating system
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
|
@ -134,10 +134,10 @@ 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 "Corresponding Source" for a work in object code form means all
|
||||||
the source code needed to generate, install, and (for an executable
|
the source code needed to generate, install, and (for an executable
|
||||||
work) run the object code and to modify the work, including scripts to
|
work) run the object code and to modify the work, including scripts to
|
||||||
control those activities. However, it does not include the work's
|
control those activities. However, it does not include the work's
|
||||||
System Libraries, or general-purpose tools or generally available free
|
System Libraries, or general-purpose tools or generally available free
|
||||||
programs which are used unmodified in performing those activities but
|
programs which are used unmodified in performing those activities but
|
||||||
which are not part of the work. For example, Corresponding Source
|
which are not part of the work. For example, Corresponding Source
|
||||||
includes interface definition files associated with source files for
|
includes interface definition files associated with source files for
|
||||||
the work, and the source code for shared libraries and dynamically
|
the work, and the source code for shared libraries and dynamically
|
||||||
linked subprograms that the work is specifically designed to require,
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
|
@ -155,25 +155,25 @@ same work.
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
All rights granted under this License are granted for the term of
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
permission to run the unmodified Program. The output from running a
|
permission to run the unmodified Program. The output from running a
|
||||||
covered work is covered by this License only if the output, given its
|
covered work is covered by this License only if the output, given its
|
||||||
content, constitutes a covered work. This License acknowledges your
|
content, constitutes a covered work. This License acknowledges your
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
You may make, run and propagate covered works that you do not
|
||||||
convey, without conditions so long as your license otherwise remains
|
convey, without conditions so long as your license otherwise remains
|
||||||
in force. You may convey covered works to others for the sole purpose
|
in force. You may convey covered works to others for the sole purpose
|
||||||
of having them make modifications exclusively for you, or provide you
|
of having them make modifications exclusively for you, or provide you
|
||||||
with facilities for running those works, provided that you comply with
|
with facilities for running those works, provided that you comply with
|
||||||
the terms of this License in conveying all material for which you do
|
the terms of this License in conveying all material for which you do
|
||||||
not control copyright. Those thus making or running the covered works
|
not control copyright. Those thus making or running the covered works
|
||||||
for you must do so exclusively on your behalf, under your direction
|
for you must do so exclusively on your behalf, under your direction
|
||||||
and control, on terms that prohibit them from making any copies of
|
and control, on terms that prohibit them from making any copies of
|
||||||
your copyrighted material outside their relationship with you.
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
Conveying under any other circumstances is permitted solely under
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
makes it unnecessary.
|
makes it unnecessary.
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
@ -216,14 +216,14 @@ terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
b) The work must carry prominent notices stating that it is
|
||||||
released under this License and any conditions added under section
|
released under this License and any conditions added under section
|
||||||
7. This requirement modifies the requirement in section 4 to
|
7. This requirement modifies the requirement in section 4 to
|
||||||
"keep intact all notices".
|
"keep intact all notices".
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
c) You must license the entire work, as a whole, under this
|
||||||
License to anyone who comes into possession of a copy. This
|
License to anyone who comes into possession of a copy. This
|
||||||
License will therefore apply, along with any applicable section 7
|
License will therefore apply, along with any applicable section 7
|
||||||
additional terms, to the whole of the work, and all its parts,
|
additional terms, to the whole of the work, and all its parts,
|
||||||
regardless of how they are packaged. This License gives no
|
regardless of how they are packaged. This License gives no
|
||||||
permission to license the work in any other way, but it does not
|
permission to license the work in any other way, but it does not
|
||||||
invalidate such permission if you have separately received it.
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
|
@ -238,7 +238,7 @@ 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
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
used to limit the access or legal rights of the compilation's users
|
used to limit the access or legal rights of the compilation's users
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
in an aggregate does not cause this License to apply to the other
|
in an aggregate does not cause this License to apply to the other
|
||||||
parts of the aggregate.
|
parts of the aggregate.
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ in one of these ways:
|
||||||
Corresponding Source from a network server at no charge.
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
c) Convey individual copies of the object code with a copy of the
|
||||||
written offer to provide the Corresponding Source. This
|
written offer to provide the Corresponding Source. This
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
only if you received the object code with such an offer, in accord
|
only if you received the object code with such an offer, in accord
|
||||||
with subsection 6b.
|
with subsection 6b.
|
||||||
|
|
@ -275,13 +275,13 @@ in one of these ways:
|
||||||
d) Convey the object code by offering access from a designated
|
d) Convey the object code by offering access from a designated
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
Corresponding Source in the same way through the same place at no
|
Corresponding Source in the same way through the same place at no
|
||||||
further charge. You need not require recipients to copy the
|
further charge. You need not require recipients to copy the
|
||||||
Corresponding Source along with the object code. If the place to
|
Corresponding Source along with the object code. If the place to
|
||||||
copy the object code is a network server, the Corresponding Source
|
copy the object code is a network server, the Corresponding Source
|
||||||
may be on a different server (operated by you or a third party)
|
may be on a different server (operated by you or a third party)
|
||||||
that supports equivalent copying facilities, provided you maintain
|
that supports equivalent copying facilities, provided you maintain
|
||||||
clear directions next to the object code saying where to find the
|
clear directions next to the object code saying where to find the
|
||||||
Corresponding Source. Regardless of what server hosts the
|
Corresponding Source. Regardless of what server hosts the
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
available for as long as needed to satisfy these requirements.
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
|
@ -297,12 +297,12 @@ included in conveying the object code work.
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
tangible personal property which is normally used for personal, family,
|
tangible personal property which is normally used for personal, family,
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
product received by a particular user, "normally used" refers to a
|
product received by a particular user, "normally used" refers to a
|
||||||
typical or common use of that class of product, regardless of the status
|
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
|
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
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
is a consumer product regardless of whether the product has substantial
|
is a consumer product regardless of whether the product has substantial
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
the only significant mode of use of the product.
|
the only significant mode of use of the product.
|
||||||
|
|
@ -310,7 +310,7 @@ the only significant mode of use of the product.
|
||||||
"Installation Information" for a User Product means any methods,
|
"Installation Information" for a User Product means any methods,
|
||||||
procedures, authorization keys, or other information required to install
|
procedures, authorization keys, or other information required to install
|
||||||
and execute modified versions of a covered work in that User Product from
|
and execute modified versions of a covered work in that User Product from
|
||||||
a modified version of its Corresponding Source. The information must
|
a modified version of its Corresponding Source. The information must
|
||||||
suffice to ensure that the continued functioning of the modified object
|
suffice to ensure that the continued functioning of the modified object
|
||||||
code is in no case prevented or interfered with solely because
|
code is in no case prevented or interfered with solely because
|
||||||
modification has been made.
|
modification has been made.
|
||||||
|
|
@ -321,7 +321,7 @@ 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
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
by the Installation Information. But this requirement does not apply
|
by the Installation Information. But this requirement does not apply
|
||||||
if neither you nor any third party retains the ability to install
|
if neither you nor any third party retains the ability to install
|
||||||
modified object code on the User Product (for example, the work has
|
modified object code on the User Product (for example, the work has
|
||||||
been installed in ROM).
|
been installed in ROM).
|
||||||
|
|
@ -329,7 +329,7 @@ been installed in ROM).
|
||||||
The requirement to provide Installation Information does not include a
|
The requirement to provide Installation Information does not include a
|
||||||
requirement to continue to provide support service, warranty, or updates
|
requirement to continue to provide support service, warranty, or updates
|
||||||
for a work that has been modified or installed by the recipient, or for
|
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
|
the User Product in which it has been modified or installed. Access to a
|
||||||
network may be denied when the modification itself materially and
|
network may be denied when the modification itself materially and
|
||||||
adversely affects the operation of the network or violates the rules and
|
adversely affects the operation of the network or violates the rules and
|
||||||
protocols for communication across the network.
|
protocols for communication across the network.
|
||||||
|
|
@ -346,14 +346,14 @@ unpacking, reading or copying.
|
||||||
License by making exceptions from one or more of its conditions.
|
License by making exceptions from one or more of its conditions.
|
||||||
Additional permissions that are applicable to the entire Program shall
|
Additional permissions that are applicable to the entire Program shall
|
||||||
be treated as though they were included in this License, to the extent
|
be treated as though they were included in this License, to the extent
|
||||||
that they are valid under applicable law. If additional permissions
|
that they are valid under applicable law. If additional permissions
|
||||||
apply only to part of the Program, that part may be used separately
|
apply only to part of the Program, that part may be used separately
|
||||||
under those permissions, but the entire Program remains governed by
|
under those permissions, but the entire Program remains governed by
|
||||||
this License without regard to the additional permissions.
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
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
|
remove any additional permissions from that copy, or from any part of
|
||||||
it. (Additional permissions may be written to require their own
|
it. (Additional permissions may be written to require their own
|
||||||
removal in certain cases when you modify the work.) You may place
|
removal in certain cases when you modify the work.) You may place
|
||||||
additional permissions on material, added by you to a covered work,
|
additional permissions on material, added by you to a covered work,
|
||||||
for which you have or can give appropriate copyright permission.
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
@ -386,10 +386,10 @@ that material) supplement the terms of this License with terms:
|
||||||
those licensors and authors.
|
those licensors and authors.
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
All other non-permissive additional terms are considered "further
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
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
|
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
|
governed by this License along with a term that is a further
|
||||||
restriction, you may remove that term. If a license document contains
|
restriction, you may remove that term. If a license document contains
|
||||||
a further restriction but permits relicensing or conveying under this
|
a further restriction but permits relicensing or conveying under this
|
||||||
License, you may add to a covered work material governed by the terms
|
License, you may add to a covered work material governed by the terms
|
||||||
of that license document, provided that the further restriction does
|
of that license document, provided that the further restriction does
|
||||||
|
|
@ -407,7 +407,7 @@ the above requirements apply either way.
|
||||||
8. Termination.
|
8. Termination.
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
You may not propagate or modify a covered work except as expressly
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
modify it is void, and will automatically terminate your rights under
|
modify it is void, and will automatically terminate your rights under
|
||||||
this License (including any patent licenses granted under the third
|
this License (including any patent licenses granted under the third
|
||||||
paragraph of section 11).
|
paragraph of section 11).
|
||||||
|
|
@ -428,31 +428,31 @@ your receipt of the notice.
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
Termination of your rights under this section does not terminate the
|
||||||
licenses of parties who have received copies or rights from you under
|
licenses of parties who have received copies or rights from you under
|
||||||
this License. If your rights have been terminated and not permanently
|
this License. If your rights have been terminated and not permanently
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
material under section 10.
|
material under section 10.
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
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
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
to receive a copy likewise does not require acceptance. However,
|
to receive a copy likewise does not require acceptance. However,
|
||||||
nothing other than this License grants you permission to propagate or
|
nothing other than this License grants you permission to propagate or
|
||||||
modify any covered work. These actions infringe copyright if you do
|
modify any covered work. These actions infringe copyright if you do
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
Each time you convey a covered work, the recipient automatically
|
||||||
receives a license from the original licensors, to run, modify and
|
receives a license from the original licensors, to run, modify and
|
||||||
propagate that work, subject to this License. You are not responsible
|
propagate that work, subject to this License. You are not responsible
|
||||||
for enforcing compliance by third parties with this License.
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
An "entity transaction" is a transaction transferring control of an
|
||||||
organization, or substantially all assets of one, or subdividing an
|
organization, or substantially all assets of one, or subdividing an
|
||||||
organization, or merging organizations. If propagation of a covered
|
organization, or merging organizations. If propagation of a covered
|
||||||
work results from an entity transaction, each party to that
|
work results from an entity transaction, each party to that
|
||||||
transaction who receives a copy of the work also receives whatever
|
transaction who receives a copy of the work also receives whatever
|
||||||
licenses to the work the party's predecessor in interest had or could
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
|
@ -461,7 +461,7 @@ Corresponding Source of the work from the predecessor in interest, if
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
You may not impose any further restrictions on the exercise of the
|
||||||
rights granted or affirmed under this License. For example, you may
|
rights granted or affirmed under this License. For example, you may
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
rights granted under this License, and you may not initiate litigation
|
rights granted under this License, and you may not initiate litigation
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
|
@ -471,7 +471,7 @@ sale, or importing the Program or any portion of it.
|
||||||
11. Patents.
|
11. Patents.
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
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
|
License of the Program or a work on which the Program is based. The
|
||||||
work thus licensed is called the contributor's "contributor version".
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
|
@ -479,7 +479,7 @@ owned or controlled by the contributor, whether already acquired or
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
by this License, of making, using, or selling its contributor version,
|
by this License, of making, using, or selling its contributor version,
|
||||||
but do not include claims that would be infringed only as a
|
but do not include claims that would be infringed only as a
|
||||||
consequence of further modification of the contributor version. For
|
consequence of further modification of the contributor version. For
|
||||||
purposes of this definition, "control" includes the right to grant
|
purposes of this definition, "control" includes the right to grant
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
this License.
|
this License.
|
||||||
|
|
@ -492,7 +492,7 @@ propagate the contents of its contributor version.
|
||||||
In the following three paragraphs, a "patent license" is any express
|
In the following three paragraphs, a "patent license" is any express
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
(such as an express permission to practice a patent or covenant not to
|
(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
|
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
|
party means to make such an agreement or commitment not to enforce a
|
||||||
patent against the party.
|
patent against the party.
|
||||||
|
|
||||||
|
|
@ -504,7 +504,7 @@ then you must either (1) cause the Corresponding Source to be so
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
consistent with the requirements of this License, to extend the patent
|
consistent with the requirements of this License, to extend the patent
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
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
|
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
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
|
@ -521,7 +521,7 @@ work and works based on it.
|
||||||
A patent license is "discriminatory" if it does not include within
|
A patent license is "discriminatory" if it does not include within
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
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
|
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
|
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
|
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
|
in the business of distributing software, under which you make payment
|
||||||
to the third party based on the extent of your activity of conveying
|
to the third party based on the extent of your activity of conveying
|
||||||
|
|
@ -541,10 +541,10 @@ otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
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
|
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
|
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
|
the Program, the only way you could satisfy both those terms and this
|
||||||
License would be to refrain entirely from conveying the Program.
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
@ -554,7 +554,7 @@ License would be to refrain entirely from conveying the Program.
|
||||||
Notwithstanding any other provision of this License, you have
|
Notwithstanding any other provision of this License, you have
|
||||||
permission to link or combine any covered work with a work licensed
|
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
|
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
|
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,
|
License will continue to apply to the part which is the covered work,
|
||||||
but the special requirements of the GNU Affero General Public License,
|
but the special requirements of the GNU Affero General Public License,
|
||||||
section 13, concerning interaction through a network will apply to the
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
|
@ -563,16 +563,16 @@ combination as such.
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
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
|
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
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU General
|
Program specifies that a certain numbered version of the GNU General
|
||||||
Public License "or any later version" applies to it, you have the
|
Public License "or any later version" applies to it, you have the
|
||||||
option of following the terms and conditions either of that numbered
|
option of following the terms and conditions either of that numbered
|
||||||
version or of any later version published by the Free Software
|
version or of any later version published by the Free Software
|
||||||
Foundation. If the Program does not specify a version number of the
|
Foundation. If the Program does not specify a version number of the
|
||||||
GNU General Public License, you may choose any version ever published
|
GNU General Public License, you may choose any version ever published
|
||||||
by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
|
@ -582,19 +582,19 @@ public statement of acceptance of a version permanently authorizes you
|
||||||
to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
Later license versions may give you additional or different
|
||||||
permissions. However, no additional obligations are imposed on any
|
permissions. However, no additional obligations are imposed on any
|
||||||
author or copyright holder as a result of your choosing to follow a
|
author or copyright holder as a result of your choosing to follow a
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
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
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
16. Limitation of Liability.
|
16. Limitation of Liability.
|
||||||
|
|
@ -626,40 +626,36 @@ copy of the Program in return for a fee.
|
||||||
possible use to the public, the best way to achieve this is to make it
|
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.
|
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 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
|
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
|
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.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
ModernUO
|
ModernUO
|
||||||
Copyright (C) 2019 ModernUO Dev Team
|
Copyright 2019-2020 ModernUO Development Team
|
||||||
hi@modernuo.com
|
Email: hi@modernuo.com
|
||||||
|
File: <filename>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(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
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
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.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
If the program does terminal interaction, make it output a short
|
||||||
notice like this when it starts in an interactive mode:
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
<program> Copyright <year> <name of author>
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
parts of the General Public License. Of course, your program's commands
|
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".
|
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,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
|
@ -668,8 +664,8 @@ For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<https://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
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
|
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
|
Public License instead of this License. But first, please read
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: AssemblyHandler.cs *
|
* File: AssemblyHandler.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -33,7 +33,9 @@ namespace Server
|
||||||
var assemblies = new Assembly[files.Length];
|
var assemblies = new Assembly[files.Length];
|
||||||
|
|
||||||
for (var i = 0; i < files.Length; i++)
|
for (var i = 0; i < files.Length; i++)
|
||||||
|
{
|
||||||
assemblies[i] = AssemblyLoadContext.Default.LoadFromAssemblyPath(files[i]);
|
assemblies[i] = AssemblyLoadContext.Default.LoadFromAssemblyPath(files[i]);
|
||||||
|
}
|
||||||
|
|
||||||
Assemblies = assemblies;
|
Assemblies = assemblies;
|
||||||
}
|
}
|
||||||
|
|
@ -43,42 +45,61 @@ namespace Server
|
||||||
var invoke = new List<MethodInfo>();
|
var invoke = new List<MethodInfo>();
|
||||||
|
|
||||||
for (var a = 0; a < Assemblies.Length; ++a)
|
for (var a = 0; a < Assemblies.Length; ++a)
|
||||||
|
{
|
||||||
invoke.AddRange(
|
invoke.AddRange(
|
||||||
Assemblies[a]
|
Assemblies[a]
|
||||||
.GetTypes()
|
.GetTypes()
|
||||||
.Select(t => t.GetMethod(method, BindingFlags.Static | BindingFlags.Public))
|
.Select(t => t.GetMethod(method, BindingFlags.Static | BindingFlags.Public))
|
||||||
.Where(m => m != null)
|
.Where(m => m != null)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
invoke.Sort(new CallPriorityComparer());
|
invoke.Sort(new CallPriorityComparer());
|
||||||
|
|
||||||
for (var i = 0; i < invoke.Count; ++i)
|
for (var i = 0; i < invoke.Count; ++i)
|
||||||
|
{
|
||||||
invoke[i].Invoke(null, null);
|
invoke[i].Invoke(null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TypeCache GetTypeCache(Assembly asm)
|
public static TypeCache GetTypeCache(Assembly asm)
|
||||||
{
|
{
|
||||||
if (asm == null)
|
if (asm == null)
|
||||||
|
{
|
||||||
return m_NullCache ??= new TypeCache(null);
|
return m_NullCache ??= new TypeCache(null);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_TypeCaches.TryGetValue(asm, out var c))
|
if (m_TypeCaches.TryGetValue(asm, out var c))
|
||||||
|
{
|
||||||
return c;
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
return m_TypeCaches[asm] = new TypeCache(asm);
|
return m_TypeCaches[asm] = new TypeCache(asm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type FindFirstTypeForName(string name, bool ignoreCase = false, Func<Type, bool> predicate = null)
|
public static Type FindFirstTypeForName(string name, bool ignoreCase = false, Func<Type, bool> predicate = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name)) return null;
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var types = FindTypesByName(name, ignoreCase).ToList();
|
var types = FindTypesByName(name, ignoreCase).ToList();
|
||||||
if (types.Count == 0)
|
if (types.Count == 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (predicate != null)
|
if (predicate != null)
|
||||||
|
{
|
||||||
return types.FirstOrDefault(predicate);
|
return types.FirstOrDefault(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
if (types.Count == 1)
|
if (types.Count == 1)
|
||||||
|
{
|
||||||
return types[0];
|
return types[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find the closest match if there is no predicate.
|
// Try to find the closest match if there is no predicate.
|
||||||
// Check for exact match of the FullName or Name
|
// Check for exact match of the FullName or Name
|
||||||
// Then check for case-insensitive match of FullName or Name
|
// Then check for case-insensitive match of FullName or Name
|
||||||
|
|
@ -97,13 +118,19 @@ namespace Server
|
||||||
var types = new List<Type>();
|
var types = new List<Type>();
|
||||||
|
|
||||||
if (ignoreCase)
|
if (ignoreCase)
|
||||||
|
{
|
||||||
name = name.ToLower();
|
name = name.ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < Assemblies.Length; i++)
|
for (var i = 0; i < Assemblies.Length; i++)
|
||||||
|
{
|
||||||
types.AddRange(GetTypeCache(Assemblies[i])[name]);
|
types.AddRange(GetTypeCache(Assemblies[i])[name]);
|
||||||
|
}
|
||||||
|
|
||||||
if (types.Count == 0)
|
if (types.Count == 0)
|
||||||
|
{
|
||||||
types.AddRange(GetTypeCache(Core.Assembly)[name]);
|
types.AddRange(GetTypeCache(Core.Assembly)[name]);
|
||||||
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
@ -150,15 +177,19 @@ namespace Server
|
||||||
addToRefs(i, current.FullName);
|
addToRefs(i, current.FullName);
|
||||||
addToRefs(i, current.FullName?.ToLower());
|
addToRefs(i, current.FullName?.ToLower());
|
||||||
if (current.GetCustomAttribute(aliasType, false) is TypeAliasAttribute alias)
|
if (current.GetCustomAttribute(aliasType, false) is TypeAliasAttribute alias)
|
||||||
|
{
|
||||||
for (var j = 0; j < alias.Aliases.Length; j++)
|
for (var j = 0; j < alias.Aliases.Length; j++)
|
||||||
{
|
{
|
||||||
addToRefs(i, alias.Aliases[j]);
|
addToRefs(i, alias.Aliases[j]);
|
||||||
addToRefs(i, alias.Aliases[j].ToLower());
|
addToRefs(i, alias.Aliases[j].ToLower());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (key, value) in nameMap)
|
foreach (var (key, value) in nameMap)
|
||||||
|
{
|
||||||
m_NameMap[key] = value.ToArray();
|
m_NameMap[key] = value.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Type> Types => m_Types;
|
public IEnumerable<Type> Types => m_Types;
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Attributes.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
@ -57,22 +37,32 @@ namespace Server
|
||||||
public int Compare(MethodInfo x, MethodInfo y)
|
public int Compare(MethodInfo x, MethodInfo y)
|
||||||
{
|
{
|
||||||
if (x == null && y == null)
|
if (x == null && y == null)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (x == null)
|
if (x == null)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (y == null)
|
if (y == null)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
var xPriority = GetPriority(x);
|
var xPriority = GetPriority(x);
|
||||||
var yPriority = GetPriority(y);
|
var yPriority = GetPriority(y);
|
||||||
|
|
||||||
if (xPriority > yPriority)
|
if (xPriority > yPriority)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (xPriority < yPriority)
|
if (xPriority < yPriority)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -82,10 +72,14 @@ namespace Server
|
||||||
var objs = mi.GetCustomAttributes(typeof(CallPriorityAttribute), true);
|
var objs = mi.GetCustomAttributes(typeof(CallPriorityAttribute), true);
|
||||||
|
|
||||||
if (objs.Length == 0)
|
if (objs.Length == 0)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(objs[0] is CallPriorityAttribute attr))
|
if (!(objs[0] is CallPriorityAttribute attr))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return attr.Priority;
|
return attr.Priority;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,9 @@ namespace System.Buffers
|
||||||
{
|
{
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
// Cast-away readonly to initialize lazy field
|
// Cast-away readonly to initialize lazy field
|
||||||
|
{
|
||||||
Volatile.Write(ref Unsafe.AsRef(length), sequence.Length);
|
Volatile.Write(ref Unsafe.AsRef(length), sequence.Length);
|
||||||
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
@ -109,9 +111,13 @@ namespace System.Buffers
|
||||||
if (CurrentSpanIndex >= CurrentSpan.Length)
|
if (CurrentSpanIndex >= CurrentSpan.Length)
|
||||||
{
|
{
|
||||||
if (usingSequence)
|
if (usingSequence)
|
||||||
|
{
|
||||||
GetNextSpan();
|
GetNextSpan();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
moreData = false;
|
moreData = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -120,7 +126,10 @@ namespace System.Buffers
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Rewind(long count)
|
public void Rewind(long count)
|
||||||
{
|
{
|
||||||
if ((ulong)count > (ulong)Consumed) throw new ArgumentOutOfRangeException(nameof(count));
|
if ((ulong)count > (ulong)Consumed)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(count));
|
||||||
|
}
|
||||||
|
|
||||||
Consumed -= count;
|
Consumed -= count;
|
||||||
|
|
||||||
|
|
@ -232,7 +241,10 @@ namespace System.Buffers
|
||||||
|
|
||||||
private void AdvanceToNextSpan(long count)
|
private void AdvanceToNextSpan(long count)
|
||||||
{
|
{
|
||||||
if (count < 0) throw new ArgumentOutOfRangeException(nameof(count));
|
if (count < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(count));
|
||||||
|
}
|
||||||
|
|
||||||
Consumed += count;
|
Consumed += count;
|
||||||
while (moreData)
|
while (moreData)
|
||||||
|
|
@ -253,7 +265,10 @@ namespace System.Buffers
|
||||||
|
|
||||||
GetNextSpan();
|
GetNextSpan();
|
||||||
|
|
||||||
if (count == 0) break;
|
if (count == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
|
|
@ -286,7 +301,9 @@ namespace System.Buffers
|
||||||
{
|
{
|
||||||
// If we don't have enough to fill the requested buffer, return false
|
// If we don't have enough to fill the requested buffer, return false
|
||||||
if (Remaining < destination.Length)
|
if (Remaining < destination.Length)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var firstSpan = UnreadSpan;
|
var firstSpan = UnreadSpan;
|
||||||
firstSpan.CopyTo(destination);
|
firstSpan.CopyTo(destination);
|
||||||
|
|
@ -294,14 +311,19 @@ namespace System.Buffers
|
||||||
|
|
||||||
var next = nextPosition;
|
var next = nextPosition;
|
||||||
while (sequence.TryGet(ref next, out var nextSegment))
|
while (sequence.TryGet(ref next, out var nextSegment))
|
||||||
|
{
|
||||||
if (nextSegment.Length > 0)
|
if (nextSegment.Length > 0)
|
||||||
{
|
{
|
||||||
var nextSpan = nextSegment.Span;
|
var nextSpan = nextSegment.Span;
|
||||||
var toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
|
var toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
|
||||||
nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied));
|
nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied));
|
||||||
copied += toCopy;
|
copied += toCopy;
|
||||||
if (copied >= destination.Length) break;
|
if (copied >= destination.Length)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,10 @@ namespace System.Buffers
|
||||||
where T : unmanaged
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
var span = reader.UnreadSpan;
|
var span = reader.UnreadSpan;
|
||||||
if (span.Length < sizeof(T)) return TryReadMultisegment(ref reader, out value);
|
if (span.Length < sizeof(T))
|
||||||
|
{
|
||||||
|
return TryReadMultisegment(ref reader, out value);
|
||||||
|
}
|
||||||
|
|
||||||
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span));
|
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span));
|
||||||
reader.Advance(sizeof(T));
|
reader.Advance(sizeof(T));
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,10 @@ namespace System.Buffers
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Ensure(int count = 1)
|
public void Ensure(int count = 1)
|
||||||
{
|
{
|
||||||
if (_span.Length < count) EnsureMore(count);
|
if (_span.Length < count)
|
||||||
|
{
|
||||||
|
EnsureMore(count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -120,7 +123,10 @@ namespace System.Buffers
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
private void EnsureMore(int count = 0)
|
private void EnsureMore(int count = 0)
|
||||||
{
|
{
|
||||||
if (_buffered > 0) Commit();
|
if (_buffered > 0)
|
||||||
|
{
|
||||||
|
Commit();
|
||||||
|
}
|
||||||
|
|
||||||
_span = _output.GetSpan(count);
|
_span = _output.GetSpan(count);
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +139,10 @@ namespace System.Buffers
|
||||||
{
|
{
|
||||||
while (source.Length > 0)
|
while (source.Length > 0)
|
||||||
{
|
{
|
||||||
if (_span.Length == 0) EnsureMore();
|
if (_span.Length == 0)
|
||||||
|
{
|
||||||
|
EnsureMore();
|
||||||
|
}
|
||||||
|
|
||||||
var writable = Math.Min(source.Length, _span.Length);
|
var writable = Math.Min(source.Length, _span.Length);
|
||||||
source.Slice(0, writable).CopyTo(_span);
|
source.Slice(0, writable).CopyTo(_span);
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,20 @@ namespace System.Buffers
|
||||||
|
|
||||||
protected void Dispose(bool disposing)
|
protected void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (_isDisposed) return;
|
if (_isDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
|
|
||||||
Array = null;
|
Array = null;
|
||||||
NativePointer = IntPtr.Zero;
|
NativePointer = IntPtr.Zero;
|
||||||
|
|
||||||
if (_gcHandle.IsAllocated) _gcHandle.Free();
|
if (_gcHandle.IsAllocated)
|
||||||
|
{
|
||||||
|
_gcHandle.Free();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~MemoryPoolSlab()
|
~MemoryPoolSlab()
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,10 @@ namespace System.Buffers
|
||||||
|
|
||||||
public override IMemoryOwner<byte> Rent(int size = AnySize)
|
public override IMemoryOwner<byte> Rent(int size = AnySize)
|
||||||
{
|
{
|
||||||
if (size > _blockSize) MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException_BufferRequestTooLarge(_blockSize);
|
if (size > _blockSize)
|
||||||
|
{
|
||||||
|
MemoryPoolThrowHelper.ThrowArgumentOutOfRangeException_BufferRequestTooLarge(_blockSize);
|
||||||
|
}
|
||||||
|
|
||||||
var block = Lease();
|
var block = Lease();
|
||||||
return block;
|
return block;
|
||||||
|
|
@ -85,7 +88,9 @@ namespace System.Buffers
|
||||||
private MemoryPoolBlock Lease()
|
private MemoryPoolBlock Lease()
|
||||||
{
|
{
|
||||||
if (_isDisposed)
|
if (_isDisposed)
|
||||||
|
{
|
||||||
MemoryPoolThrowHelper.ThrowObjectDisposedException(MemoryPoolThrowHelper.ExceptionArgument.MemoryPool);
|
MemoryPoolThrowHelper.ThrowObjectDisposedException(MemoryPoolThrowHelper.ExceptionArgument.MemoryPool);
|
||||||
|
}
|
||||||
|
|
||||||
if (_blocks.TryDequeue(out var block))
|
if (_blocks.TryDequeue(out var block))
|
||||||
{
|
{
|
||||||
|
|
@ -127,7 +132,9 @@ namespace System.Buffers
|
||||||
block = new MemoryPoolBlock(this, slab, offset, _blockSize);
|
block = new MemoryPoolBlock(this, slab, offset, _blockSize);
|
||||||
|
|
||||||
if (i != blockCount - 1) // last block
|
if (i != blockCount - 1) // last block
|
||||||
|
{
|
||||||
Return(block);
|
Return(block);
|
||||||
|
}
|
||||||
|
|
||||||
offset += _blockSize;
|
offset += _blockSize;
|
||||||
}
|
}
|
||||||
|
|
@ -148,9 +155,13 @@ namespace System.Buffers
|
||||||
internal void Return(MemoryPoolBlock block)
|
internal void Return(MemoryPoolBlock block)
|
||||||
{
|
{
|
||||||
if (!_isDisposed)
|
if (!_isDisposed)
|
||||||
|
{
|
||||||
_blocks.Enqueue(block);
|
_blocks.Enqueue(block);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
GC.SuppressFinalize(block);
|
GC.SuppressFinalize(block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method can ONLY be called from the finalizer of MemoryPoolBlock
|
// This method can ONLY be called from the finalizer of MemoryPoolBlock
|
||||||
|
|
@ -162,25 +173,37 @@ namespace System.Buffers
|
||||||
// Need to make a new object because this one is being finalized
|
// Need to make a new object because this one is being finalized
|
||||||
// Note, this must be called within the _disposeSync lock because the block
|
// Note, this must be called within the _disposeSync lock because the block
|
||||||
// could be disposed at the same time as the finalizer.
|
// could be disposed at the same time as the finalizer.
|
||||||
|
{
|
||||||
Return(new MemoryPoolBlock(this, slab, offset, length));
|
Return(new MemoryPoolBlock(this, slab, offset, length));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (_isDisposed) return;
|
if (_isDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lock (_disposeSync)
|
lock (_disposeSync)
|
||||||
{
|
{
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
|
{
|
||||||
while (_slabs.TryPop(out var slab))
|
while (_slabs.TryPop(out var slab))
|
||||||
// dispose managed state (managed objects).
|
// dispose managed state (managed objects).
|
||||||
|
{
|
||||||
slab.Dispose();
|
slab.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Discard blocks in pool
|
// Discard blocks in pool
|
||||||
while (_blocks.TryDequeue(out var block)) GC.SuppressFinalize(block);
|
while (_blocks.TryDequeue(out var block))
|
||||||
|
{
|
||||||
|
GC.SuppressFinalize(block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: CityInfo.cs *
|
* File: CityInfo.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* ClientVersion.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -58,7 +38,9 @@ namespace Server
|
||||||
|
|
||||||
var br3 = br2 + 1;
|
var br3 = br2 + 1;
|
||||||
while (br3 < fmt.Length && char.IsDigit(fmt, br3))
|
while (br3 < fmt.Length && char.IsDigit(fmt, br3))
|
||||||
|
{
|
||||||
br3++;
|
br3++;
|
||||||
|
}
|
||||||
|
|
||||||
Major = Utility.ToInt32(fmt.Substring(0, br1));
|
Major = Utility.ToInt32(fmt.Substring(0, br1));
|
||||||
Minor = Utility.ToInt32(fmt.Substring(br1 + 1, br2 - br1 - 1));
|
Minor = Utility.ToInt32(fmt.Substring(br1 + 1, br2 - br1 - 1));
|
||||||
|
|
@ -69,7 +51,9 @@ namespace Server
|
||||||
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
|
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
|
||||||
{
|
{
|
||||||
if (!char.IsWhiteSpace(fmt, br3))
|
if (!char.IsWhiteSpace(fmt, br3))
|
||||||
|
{
|
||||||
Patch = fmt[br3] - 'a' + 1;
|
Patch = fmt[br3] - 'a' + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -78,12 +62,18 @@ namespace Server
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fmt.IndexOf("god") >= 0 || fmt.IndexOf("gq") >= 0)
|
if (fmt.IndexOf("god") >= 0 || fmt.IndexOf("gq") >= 0)
|
||||||
|
{
|
||||||
Type = ClientType.God;
|
Type = ClientType.God;
|
||||||
|
}
|
||||||
else if (fmt.IndexOf("third dawn") >= 0 || fmt.IndexOf("uo:td") >= 0 || fmt.IndexOf("uotd") >= 0 ||
|
else if (fmt.IndexOf("third dawn") >= 0 || fmt.IndexOf("uo:td") >= 0 || fmt.IndexOf("uotd") >= 0 ||
|
||||||
fmt.IndexOf("uo3d") >= 0 || fmt.IndexOf("uo:3d") >= 0)
|
fmt.IndexOf("uo3d") >= 0 || fmt.IndexOf("uo:3d") >= 0)
|
||||||
|
{
|
||||||
Type = ClientType.UOTD;
|
Type = ClientType.UOTD;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Type = ClientType.Regular;
|
Type = ClientType.Regular;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -110,24 +100,50 @@ namespace Server
|
||||||
public int CompareTo(ClientVersion o)
|
public int CompareTo(ClientVersion o)
|
||||||
{
|
{
|
||||||
if (o == null)
|
if (o == null)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Major > o.Major)
|
if (Major > o.Major)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Major < o.Major)
|
if (Major < o.Major)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Minor > o.Minor)
|
if (Minor > o.Minor)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Minor < o.Minor)
|
if (Minor < o.Minor)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Revision > o.Revision)
|
if (Revision > o.Revision)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Revision < o.Revision)
|
if (Revision < o.Revision)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Patch > o.Patch)
|
if (Patch > o.Patch)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Patch < o.Patch)
|
if (Patch < o.Patch)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +187,9 @@ namespace Server
|
||||||
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
|
if (Major <= 5 && Minor <= 0 && Revision <= 6) // Anything before 5.0.7
|
||||||
{
|
{
|
||||||
if (Patch > 0)
|
if (Patch > 0)
|
||||||
|
{
|
||||||
builder.Append((char)('a' + (Patch - 1)));
|
builder.Append((char)('a' + (Patch - 1)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -195,11 +213,19 @@ namespace Server
|
||||||
public static int Compare(ClientVersion a, ClientVersion b)
|
public static int Compare(ClientVersion a, ClientVersion b)
|
||||||
{
|
{
|
||||||
if (IsNull(a) && IsNull(b))
|
if (IsNull(a) && IsNull(b))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsNull(a))
|
if (IsNull(a))
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsNull(b))
|
if (IsNull(b))
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return a.CompareTo(b);
|
return a.CompareTo(b);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: ArraySet.cs *
|
* File: ArraySet.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -57,7 +57,10 @@ namespace Server.Collections
|
||||||
{
|
{
|
||||||
var indexOf = m_List.IndexOf(item);
|
var indexOf = m_List.IndexOf(item);
|
||||||
|
|
||||||
if (indexOf >= 0) return indexOf;
|
if (indexOf >= 0)
|
||||||
|
{
|
||||||
|
return indexOf;
|
||||||
|
}
|
||||||
|
|
||||||
m_List.Add(item);
|
m_List.Add(item);
|
||||||
return m_List.Count - 1;
|
return m_List.Count - 1;
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Commands.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
@ -49,7 +29,9 @@ namespace Server
|
||||||
public string GetString(int index)
|
public string GetString(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= Arguments.Length)
|
if (index < 0 || index >= Arguments.Length)
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
return Arguments[index];
|
return Arguments[index];
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +39,9 @@ namespace Server
|
||||||
public int GetInt32(int index)
|
public int GetInt32(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= Arguments.Length)
|
if (index < 0 || index >= Arguments.Length)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Utility.ToInt32(Arguments[index]);
|
return Utility.ToInt32(Arguments[index]);
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +49,9 @@ namespace Server
|
||||||
public uint GetUInt32(int index)
|
public uint GetUInt32(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= Arguments.Length)
|
if (index < 0 || index >= Arguments.Length)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Utility.ToUInt32(Arguments[index]);
|
return Utility.ToUInt32(Arguments[index]);
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +59,9 @@ namespace Server
|
||||||
public bool GetBoolean(int index)
|
public bool GetBoolean(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= Arguments.Length)
|
if (index < 0 || index >= Arguments.Length)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Utility.ToBoolean(Arguments[index]);
|
return Utility.ToBoolean(Arguments[index]);
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +69,9 @@ namespace Server
|
||||||
public double GetDouble(int index)
|
public double GetDouble(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= Arguments.Length)
|
if (index < 0 || index >= Arguments.Length)
|
||||||
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
return Utility.ToDouble(Arguments[index]);
|
return Utility.ToDouble(Arguments[index]);
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +79,9 @@ namespace Server
|
||||||
public TimeSpan GetTimeSpan(int index)
|
public TimeSpan GetTimeSpan(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= Arguments.Length)
|
if (index < 0 || index >= Arguments.Length)
|
||||||
|
{
|
||||||
return TimeSpan.Zero;
|
return TimeSpan.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
return Utility.ToTimeSpan(Arguments[index]);
|
return Utility.ToTimeSpan(Arguments[index]);
|
||||||
}
|
}
|
||||||
|
|
@ -145,10 +137,16 @@ namespace Server
|
||||||
var end = start;
|
var end = start;
|
||||||
|
|
||||||
while (end < array.Length)
|
while (end < array.Length)
|
||||||
|
{
|
||||||
if (array[end] != '"' || array[end - 1] == '\\')
|
if (array[end] != '"' || array[end - 1] == '\\')
|
||||||
|
{
|
||||||
++end;
|
++end;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
list.Add(value.Substring(start, end - start));
|
list.Add(value.Substring(start, end - start));
|
||||||
|
|
||||||
|
|
@ -159,10 +157,16 @@ namespace Server
|
||||||
var end = start;
|
var end = start;
|
||||||
|
|
||||||
while (end < array.Length)
|
while (end < array.Length)
|
||||||
|
{
|
||||||
if (array[end] != ' ')
|
if (array[end] != ' ')
|
||||||
|
{
|
||||||
++end;
|
++end;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
list.Add(value.Substring(start, end - start));
|
list.Add(value.Substring(start, end - start));
|
||||||
|
|
||||||
|
|
@ -185,10 +189,14 @@ namespace Server
|
||||||
public static bool Handle(Mobile from, string text, MessageType type = MessageType.Regular)
|
public static bool Handle(Mobile from, string text, MessageType type = MessageType.Regular)
|
||||||
{
|
{
|
||||||
if (!text.StartsWith(Prefix) && type != MessageType.Command)
|
if (!text.StartsWith(Prefix) && type != MessageType.Command)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (type != MessageType.Command)
|
if (type != MessageType.Command)
|
||||||
|
{
|
||||||
text = text.Substring(Prefix.Length);
|
text = text.Substring(Prefix.Length);
|
||||||
|
}
|
||||||
|
|
||||||
var indexOf = text.IndexOf(' ');
|
var indexOf = text.IndexOf(' ');
|
||||||
|
|
||||||
|
|
@ -226,7 +234,9 @@ namespace Server
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
from.SendMessage("You do not have access to that command.");
|
from.SendMessage("You do not have access to that command.");
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +244,9 @@ namespace Server
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
from.SendMessage("That is not a valid command.");
|
from.SendMessage("That is not a valid command.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: ServerConfiguration.cs *
|
* File: ServerConfiguration.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* ContextMenu.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
|
@ -50,14 +30,20 @@ namespace Server.ContextMenus
|
||||||
var list = new List<ContextMenuEntry>();
|
var list = new List<ContextMenuEntry>();
|
||||||
|
|
||||||
if (target is Mobile mobile)
|
if (target is Mobile mobile)
|
||||||
mobile.GetContextMenuEntries(from, list);
|
{
|
||||||
|
mobile.GetContextMenuEntries(@from, list);
|
||||||
|
}
|
||||||
else if (target is Item item)
|
else if (target is Item item)
|
||||||
item.GetContextMenuEntries(from, list);
|
{
|
||||||
|
item.GetContextMenuEntries(@from, list);
|
||||||
|
}
|
||||||
|
|
||||||
Entries = list.ToArray();
|
Entries = list.ToArray();
|
||||||
|
|
||||||
for (var i = 0; i < Entries.Length; ++i)
|
for (var i = 0; i < Entries.Length; ++i)
|
||||||
|
{
|
||||||
Entries[i].Owner = this;
|
Entries[i].Owner = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* ContextMenuEntry.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.ContextMenus
|
namespace Server.ContextMenus
|
||||||
|
|
@ -44,9 +24,13 @@ namespace Server.ContextMenus
|
||||||
public ContextMenuEntry(int number, int range = -1)
|
public ContextMenuEntry(int number, int range = -1)
|
||||||
{
|
{
|
||||||
if (number <= 0x7FFF) // Legacy code support
|
if (number <= 0x7FFF) // Legacy code support
|
||||||
|
{
|
||||||
Number = 3000000 + number;
|
Number = 3000000 + number;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Number = number;
|
Number = number;
|
||||||
|
}
|
||||||
|
|
||||||
Range = range;
|
Range = range;
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* OpenBackpackEntry.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
namespace Server.ContextMenus
|
namespace Server.ContextMenus
|
||||||
{
|
{
|
||||||
public class OpenBackpackEntry : ContextMenuEntry
|
public class OpenBackpackEntry : ContextMenuEntry
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* PaperdollEntry.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
namespace Server.ContextMenus
|
namespace Server.ContextMenus
|
||||||
{
|
{
|
||||||
public class PaperdollEntry : ContextMenuEntry
|
public class PaperdollEntry : ContextMenuEntry
|
||||||
|
|
@ -29,7 +9,9 @@ namespace Server.ContextMenus
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
if (m_Mobile.CanPaperdollBeOpenedBy(Owner.From))
|
if (m_Mobile.CanPaperdollBeOpenedBy(Owner.From))
|
||||||
|
{
|
||||||
m_Mobile.DisplayPaperdollTo(Owner.From);
|
m_Mobile.DisplayPaperdollTo(Owner.From);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* PacketProfile.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
@ -61,7 +41,10 @@ namespace Server.Diagnostics
|
||||||
|
|
||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
{
|
{
|
||||||
if (_stopwatch.IsRunning) _stopwatch.Reset();
|
if (_stopwatch.IsRunning)
|
||||||
|
{
|
||||||
|
_stopwatch.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
_stopwatch.Start();
|
_stopwatch.Start();
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +55,10 @@ namespace Server.Diagnostics
|
||||||
|
|
||||||
TotalTime += elapsed;
|
TotalTime += elapsed;
|
||||||
|
|
||||||
if (elapsed > PeakTime) PeakTime = elapsed;
|
if (elapsed > PeakTime)
|
||||||
|
{
|
||||||
|
PeakTime = elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
Count++;
|
Count++;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* PacketProfile.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
@ -36,10 +16,14 @@ namespace Server.Diagnostics
|
||||||
public static GumpProfile Acquire(Type type)
|
public static GumpProfile Acquire(Type type)
|
||||||
{
|
{
|
||||||
if (!Core.Profiling)
|
if (!Core.Profiling)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_profiles.TryGetValue(type, out var prof))
|
if (!_profiles.TryGetValue(type, out var prof))
|
||||||
|
{
|
||||||
_profiles.Add(type, prof = new GumpProfile(type));
|
_profiles.Add(type, prof = new GumpProfile(type));
|
||||||
|
}
|
||||||
|
|
||||||
return prof;
|
return prof;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* PacketProfile.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -67,7 +47,9 @@ namespace Server.Diagnostics
|
||||||
public static PacketSendProfile Acquire(Type type)
|
public static PacketSendProfile Acquire(Type type)
|
||||||
{
|
{
|
||||||
if (!_profiles.TryGetValue(type, out var prof))
|
if (!_profiles.TryGetValue(type, out var prof))
|
||||||
|
{
|
||||||
_profiles.Add(type, prof = new PacketSendProfile(type));
|
_profiles.Add(type, prof = new PacketSendProfile(type));
|
||||||
|
}
|
||||||
|
|
||||||
return prof;
|
return prof;
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +83,9 @@ namespace Server.Diagnostics
|
||||||
public static PacketReceiveProfile Acquire(int packetId)
|
public static PacketReceiveProfile Acquire(int packetId)
|
||||||
{
|
{
|
||||||
if (!_profiles.TryGetValue(packetId, out var prof))
|
if (!_profiles.TryGetValue(packetId, out var prof))
|
||||||
|
{
|
||||||
_profiles.Add(packetId, prof = new PacketReceiveProfile(packetId));
|
_profiles.Add(packetId, prof = new PacketReceiveProfile(packetId));
|
||||||
|
}
|
||||||
|
|
||||||
return prof;
|
return prof;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* PacketProfile.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
@ -37,10 +17,14 @@ namespace Server.Diagnostics
|
||||||
public static TargetProfile Acquire(Type type)
|
public static TargetProfile Acquire(Type type)
|
||||||
{
|
{
|
||||||
if (!Core.Profiling)
|
if (!Core.Profiling)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_profiles.TryGetValue(type, out var prof))
|
if (!_profiles.TryGetValue(type, out var prof))
|
||||||
|
{
|
||||||
_profiles.Add(type, prof = new TargetProfile(type));
|
_profiles.Add(type, prof = new TargetProfile(type));
|
||||||
|
}
|
||||||
|
|
||||||
return prof;
|
return prof;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* PacketProfile.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|
@ -43,10 +23,14 @@ namespace Server.Diagnostics
|
||||||
public static TimerProfile Acquire(string name)
|
public static TimerProfile Acquire(string name)
|
||||||
{
|
{
|
||||||
if (!Core.Profiling)
|
if (!Core.Profiling)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_profiles.TryGetValue(name, out var prof))
|
if (!_profiles.TryGetValue(name, out var prof))
|
||||||
|
{
|
||||||
_profiles.Add(name, prof = new TimerProfile(name));
|
_profiles.Add(name, prof = new TimerProfile(name));
|
||||||
|
}
|
||||||
|
|
||||||
return prof;
|
return prof;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Effects.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
|
|
@ -51,7 +31,9 @@ namespace Server
|
||||||
public static void PlaySound(IPoint3D p, Map map, int soundID)
|
public static void PlaySound(IPoint3D p, Map map, int soundID)
|
||||||
{
|
{
|
||||||
if (soundID <= -1)
|
if (soundID <= -1)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (map != null)
|
if (map != null)
|
||||||
{
|
{
|
||||||
|
|
@ -89,7 +71,9 @@ namespace Server
|
||||||
var map = e.Map;
|
var map = e.Map;
|
||||||
|
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.ProcessDelta();
|
e.ProcessDelta();
|
||||||
|
|
||||||
|
|
@ -98,6 +82,7 @@ namespace Server
|
||||||
var eable = map.GetClientsInRange(e.Location);
|
var eable = map.GetClientsInRange(e.Location);
|
||||||
|
|
||||||
foreach (var state in eable)
|
foreach (var state in eable)
|
||||||
|
{
|
||||||
if (state.Mobile.CanSee(e))
|
if (state.Mobile.CanSee(e))
|
||||||
{
|
{
|
||||||
if (SendParticlesTo(state))
|
if (SendParticlesTo(state))
|
||||||
|
|
@ -118,6 +103,7 @@ namespace Server
|
||||||
state.Send(playSound);
|
state.Send(playSound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Packet.Release(preEffect);
|
Packet.Release(preEffect);
|
||||||
Packet.Release(boltEffect);
|
Packet.Release(boltEffect);
|
||||||
|
|
@ -220,7 +206,9 @@ namespace Server
|
||||||
public static void SendTargetEffect(IEntity target, int itemID, int speed, int duration, int hue, int renderMode)
|
public static void SendTargetEffect(IEntity target, int itemID, int speed, int duration, int hue, int renderMode)
|
||||||
{
|
{
|
||||||
if (target is Mobile mobile)
|
if (target is Mobile mobile)
|
||||||
|
{
|
||||||
mobile.ProcessDelta();
|
mobile.ProcessDelta();
|
||||||
|
}
|
||||||
|
|
||||||
SendPacket(target.Location, target.Map, new TargetEffect(target, itemID, speed, duration, hue, renderMode));
|
SendPacket(target.Location, target.Map, new TargetEffect(target, itemID, speed, duration, hue, renderMode));
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +235,9 @@ namespace Server
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (target is Mobile mobile)
|
if (target is Mobile mobile)
|
||||||
|
{
|
||||||
mobile.ProcessDelta();
|
mobile.ProcessDelta();
|
||||||
|
}
|
||||||
|
|
||||||
var map = target.Map;
|
var map = target.Map;
|
||||||
|
|
||||||
|
|
@ -302,10 +292,14 @@ namespace Server
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (from is Mobile mobile)
|
if (from is Mobile mobile)
|
||||||
|
{
|
||||||
mobile.ProcessDelta();
|
mobile.ProcessDelta();
|
||||||
|
}
|
||||||
|
|
||||||
if (to is Mobile mobile1)
|
if (to is Mobile mobile1)
|
||||||
|
{
|
||||||
mobile1.ProcessDelta();
|
mobile1.ProcessDelta();
|
||||||
|
}
|
||||||
|
|
||||||
SendPacket(
|
SendPacket(
|
||||||
from.Location,
|
from.Location,
|
||||||
|
|
@ -389,10 +383,14 @@ namespace Server
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (from is Mobile fromMob)
|
if (from is Mobile fromMob)
|
||||||
|
{
|
||||||
fromMob.ProcessDelta();
|
fromMob.ProcessDelta();
|
||||||
|
}
|
||||||
|
|
||||||
if (to is Mobile toMob)
|
if (to is Mobile toMob)
|
||||||
|
{
|
||||||
toMob.ProcessDelta();
|
toMob.ProcessDelta();
|
||||||
|
}
|
||||||
|
|
||||||
var map = from.Map;
|
var map = from.Map;
|
||||||
|
|
||||||
|
|
@ -461,7 +459,9 @@ namespace Server
|
||||||
public static void SendPacket(Point3D origin, Map map, Packet p)
|
public static void SendPacket(Point3D origin, Map map, Packet p)
|
||||||
{
|
{
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var eable = map.GetClientsInRange(origin);
|
var eable = map.GetClientsInRange(origin);
|
||||||
|
|
||||||
|
|
@ -481,7 +481,9 @@ namespace Server
|
||||||
public static void SendPacket(IPoint3D origin, Map map, Packet p)
|
public static void SendPacket(IPoint3D origin, Map map, Packet p)
|
||||||
{
|
{
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var eable = map.GetClientsInRange(new Point3D(origin));
|
var eable = map.GetClientsInRange(new Point3D(origin));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: AccountLoginEvent.cs *
|
* File: AccountLoginEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: AggressiveActionEvent.cs *
|
* File: AggressiveActionEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: CharacterCreatedEvent.cs *
|
* File: CharacterCreatedEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: CreateGuildEvent.cs *
|
* File: CreateGuildEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: EventSink.cs *
|
* File: EventSink.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -137,7 +137,9 @@ namespace Server
|
||||||
public static void InvokeEquipMacro(Mobile m, List<Serial> list)
|
public static void InvokeEquipMacro(Mobile m, List<Serial> list)
|
||||||
{
|
{
|
||||||
if (list?.Count > 0)
|
if (list?.Count > 0)
|
||||||
|
{
|
||||||
EquipMacro?.Invoke(m, list);
|
EquipMacro?.Invoke(m, list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static event Action<Mobile, List<Layer>> UnequipMacro;
|
public static event Action<Mobile, List<Layer>> UnequipMacro;
|
||||||
|
|
@ -145,7 +147,9 @@ namespace Server
|
||||||
public static void InvokeUnequipMacro(Mobile m, List<Layer> layers)
|
public static void InvokeUnequipMacro(Mobile m, List<Layer> layers)
|
||||||
{
|
{
|
||||||
if (layers?.Count > 0)
|
if (layers?.Count > 0)
|
||||||
|
{
|
||||||
UnequipMacro?.Invoke(m, layers);
|
UnequipMacro?.Invoke(m, layers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static event Action<Mobile, IEntity, int> TargetedSpell;
|
public static event Action<Mobile, IEntity, int> TargetedSpell;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: FastwalkEvent.cs *
|
* File: FastwalkEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: GameLoginEvent.cs *
|
* File: GameLoginEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: MovementEvent.cs *
|
* File: MovementEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: ServerCrashedEvent.cs *
|
* File: ServerCrashedEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: ServerListEvent.cs *
|
* File: ServerListEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: SocketConnectionEvent.cs *
|
* File: SocketConnectionEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: SpeechEvent.cs *
|
* File: SpeechEvent.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -46,8 +46,12 @@ namespace Server
|
||||||
public bool HasKeyword(int keyword)
|
public bool HasKeyword(int keyword)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < Keywords.Length; ++i)
|
for (var i = 0; i < Keywords.Length; ++i)
|
||||||
|
{
|
||||||
if (Keywords[i] == keyword)
|
if (Keywords[i] == keyword)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* ExpansionInfo.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
|
|
@ -317,7 +297,10 @@ namespace Server
|
||||||
{
|
{
|
||||||
var info = GetInfo(ex);
|
var info = GetInfo(ex);
|
||||||
|
|
||||||
if (info != null) return info.SupportedFeatures;
|
if (info != null)
|
||||||
|
{
|
||||||
|
return info.SupportedFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
return ex switch
|
return ex switch
|
||||||
{
|
{
|
||||||
|
|
@ -343,7 +326,10 @@ namespace Server
|
||||||
{
|
{
|
||||||
var v = ex;
|
var v = ex;
|
||||||
|
|
||||||
if (v < 0 || v >= Table.Length) v = 0;
|
if (v < 0 || v >= Table.Length)
|
||||||
|
{
|
||||||
|
v = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Table[v];
|
return Table[v];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Point2D.cs *
|
* File: Point2D.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -104,14 +104,22 @@ namespace Server
|
||||||
public int CompareTo(Point2D other)
|
public int CompareTo(Point2D other)
|
||||||
{
|
{
|
||||||
var xComparison = m_X.CompareTo(other.m_X);
|
var xComparison = m_X.CompareTo(other.m_X);
|
||||||
if (xComparison != 0) return xComparison;
|
if (xComparison != 0)
|
||||||
|
{
|
||||||
|
return xComparison;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Y.CompareTo(other.m_Y);
|
return m_Y.CompareTo(other.m_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CompareTo(IPoint2D other)
|
public int CompareTo(IPoint2D other)
|
||||||
{
|
{
|
||||||
var xComparison = m_X.CompareTo(other.X);
|
var xComparison = m_X.CompareTo(other.X);
|
||||||
if (xComparison != 0) return xComparison;
|
if (xComparison != 0)
|
||||||
|
{
|
||||||
|
return xComparison;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Y.CompareTo(other.Y);
|
return m_Y.CompareTo(other.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Point3D.cs *
|
* File: Point3D.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -128,18 +128,34 @@ namespace Server
|
||||||
public int CompareTo(Point3D other)
|
public int CompareTo(Point3D other)
|
||||||
{
|
{
|
||||||
var xComparison = m_X.CompareTo(other.m_X);
|
var xComparison = m_X.CompareTo(other.m_X);
|
||||||
if (xComparison != 0) return xComparison;
|
if (xComparison != 0)
|
||||||
|
{
|
||||||
|
return xComparison;
|
||||||
|
}
|
||||||
|
|
||||||
var yComparison = m_Y.CompareTo(other.m_Y);
|
var yComparison = m_Y.CompareTo(other.m_Y);
|
||||||
if (yComparison != 0) return yComparison;
|
if (yComparison != 0)
|
||||||
|
{
|
||||||
|
return yComparison;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Z.CompareTo(other.m_Z);
|
return m_Z.CompareTo(other.m_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CompareTo(IPoint3D other)
|
public int CompareTo(IPoint3D other)
|
||||||
{
|
{
|
||||||
var xComparison = m_X.CompareTo(other.X);
|
var xComparison = m_X.CompareTo(other.X);
|
||||||
if (xComparison != 0) return xComparison;
|
if (xComparison != 0)
|
||||||
|
{
|
||||||
|
return xComparison;
|
||||||
|
}
|
||||||
|
|
||||||
var yComparison = m_Y.CompareTo(other.Y);
|
var yComparison = m_Y.CompareTo(other.Y);
|
||||||
if (yComparison != 0) return yComparison;
|
if (yComparison != 0)
|
||||||
|
{
|
||||||
|
return yComparison;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Z.CompareTo(other.Z);
|
return m_Z.CompareTo(other.Z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Point3DList.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
|
|
@ -52,7 +32,9 @@ namespace Server
|
||||||
m_List = new Point3D[old.Length * 2];
|
m_List = new Point3D[old.Length * 2];
|
||||||
|
|
||||||
for (var i = 0; i < old.Length; ++i)
|
for (var i = 0; i < old.Length; ++i)
|
||||||
|
{
|
||||||
m_List[i] = old[i];
|
m_List[i] = old[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_List[Count].m_X = x;
|
m_List[Count].m_X = x;
|
||||||
|
|
@ -69,7 +51,9 @@ namespace Server
|
||||||
m_List = new Point3D[old.Length * 2];
|
m_List = new Point3D[old.Length * 2];
|
||||||
|
|
||||||
for (var i = 0; i < old.Length; ++i)
|
for (var i = 0; i < old.Length; ++i)
|
||||||
|
{
|
||||||
m_List[i] = old[i];
|
m_List[i] = old[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_List[Count].m_X = p.m_X;
|
m_List[Count].m_X = p.m_X;
|
||||||
|
|
@ -81,12 +65,16 @@ namespace Server
|
||||||
public Point3D[] ToArray()
|
public Point3D[] ToArray()
|
||||||
{
|
{
|
||||||
if (Count == 0)
|
if (Count == 0)
|
||||||
|
{
|
||||||
return m_EmptyList;
|
return m_EmptyList;
|
||||||
|
}
|
||||||
|
|
||||||
var list = new Point3D[Count];
|
var list = new Point3D[Count];
|
||||||
|
|
||||||
for (var i = 0; i < Count; ++i)
|
for (var i = 0; i < Count; ++i)
|
||||||
|
{
|
||||||
list[i] = m_List[i];
|
list[i] = m_List[i];
|
||||||
|
}
|
||||||
|
|
||||||
Count = 0;
|
Count = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Rectangle2D.cs *
|
* File: Rectangle2D.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -111,16 +111,24 @@ namespace Server
|
||||||
public void MakeHold(Rectangle2D r)
|
public void MakeHold(Rectangle2D r)
|
||||||
{
|
{
|
||||||
if (r.m_Start.m_X < m_Start.m_X)
|
if (r.m_Start.m_X < m_Start.m_X)
|
||||||
|
{
|
||||||
m_Start.m_X = r.m_Start.m_X;
|
m_Start.m_X = r.m_Start.m_X;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_Start.m_Y < m_Start.m_Y)
|
if (r.m_Start.m_Y < m_Start.m_Y)
|
||||||
|
{
|
||||||
m_Start.m_Y = r.m_Start.m_Y;
|
m_Start.m_Y = r.m_Start.m_Y;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_End.m_X > m_End.m_X)
|
if (r.m_End.m_X > m_End.m_X)
|
||||||
|
{
|
||||||
m_End.m_X = r.m_End.m_X;
|
m_End.m_X = r.m_End.m_X;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_End.m_Y > m_End.m_Y)
|
if (r.m_End.m_Y > m_End.m_Y)
|
||||||
|
{
|
||||||
m_End.m_Y = r.m_End.m_Y;
|
m_End.m_Y = r.m_End.m_Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(Point3D p) =>
|
public bool Contains(Point3D p) =>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Rectangle3D.cs *
|
* File: Rectangle3D.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -81,22 +81,34 @@ namespace Server
|
||||||
public void MakeHold(Rectangle3D r)
|
public void MakeHold(Rectangle3D r)
|
||||||
{
|
{
|
||||||
if (r.m_Start.m_X < m_Start.m_X)
|
if (r.m_Start.m_X < m_Start.m_X)
|
||||||
|
{
|
||||||
m_Start.m_X = r.m_Start.m_X;
|
m_Start.m_X = r.m_Start.m_X;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_Start.m_Y < m_Start.m_Y)
|
if (r.m_Start.m_Y < m_Start.m_Y)
|
||||||
|
{
|
||||||
m_Start.m_Y = r.m_Start.m_Y;
|
m_Start.m_Y = r.m_Start.m_Y;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_Start.m_Z < m_Start.m_Z)
|
if (r.m_Start.m_Z < m_Start.m_Z)
|
||||||
|
{
|
||||||
m_Start.m_Z = r.m_Start.m_Z;
|
m_Start.m_Z = r.m_Start.m_Z;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_End.m_X > m_End.m_X)
|
if (r.m_End.m_X > m_End.m_X)
|
||||||
|
{
|
||||||
m_End.m_X = r.m_End.m_X;
|
m_End.m_X = r.m_End.m_X;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_End.m_Y > m_End.m_Y)
|
if (r.m_End.m_Y > m_End.m_Y)
|
||||||
|
{
|
||||||
m_End.m_Y = r.m_End.m_Y;
|
m_End.m_Y = r.m_End.m_Y;
|
||||||
|
}
|
||||||
|
|
||||||
if (r.m_End.m_Z < m_End.m_Z)
|
if (r.m_End.m_Z < m_End.m_Z)
|
||||||
|
{
|
||||||
m_End.m_Z = r.m_End.m_Z;
|
m_End.m_Z = r.m_End.m_Z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(Point3D p) =>
|
public bool Contains(Point3D p) =>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: WorldLocation.cs *
|
* File: WorldLocation.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -104,7 +104,11 @@ namespace Server
|
||||||
public int CompareTo(WorldLocation other)
|
public int CompareTo(WorldLocation other)
|
||||||
{
|
{
|
||||||
var locComparison = m_Loc.CompareTo(other.m_Loc);
|
var locComparison = m_Loc.CompareTo(other.m_Loc);
|
||||||
if (locComparison != 0) return locComparison;
|
if (locComparison != 0)
|
||||||
|
{
|
||||||
|
return locComparison;
|
||||||
|
}
|
||||||
|
|
||||||
return Comparer<Map>.Default.Compare(m_Map, other.m_Map);
|
return Comparer<Map>.Default.Compare(m_Map, other.m_Map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Guild.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
|
@ -39,7 +19,10 @@ namespace Server.Guilds
|
||||||
Serial = id;
|
Serial = id;
|
||||||
List.Add(Serial, this);
|
List.Add(Serial, this);
|
||||||
if (Serial + 1 > m_NextID)
|
if (Serial + 1 > m_NextID)
|
||||||
|
{
|
||||||
m_NextID = Serial + 1;
|
m_NextID = Serial + 1;
|
||||||
|
}
|
||||||
|
|
||||||
SaveBuffer = new BufferedFileWriter(true);
|
SaveBuffer = new BufferedFileWriter(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +78,9 @@ namespace Server.Guilds
|
||||||
var name = g.Name.ToLower();
|
var name = g.Name.ToLower();
|
||||||
|
|
||||||
if (words.All(t => name.IndexOf(t) != -1))
|
if (words.All(t => name.IndexOf(t) != -1))
|
||||||
|
{
|
||||||
results.Add(g);
|
results.Add(g);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Gump.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -232,15 +212,21 @@ namespace Server.Gumps
|
||||||
public void Add(GumpEntry g)
|
public void Add(GumpEntry g)
|
||||||
{
|
{
|
||||||
if (g.Parent != this)
|
if (g.Parent != this)
|
||||||
|
{
|
||||||
g.Parent = this;
|
g.Parent = this;
|
||||||
|
}
|
||||||
else if (!Entries.Contains(g))
|
else if (!Entries.Contains(g))
|
||||||
|
{
|
||||||
Entries.Add(g);
|
Entries.Add(g);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(GumpEntry g)
|
public void Remove(GumpEntry g)
|
||||||
{
|
{
|
||||||
if (g == null || !Entries.Contains(g))
|
if (g == null || !Entries.Contains(g))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Entries.Remove(g);
|
Entries.Remove(g);
|
||||||
g.Parent = null;
|
g.Parent = null;
|
||||||
|
|
@ -250,7 +236,10 @@ namespace Server.Gumps
|
||||||
{
|
{
|
||||||
var indexOf = Strings.IndexOf(value);
|
var indexOf = Strings.IndexOf(value);
|
||||||
|
|
||||||
if (indexOf >= 0) return indexOf;
|
if (indexOf >= 0)
|
||||||
|
{
|
||||||
|
return indexOf;
|
||||||
|
}
|
||||||
|
|
||||||
Strings.Add(value);
|
Strings.Add(value);
|
||||||
return Strings.Count - 1;
|
return Strings.Count - 1;
|
||||||
|
|
@ -269,21 +258,33 @@ namespace Server.Gumps
|
||||||
IGumpWriter disp;
|
IGumpWriter disp;
|
||||||
|
|
||||||
if (ns?.Unpack == true)
|
if (ns?.Unpack == true)
|
||||||
|
{
|
||||||
disp = new DisplayGumpPacked(this);
|
disp = new DisplayGumpPacked(this);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
disp = new DisplayGumpFast(this);
|
disp = new DisplayGumpFast(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Draggable)
|
if (!Draggable)
|
||||||
|
{
|
||||||
disp.AppendLayout(m_NoMove);
|
disp.AppendLayout(m_NoMove);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Closable)
|
if (!Closable)
|
||||||
|
{
|
||||||
disp.AppendLayout(m_NoClose);
|
disp.AppendLayout(m_NoClose);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Disposable)
|
if (!Disposable)
|
||||||
|
{
|
||||||
disp.AppendLayout(m_NoDispose);
|
disp.AppendLayout(m_NoDispose);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Resizable)
|
if (!Resizable)
|
||||||
|
{
|
||||||
disp.AppendLayout(m_NoResize);
|
disp.AppendLayout(m_NoResize);
|
||||||
|
}
|
||||||
|
|
||||||
var count = Entries.Count;
|
var count = Entries.Count;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpAlphaRegion.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpBackground.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpButton.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpCheck.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: GumpECHandleInput.cs *
|
* File: GumpECHandleInput.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpEntry.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpGroup.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpHtml.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpHtmlLocalized.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpImage.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpImageTileButton.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : April 26, 2005
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
@ -91,8 +71,11 @@ namespace Server.Gumps
|
||||||
public override string Compile(NetState ns)
|
public override string Compile(NetState ns)
|
||||||
{
|
{
|
||||||
if (LocalizedTooltip > 0)
|
if (LocalizedTooltip > 0)
|
||||||
|
{
|
||||||
return
|
return
|
||||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}";
|
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}";
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
|
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpImageTiled.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpItem.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
@ -54,7 +34,9 @@ namespace Server.Gumps
|
||||||
disp.AppendLayout(ItemID);
|
disp.AppendLayout(ItemID);
|
||||||
|
|
||||||
if (Hue != 0)
|
if (Hue != 0)
|
||||||
|
{
|
||||||
disp.AppendLayout(Hue);
|
disp.AppendLayout(Hue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpItemProperty.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 26, 2013
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpLabel.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpLabelCropped.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: GumpMasterGump.cs *
|
* File: GumpMasterGump.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpPage.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpRadio.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: GumpSpriteImage.cs *
|
* File: GumpSpriteImage.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpTextEntry.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* GumpTextEntryLimited.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: GumpTooltip.cs *
|
* File: GumpTooltip.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* RelayInfo.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
namespace Server.Gumps
|
namespace Server.Gumps
|
||||||
{
|
{
|
||||||
public class TextRelay
|
public class TextRelay
|
||||||
|
|
@ -51,8 +31,12 @@ namespace Server.Gumps
|
||||||
public bool IsSwitched(int switchID)
|
public bool IsSwitched(int switchID)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < Switches.Length; ++i)
|
for (var i = 0; i < Switches.Length; ++i)
|
||||||
|
{
|
||||||
if (Switches[i] == switchID)
|
if (Switches[i] == switchID)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +44,12 @@ namespace Server.Gumps
|
||||||
public TextRelay GetTextEntry(int entryID)
|
public TextRelay GetTextEntry(int entryID)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < TextEntries.Length; ++i)
|
for (var i = 0; i < TextEntries.Length; ++i)
|
||||||
|
{
|
||||||
if (TextEntries[i].EntryID == entryID)
|
if (TextEntries[i].EntryID == entryID)
|
||||||
|
{
|
||||||
return TextEntries[i];
|
return TextEntries[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* HuePicker.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.HuePickers
|
namespace Server.HuePickers
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* IAccount.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server.Accounting
|
namespace Server.Accounting
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* IEntity.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Insensitive.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Interfaces.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* BaseMulti.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server.Items
|
namespace Server.Items
|
||||||
|
|
@ -60,7 +40,10 @@ namespace Server.Items
|
||||||
int id = mcl.List[0].ItemId;
|
int id = mcl.List[0].ItemId;
|
||||||
|
|
||||||
if (id < 0x4000)
|
if (id < 0x4000)
|
||||||
|
{
|
||||||
return 1020000 + id;
|
return 1020000 + id;
|
||||||
|
}
|
||||||
|
|
||||||
return 1078872 + id;
|
return 1078872 + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,8 +112,12 @@ namespace Server.Items
|
||||||
var version = reader.ReadInt();
|
var version = reader.ReadInt();
|
||||||
|
|
||||||
if (version == 0)
|
if (version == 0)
|
||||||
|
{
|
||||||
if (ItemID >= 0x4000)
|
if (ItemID >= 0x4000)
|
||||||
|
{
|
||||||
ItemID -= 0x4000;
|
ItemID -= 0x4000;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Container.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -71,7 +51,9 @@ namespace Server.Items
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_ContainerData == null)
|
if (m_ContainerData == null)
|
||||||
|
{
|
||||||
UpdateContainerData();
|
UpdateContainerData();
|
||||||
|
}
|
||||||
|
|
||||||
return m_ContainerData;
|
return m_ContainerData;
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +71,9 @@ namespace Server.Items
|
||||||
base.ItemID = value;
|
base.ItemID = value;
|
||||||
|
|
||||||
if (ItemID != oldID)
|
if (ItemID != oldID)
|
||||||
|
{
|
||||||
UpdateContainerData();
|
UpdateContainerData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +107,10 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (Parent is Container container && container.MaxWeight == 0) return 0;
|
if (Parent is Container container && container.MaxWeight == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return DefaultMaxWeight;
|
return DefaultMaxWeight;
|
||||||
}
|
}
|
||||||
|
|
@ -206,7 +193,9 @@ namespace Server.Items
|
||||||
if (IsDecoContainer)
|
if (IsDecoContainer)
|
||||||
{
|
{
|
||||||
if (message)
|
if (message)
|
||||||
|
{
|
||||||
SendCantStoreMessage(m, item);
|
SendCantStoreMessage(m, item);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +206,9 @@ namespace Server.Items
|
||||||
TotalItems + plusItems + item.TotalItems + (item.IsVirtualItem ? 0 : 1) > maxItems)
|
TotalItems + plusItems + item.TotalItems + (item.IsVirtualItem ? 0 : 1) > maxItems)
|
||||||
{
|
{
|
||||||
if (message)
|
if (message)
|
||||||
|
{
|
||||||
SendFullItemsMessage(m, item);
|
SendFullItemsMessage(m, item);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +216,9 @@ namespace Server.Items
|
||||||
if (MaxWeight != 0 && TotalWeight + plusWeight + item.TotalWeight + item.PileWeight > MaxWeight)
|
if (MaxWeight != 0 && TotalWeight + plusWeight + item.TotalWeight + item.PileWeight > MaxWeight)
|
||||||
{
|
{
|
||||||
if (message)
|
if (message)
|
||||||
|
{
|
||||||
SendFullWeightMessage(m, item);
|
SendFullWeightMessage(m, item);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -236,10 +229,14 @@ namespace Server.Items
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
if (parent is Container container)
|
if (parent is Container container)
|
||||||
|
{
|
||||||
return container.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
|
return container.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(parent is Item parentItem))
|
if (!(parent is Item parentItem))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
parent = parentItem.Parent;
|
parent = parentItem.Parent;
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +262,9 @@ namespace Server.Items
|
||||||
public virtual bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
public virtual bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||||
{
|
{
|
||||||
if (!CheckHold(from, item, true, true))
|
if (!CheckHold(from, item, true, true))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
item.Location = new Point3D(p.m_X, p.m_Y, 0);
|
item.Location = new Point3D(p.m_X, p.m_Y, 0);
|
||||||
AddItem(item);
|
AddItem(item);
|
||||||
|
|
@ -280,8 +279,12 @@ namespace Server.Items
|
||||||
var t = item.GetType();
|
var t = item.GetType();
|
||||||
|
|
||||||
for (var i = 0; i < types.Length; ++i)
|
for (var i = 0; i < types.Length; ++i)
|
||||||
|
{
|
||||||
if (types[i].IsAssignableFrom(t))
|
if (types[i].IsAssignableFrom(t))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +292,9 @@ namespace Server.Items
|
||||||
private static void SetSaveFlag(ref SaveFlag flags, SaveFlag toSet, bool setIf)
|
private static void SetSaveFlag(ref SaveFlag flags, SaveFlag toSet, bool setIf)
|
||||||
{
|
{
|
||||||
if (setIf)
|
if (setIf)
|
||||||
|
{
|
||||||
flags |= toSet;
|
flags |= toSet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet) => (flags & toGet) != 0;
|
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet) => (flags & toGet) != 0;
|
||||||
|
|
@ -310,13 +315,19 @@ namespace Server.Items
|
||||||
writer.Write((byte)flags);
|
writer.Write((byte)flags);
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.MaxItems))
|
if (GetSaveFlag(flags, SaveFlag.MaxItems))
|
||||||
|
{
|
||||||
writer.WriteEncodedInt(m_MaxItems);
|
writer.WriteEncodedInt(m_MaxItems);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.GumpID))
|
if (GetSaveFlag(flags, SaveFlag.GumpID))
|
||||||
|
{
|
||||||
writer.WriteEncodedInt(m_GumpID);
|
writer.WriteEncodedInt(m_GumpID);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.DropSound))
|
if (GetSaveFlag(flags, SaveFlag.DropSound))
|
||||||
|
{
|
||||||
writer.WriteEncodedInt(m_DropSound);
|
writer.WriteEncodedInt(m_DropSound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
public override void Deserialize(IGenericReader reader)
|
||||||
|
|
@ -332,19 +343,31 @@ namespace Server.Items
|
||||||
var flags = (SaveFlag)reader.ReadByte();
|
var flags = (SaveFlag)reader.ReadByte();
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.MaxItems))
|
if (GetSaveFlag(flags, SaveFlag.MaxItems))
|
||||||
|
{
|
||||||
m_MaxItems = reader.ReadEncodedInt();
|
m_MaxItems = reader.ReadEncodedInt();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_MaxItems = -1;
|
m_MaxItems = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.GumpID))
|
if (GetSaveFlag(flags, SaveFlag.GumpID))
|
||||||
|
{
|
||||||
m_GumpID = reader.ReadEncodedInt();
|
m_GumpID = reader.ReadEncodedInt();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_GumpID = -1;
|
m_GumpID = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.DropSound))
|
if (GetSaveFlag(flags, SaveFlag.DropSound))
|
||||||
|
{
|
||||||
m_DropSound = reader.ReadEncodedInt();
|
m_DropSound = reader.ReadEncodedInt();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_DropSound = -1;
|
m_DropSound = -1;
|
||||||
|
}
|
||||||
|
|
||||||
LiftOverride = GetSaveFlag(flags, SaveFlag.LiftOverride);
|
LiftOverride = GetSaveFlag(flags, SaveFlag.LiftOverride);
|
||||||
|
|
||||||
|
|
@ -358,19 +381,27 @@ namespace Server.Items
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if (version < 1)
|
if (version < 1)
|
||||||
|
{
|
||||||
m_MaxItems = GlobalMaxItems;
|
m_MaxItems = GlobalMaxItems;
|
||||||
|
}
|
||||||
|
|
||||||
m_GumpID = reader.ReadInt();
|
m_GumpID = reader.ReadInt();
|
||||||
m_DropSound = reader.ReadInt();
|
m_DropSound = reader.ReadInt();
|
||||||
|
|
||||||
if (m_GumpID == DefaultGumpID)
|
if (m_GumpID == DefaultGumpID)
|
||||||
|
{
|
||||||
m_GumpID = -1;
|
m_GumpID = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_DropSound == DefaultDropSound)
|
if (m_DropSound == DefaultDropSound)
|
||||||
|
{
|
||||||
m_DropSound = -1;
|
m_DropSound = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_MaxItems == DefaultMaxItems)
|
if (m_MaxItems == DefaultMaxItems)
|
||||||
|
{
|
||||||
m_MaxItems = -1;
|
m_MaxItems = -1;
|
||||||
|
}
|
||||||
|
|
||||||
// m_Bounds = new Rectangle2D( reader.ReadPoint2D(), reader.ReadPoint2D() );
|
// m_Bounds = new Rectangle2D( reader.ReadPoint2D(), reader.ReadPoint2D() );
|
||||||
reader.ReadPoint2D();
|
reader.ReadPoint2D();
|
||||||
|
|
@ -397,6 +428,7 @@ namespace Server.Items
|
||||||
public override void UpdateTotal(Item sender, TotalType type, int delta)
|
public override void UpdateTotal(Item sender, TotalType type, int delta)
|
||||||
{
|
{
|
||||||
if (sender != this && delta != 0 && !sender.IsVirtualItem)
|
if (sender != this && delta != 0 && !sender.IsVirtualItem)
|
||||||
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TotalType.Gold:
|
case TotalType.Gold:
|
||||||
|
|
@ -413,6 +445,7 @@ namespace Server.Items
|
||||||
InvalidateProperties();
|
InvalidateProperties();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
base.UpdateTotal(sender, type, delta);
|
base.UpdateTotal(sender, type, delta);
|
||||||
}
|
}
|
||||||
|
|
@ -426,7 +459,9 @@ namespace Server.Items
|
||||||
var items = m_Items;
|
var items = m_Items;
|
||||||
|
|
||||||
if (items == null)
|
if (items == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < items.Count; ++i)
|
for (var i = 0; i < items.Count; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -435,7 +470,9 @@ namespace Server.Items
|
||||||
item.UpdateTotals();
|
item.UpdateTotals();
|
||||||
|
|
||||||
if (item.IsVirtualItem)
|
if (item.IsVirtualItem)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
m_TotalGold += item.TotalGold;
|
m_TotalGold += item.TotalGold;
|
||||||
m_TotalItems += item.TotalItems + 1;
|
m_TotalItems += item.TotalItems + 1;
|
||||||
|
|
@ -471,7 +508,9 @@ namespace Server.Items
|
||||||
|
|
||||||
if (!(item is Container) && CheckHold(from, dropped, false, false) &&
|
if (!(item is Container) && CheckHold(from, dropped, false, false) &&
|
||||||
item.StackWith(from, dropped, playSound))
|
item.StackWith(from, dropped, playSound))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckHold(from, dropped, sendFullMessage, true))
|
if (CheckHold(from, dropped, sendFullMessage, true))
|
||||||
|
|
@ -525,10 +564,14 @@ namespace Server.Items
|
||||||
if (dropItems.Count + stackItems.Count == droppedItems.Length) // All good
|
if (dropItems.Count + stackItems.Count == droppedItems.Length) // All good
|
||||||
{
|
{
|
||||||
for (var i = 0; i < dropItems.Count; i++)
|
for (var i = 0; i < dropItems.Count; i++)
|
||||||
|
{
|
||||||
DropItem(dropItems[i]);
|
DropItem(dropItems[i]);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < stackItems.Count; i++)
|
for (var i = 0; i < stackItems.Count; i++)
|
||||||
stackItems[i].m_StackItem.StackWith(from, stackItems[i].m_DropItem, false);
|
{
|
||||||
|
stackItems[i].m_StackItem.StackWith(@from, stackItems[i].m_DropItem, false);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -542,11 +585,13 @@ namespace Server.Items
|
||||||
var map = Map;
|
var map = Map;
|
||||||
|
|
||||||
for (var i = Items.Count - 1; i >= 0; --i)
|
for (var i = Items.Count - 1; i >= 0; --i)
|
||||||
|
{
|
||||||
if (i < Items.Count)
|
if (i < Items.Count)
|
||||||
{
|
{
|
||||||
Items[i].SetLastMoved();
|
Items[i].SetLastMoved();
|
||||||
Items[i].MoveToWorld(loc, map);
|
Items[i].MoveToWorld(loc, map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Delete();
|
Delete();
|
||||||
}
|
}
|
||||||
|
|
@ -554,7 +599,9 @@ namespace Server.Items
|
||||||
public virtual void DropItem(Item dropped)
|
public virtual void DropItem(Item dropped)
|
||||||
{
|
{
|
||||||
if (dropped == null)
|
if (dropped == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddItem(dropped);
|
AddItem(dropped);
|
||||||
|
|
||||||
|
|
@ -564,14 +611,22 @@ namespace Server.Items
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (bounds.Width >= ourBounds.Width)
|
if (bounds.Width >= ourBounds.Width)
|
||||||
|
{
|
||||||
x = (ourBounds.Width - bounds.Width) / 2;
|
x = (ourBounds.Width - bounds.Width) / 2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
x = Utility.Random(ourBounds.Width - bounds.Width);
|
x = Utility.Random(ourBounds.Width - bounds.Width);
|
||||||
|
}
|
||||||
|
|
||||||
if (bounds.Height >= ourBounds.Height)
|
if (bounds.Height >= ourBounds.Height)
|
||||||
|
{
|
||||||
y = (ourBounds.Height - bounds.Height) / 2;
|
y = (ourBounds.Height - bounds.Height) / 2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
y = Utility.Random(ourBounds.Height - bounds.Height);
|
y = Utility.Random(ourBounds.Height - bounds.Height);
|
||||||
|
}
|
||||||
|
|
||||||
x += ourBounds.X;
|
x += ourBounds.X;
|
||||||
x -= bounds.X;
|
x -= bounds.X;
|
||||||
|
|
@ -593,9 +648,13 @@ namespace Server.Items
|
||||||
if (trade != null)
|
if (trade != null)
|
||||||
{
|
{
|
||||||
if (trade.From.Mobile == from)
|
if (trade.From.Mobile == from)
|
||||||
|
{
|
||||||
DisplayTo(trade.To.Mobile);
|
DisplayTo(trade.To.Mobile);
|
||||||
|
}
|
||||||
else if (trade.To.Mobile == from)
|
else if (trade.To.Mobile == from)
|
||||||
|
{
|
||||||
DisplayTo(trade.From.Mobile);
|
DisplayTo(trade.From.Mobile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -614,7 +673,10 @@ namespace Server.Items
|
||||||
base.OnSingleClick(from);
|
base.OnSingleClick(from);
|
||||||
|
|
||||||
if (CheckContentDisplay(from))
|
if (CheckContentDisplay(from))
|
||||||
LabelTo(from, "({0} item{2}, {1} stones)", TotalItems, TotalWeight, TotalItems != 1 ? "s" : string.Empty);
|
{
|
||||||
|
LabelTo(@from, "({0} item{2}, {1} stones)", TotalItems, TotalWeight, TotalItems != 1 ? "s" : string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
// LabelTo( from, 1050044, String.Format( "{0}\t{1}", TotalItems.ToString(), TotalWeight.ToString() ) );
|
// LabelTo( from, 1050044, String.Format( "{0}\t{1}", TotalItems.ToString(), TotalWeight.ToString() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,9 +696,13 @@ namespace Server.Items
|
||||||
if (ns != null)
|
if (ns != null)
|
||||||
{
|
{
|
||||||
if (ns.HighSeas)
|
if (ns.HighSeas)
|
||||||
|
{
|
||||||
to.Send(new ContainerDisplayHS(Serial, GumpID));
|
to.Send(new ContainerDisplayHS(Serial, GumpID));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
to.Send(new ContainerDisplay(Serial, GumpID));
|
to.Send(new ContainerDisplay(Serial, GumpID));
|
||||||
|
}
|
||||||
|
|
||||||
SendContentTo(ns);
|
SendContentTo(ns);
|
||||||
|
|
||||||
|
|
@ -645,7 +711,9 @@ namespace Server.Items
|
||||||
var items = Items;
|
var items = Items;
|
||||||
|
|
||||||
for (var i = 0; i < items.Count; ++i)
|
for (var i = 0; i < items.Count; ++i)
|
||||||
|
{
|
||||||
to.Send(items[i].OPLPacket);
|
to.Send(items[i].OPLPacket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -653,7 +721,9 @@ namespace Server.Items
|
||||||
public void ProcessOpeners(Mobile opener)
|
public void ProcessOpeners(Mobile opener)
|
||||||
{
|
{
|
||||||
if (IsPublicContainer)
|
if (IsPublicContainer)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var contains = false;
|
var contains = false;
|
||||||
|
|
||||||
|
|
@ -675,7 +745,9 @@ namespace Server.Items
|
||||||
var range = GetUpdateRange(mob);
|
var range = GetUpdateRange(mob);
|
||||||
|
|
||||||
if (mob.Map != map || !mob.InRange(worldLoc, range))
|
if (mob.Map != map || !mob.InRange(worldLoc, range))
|
||||||
|
{
|
||||||
Openers.RemoveAt(i--);
|
Openers.RemoveAt(i--);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,12 +767,18 @@ namespace Server.Items
|
||||||
public virtual void SendContentTo(NetState state)
|
public virtual void SendContentTo(NetState state)
|
||||||
{
|
{
|
||||||
if (state == null)
|
if (state == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (state.ContainerGridLines)
|
if (state.ContainerGridLines)
|
||||||
|
{
|
||||||
state.Send(new ContainerContent6017(state.Mobile, this));
|
state.Send(new ContainerContent6017(state.Mobile, this));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
state.Send(new ContainerContent(state.Mobile, this));
|
state.Send(new ContainerContent(state.Mobile, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetProperties(ObjectPropertyList list)
|
public override void GetProperties(ObjectPropertyList list)
|
||||||
|
|
@ -712,6 +790,7 @@ namespace Server.Items
|
||||||
if (Core.ML)
|
if (Core.ML)
|
||||||
{
|
{
|
||||||
if (ParentsContain<BankBox>()) // Root Parent is the Mobile. Parent could be another containter.
|
if (ParentsContain<BankBox>()) // Root Parent is the Mobile. Parent could be another containter.
|
||||||
|
{
|
||||||
list.Add(
|
list.Add(
|
||||||
1073841,
|
1073841,
|
||||||
"{0}\t{1}\t{2}",
|
"{0}\t{1}\t{2}",
|
||||||
|
|
@ -719,7 +798,9 @@ namespace Server.Items
|
||||||
MaxItems,
|
MaxItems,
|
||||||
TotalWeight
|
TotalWeight
|
||||||
); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~ stones
|
); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~ stones
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
list.Add(
|
list.Add(
|
||||||
1072241,
|
1072241,
|
||||||
"{0}\t{1}\t{2}\t{3}",
|
"{0}\t{1}\t{2}\t{3}",
|
||||||
|
|
@ -728,6 +809,7 @@ namespace Server.Items
|
||||||
TotalWeight,
|
TotalWeight,
|
||||||
MaxWeight
|
MaxWeight
|
||||||
); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~/~4_MAXWEIGHT~ stones
|
); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~/~4_MAXWEIGHT~ stones
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Where do the other clilocs come into play? 1073839 & 1073840?
|
// TODO: Where do the other clilocs come into play? 1073839 & 1073840?
|
||||||
}
|
}
|
||||||
|
|
@ -741,15 +823,21 @@ namespace Server.Items
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
{
|
{
|
||||||
if (from.AccessLevel > AccessLevel.Player || from.InRange(GetWorldLocation(), 2))
|
if (from.AccessLevel > AccessLevel.Player || from.InRange(GetWorldLocation(), 2))
|
||||||
DisplayTo(from);
|
{
|
||||||
|
DisplayTo(@from);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
from.SendLocalizedMessage(500446); // That is too far away.
|
{
|
||||||
|
@from.SendLocalizedMessage(500446); // That is too far away.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ConsumeTotalGrouped(Type type, int amount, bool recurse, OnItemConsumed callback, CheckItemGroup grouper)
|
public bool ConsumeTotalGrouped(Type type, int amount, bool recurse, OnItemConsumed callback, CheckItemGroup grouper)
|
||||||
{
|
{
|
||||||
if (grouper == null)
|
if (grouper == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException(nameof(grouper));
|
throw new ArgumentNullException(nameof(grouper));
|
||||||
|
}
|
||||||
|
|
||||||
var typedItems = FindItemsByType(type, recurse);
|
var typedItems = FindItemsByType(type, recurse);
|
||||||
|
|
||||||
|
|
@ -769,9 +857,13 @@ namespace Server.Items
|
||||||
var v = grouper(a, b);
|
var v = grouper(a, b);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
group.Add(b);
|
{
|
||||||
|
@group.Add(b);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
@ -789,16 +881,23 @@ namespace Server.Items
|
||||||
items[i] = groups[i].ToArray();
|
items[i] = groups[i].ToArray();
|
||||||
|
|
||||||
for (var j = 0; j < items[i].Length; ++j)
|
for (var j = 0; j < items[i].Length; ++j)
|
||||||
|
{
|
||||||
totals[i] += items[i][j].Amount;
|
totals[i] += items[i][j].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (totals[i] >= amount)
|
if (totals[i] >= amount)
|
||||||
|
{
|
||||||
hasEnough = true;
|
hasEnough = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasEnough)
|
if (!hasEnough)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < items.Length; ++i)
|
for (var i = 0; i < items.Length; ++i)
|
||||||
|
{
|
||||||
if (totals[i] >= amount)
|
if (totals[i] >= amount)
|
||||||
{
|
{
|
||||||
var need = amount;
|
var need = amount;
|
||||||
|
|
@ -827,6 +926,7 @@ namespace Server.Items
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -837,9 +937,14 @@ namespace Server.Items
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (types.Length != amounts.Length)
|
if (types.Length != amounts.Length)
|
||||||
|
{
|
||||||
throw new ArgumentException("length of types and amounts must match");
|
throw new ArgumentException("length of types and amounts must match");
|
||||||
|
}
|
||||||
|
|
||||||
if (grouper == null)
|
if (grouper == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException(nameof(grouper));
|
throw new ArgumentNullException(nameof(grouper));
|
||||||
|
}
|
||||||
|
|
||||||
var items = new Item[types.Length][][];
|
var items = new Item[types.Length][][];
|
||||||
var totals = new int[types.Length][];
|
var totals = new int[types.Length][];
|
||||||
|
|
@ -864,9 +969,13 @@ namespace Server.Items
|
||||||
var v = grouper(a, b);
|
var v = grouper(a, b);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
group.Add(b);
|
{
|
||||||
|
@group.Add(b);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
@ -884,18 +993,26 @@ namespace Server.Items
|
||||||
items[i][j] = groups[j].ToArray();
|
items[i][j] = groups[j].ToArray();
|
||||||
|
|
||||||
for (var k = 0; k < items[i][j].Length; ++k)
|
for (var k = 0; k < items[i][j].Length; ++k)
|
||||||
|
{
|
||||||
totals[i][j] += items[i][j][k].Amount;
|
totals[i][j] += items[i][j][k].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (totals[i][j] >= amounts[i])
|
if (totals[i][j] >= amounts[i])
|
||||||
|
{
|
||||||
hasEnough = true;
|
hasEnough = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasEnough)
|
if (!hasEnough)
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < items.Length; ++i)
|
for (var i = 0; i < items.Length; ++i)
|
||||||
|
{
|
||||||
for (var j = 0; j < items[i].Length; ++j)
|
for (var j = 0; j < items[i].Length; ++j)
|
||||||
|
{
|
||||||
if (totals[i][j] >= amounts[i])
|
if (totals[i][j] >= amounts[i])
|
||||||
{
|
{
|
||||||
var need = amounts[i];
|
var need = amounts[i];
|
||||||
|
|
@ -924,6 +1041,8 @@ namespace Server.Items
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -934,9 +1053,14 @@ namespace Server.Items
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (types.Length != amounts.Length)
|
if (types.Length != amounts.Length)
|
||||||
|
{
|
||||||
throw new ArgumentException("length of types and amounts must match");
|
throw new ArgumentException("length of types and amounts must match");
|
||||||
|
}
|
||||||
|
|
||||||
if (grouper == null)
|
if (grouper == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException(nameof(grouper));
|
throw new ArgumentNullException(nameof(grouper));
|
||||||
|
}
|
||||||
|
|
||||||
var items = new Item[types.Length][][];
|
var items = new Item[types.Length][][];
|
||||||
var totals = new int[types.Length][];
|
var totals = new int[types.Length][];
|
||||||
|
|
@ -961,9 +1085,13 @@ namespace Server.Items
|
||||||
var v = grouper(a, b);
|
var v = grouper(a, b);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
group.Add(b);
|
{
|
||||||
|
@group.Add(b);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
@ -981,18 +1109,26 @@ namespace Server.Items
|
||||||
items[i][j] = groups[j].ToArray();
|
items[i][j] = groups[j].ToArray();
|
||||||
|
|
||||||
for (var k = 0; k < items[i][j].Length; ++k)
|
for (var k = 0; k < items[i][j].Length; ++k)
|
||||||
|
{
|
||||||
totals[i][j] += items[i][j][k].Amount;
|
totals[i][j] += items[i][j][k].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (totals[i][j] >= amounts[i])
|
if (totals[i][j] >= amounts[i])
|
||||||
|
{
|
||||||
hasEnough = true;
|
hasEnough = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasEnough)
|
if (!hasEnough)
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < items.Length; ++i)
|
for (var i = 0; i < items.Length; ++i)
|
||||||
|
{
|
||||||
for (var j = 0; j < items[i].Length; ++j)
|
for (var j = 0; j < items[i].Length; ++j)
|
||||||
|
{
|
||||||
if (totals[i][j] >= amounts[i])
|
if (totals[i][j] >= amounts[i])
|
||||||
{
|
{
|
||||||
var need = amounts[i];
|
var need = amounts[i];
|
||||||
|
|
@ -1021,6 +1157,8 @@ namespace Server.Items
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1028,7 +1166,9 @@ namespace Server.Items
|
||||||
public int ConsumeTotal(Type[][] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
public int ConsumeTotal(Type[][] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
||||||
{
|
{
|
||||||
if (types.Length != amounts.Length)
|
if (types.Length != amounts.Length)
|
||||||
|
{
|
||||||
throw new ArgumentException("length of types and amounts must match");
|
throw new ArgumentException("length of types and amounts must match");
|
||||||
|
}
|
||||||
|
|
||||||
var items = new Item[types.Length][];
|
var items = new Item[types.Length][];
|
||||||
var totals = new int[types.Length];
|
var totals = new int[types.Length];
|
||||||
|
|
@ -1038,10 +1178,14 @@ namespace Server.Items
|
||||||
items[i] = FindItemsByType(types[i], recurse);
|
items[i] = FindItemsByType(types[i], recurse);
|
||||||
|
|
||||||
for (var j = 0; j < items[i].Length; ++j)
|
for (var j = 0; j < items[i].Length; ++j)
|
||||||
|
{
|
||||||
totals[i] += items[i][j].Amount;
|
totals[i] += items[i][j].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (totals[i] < amounts[i])
|
if (totals[i] < amounts[i])
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < types.Length; ++i)
|
for (var i = 0; i < types.Length; ++i)
|
||||||
|
|
@ -1077,7 +1221,9 @@ namespace Server.Items
|
||||||
public int ConsumeTotal(Type[] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
public int ConsumeTotal(Type[] types, int[] amounts, bool recurse = true, OnItemConsumed callback = null)
|
||||||
{
|
{
|
||||||
if (types.Length != amounts.Length)
|
if (types.Length != amounts.Length)
|
||||||
|
{
|
||||||
throw new ArgumentException("length of types and amounts must match");
|
throw new ArgumentException("length of types and amounts must match");
|
||||||
|
}
|
||||||
|
|
||||||
var items = new Item[types.Length][];
|
var items = new Item[types.Length][];
|
||||||
var totals = new int[types.Length];
|
var totals = new int[types.Length];
|
||||||
|
|
@ -1087,10 +1233,14 @@ namespace Server.Items
|
||||||
items[i] = FindItemsByType(types[i], recurse);
|
items[i] = FindItemsByType(types[i], recurse);
|
||||||
|
|
||||||
for (var j = 0; j < items[i].Length; ++j)
|
for (var j = 0; j < items[i].Length; ++j)
|
||||||
|
{
|
||||||
totals[i] += items[i][j].Amount;
|
totals[i] += items[i][j].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (totals[i] < amounts[i])
|
if (totals[i] < amounts[i])
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < types.Length; ++i)
|
for (var i = 0; i < types.Length; ++i)
|
||||||
|
|
@ -1131,7 +1281,9 @@ namespace Server.Items
|
||||||
var total = 0;
|
var total = 0;
|
||||||
|
|
||||||
for (var i = 0; i < items.Length; ++i)
|
for (var i = 0; i < items.Length; ++i)
|
||||||
|
{
|
||||||
total += items[i].Amount;
|
total += items[i].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (total >= amount)
|
if (total >= amount)
|
||||||
{
|
{
|
||||||
|
|
@ -1175,7 +1327,9 @@ namespace Server.Items
|
||||||
RecurseConsumeUpTo(this, type, amount, recurse, ref consumed, toDelete);
|
RecurseConsumeUpTo(this, type, amount, recurse, ref consumed, toDelete);
|
||||||
|
|
||||||
while (toDelete.Count > 0)
|
while (toDelete.Count > 0)
|
||||||
|
{
|
||||||
toDelete.Dequeue().Delete();
|
toDelete.Dequeue().Delete();
|
||||||
|
}
|
||||||
|
|
||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
@ -1186,7 +1340,9 @@ namespace Server.Items
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (current == null || current.Items.Count == 0)
|
if (current == null || current.Items.Count == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var list = current.Items;
|
var list = current.Items;
|
||||||
|
|
||||||
|
|
@ -1222,7 +1378,9 @@ namespace Server.Items
|
||||||
public int GetBestGroupAmount(Type type, bool recurse, CheckItemGroup grouper)
|
public int GetBestGroupAmount(Type type, bool recurse, CheckItemGroup grouper)
|
||||||
{
|
{
|
||||||
if (grouper == null)
|
if (grouper == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException(nameof(grouper));
|
throw new ArgumentNullException(nameof(grouper));
|
||||||
|
}
|
||||||
|
|
||||||
var best = 0;
|
var best = 0;
|
||||||
|
|
||||||
|
|
@ -1244,9 +1402,13 @@ namespace Server.Items
|
||||||
var v = grouper(a, b);
|
var v = grouper(a, b);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
group.Add(b);
|
{
|
||||||
|
@group.Add(b);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
@ -1261,10 +1423,14 @@ namespace Server.Items
|
||||||
var total = 0;
|
var total = 0;
|
||||||
|
|
||||||
for (var j = 0; j < items.Length; ++j)
|
for (var j = 0; j < items.Length; ++j)
|
||||||
|
{
|
||||||
total += items[j].Amount;
|
total += items[j].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (total >= best)
|
if (total >= best)
|
||||||
|
{
|
||||||
best = total;
|
best = total;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
|
|
@ -1273,7 +1439,9 @@ namespace Server.Items
|
||||||
public int GetBestGroupAmount(Type[] types, bool recurse, CheckItemGroup grouper)
|
public int GetBestGroupAmount(Type[] types, bool recurse, CheckItemGroup grouper)
|
||||||
{
|
{
|
||||||
if (grouper == null)
|
if (grouper == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException(nameof(grouper));
|
throw new ArgumentNullException(nameof(grouper));
|
||||||
|
}
|
||||||
|
|
||||||
var best = 0;
|
var best = 0;
|
||||||
|
|
||||||
|
|
@ -1295,9 +1463,13 @@ namespace Server.Items
|
||||||
var v = grouper(a, b);
|
var v = grouper(a, b);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
group.Add(b);
|
{
|
||||||
|
@group.Add(b);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
@ -1311,7 +1483,9 @@ namespace Server.Items
|
||||||
var total = items.Sum(t => t.Amount);
|
var total = items.Sum(t => t.Amount);
|
||||||
|
|
||||||
if (total >= best)
|
if (total >= best)
|
||||||
|
{
|
||||||
best = total;
|
best = total;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
|
|
@ -1320,7 +1494,9 @@ namespace Server.Items
|
||||||
public int GetBestGroupAmount(Type[][] types, bool recurse, CheckItemGroup grouper)
|
public int GetBestGroupAmount(Type[][] types, bool recurse, CheckItemGroup grouper)
|
||||||
{
|
{
|
||||||
if (grouper == null)
|
if (grouper == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException(nameof(grouper));
|
throw new ArgumentNullException(nameof(grouper));
|
||||||
|
}
|
||||||
|
|
||||||
var best = 0;
|
var best = 0;
|
||||||
|
|
||||||
|
|
@ -1344,9 +1520,13 @@ namespace Server.Items
|
||||||
var v = grouper(a, b);
|
var v = grouper(a, b);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
group.Add(b);
|
{
|
||||||
|
@group.Add(b);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
|
|
@ -1360,10 +1540,14 @@ namespace Server.Items
|
||||||
var total = 0;
|
var total = 0;
|
||||||
|
|
||||||
for (var k = 0; k < items.Length; ++k)
|
for (var k = 0; k < items.Length; ++k)
|
||||||
|
{
|
||||||
total += items[k].Amount;
|
total += items[k].Amount;
|
||||||
|
}
|
||||||
|
|
||||||
if (total >= best)
|
if (total >= best)
|
||||||
|
{
|
||||||
best = total;
|
best = total;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1377,7 +1561,9 @@ namespace Server.Items
|
||||||
public Item[] FindItemsByType(Type type, bool recurse = true)
|
public Item[] FindItemsByType(Type type, bool recurse = true)
|
||||||
{
|
{
|
||||||
if (m_FindItemsList.Count > 0)
|
if (m_FindItemsList.Count > 0)
|
||||||
|
{
|
||||||
m_FindItemsList.Clear();
|
m_FindItemsList.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
RecurseFindItemsByType(this, type, recurse, m_FindItemsList);
|
RecurseFindItemsByType(this, type, recurse, m_FindItemsList);
|
||||||
|
|
||||||
|
|
@ -1387,7 +1573,9 @@ namespace Server.Items
|
||||||
private static void RecurseFindItemsByType(Item current, Type type, bool recurse, List<Item> list)
|
private static void RecurseFindItemsByType(Item current, Type type, bool recurse, List<Item> list)
|
||||||
{
|
{
|
||||||
if (current == null || current.Items.Count == 0)
|
if (current == null || current.Items.Count == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var items = current.Items;
|
var items = current.Items;
|
||||||
|
|
||||||
|
|
@ -1396,17 +1584,23 @@ namespace Server.Items
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
|
|
||||||
if (type.IsInstanceOfType(item))
|
if (type.IsInstanceOfType(item))
|
||||||
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
if (recurse && item is Container)
|
if (recurse && item is Container)
|
||||||
|
{
|
||||||
RecurseFindItemsByType(item, type, true, list);
|
RecurseFindItemsByType(item, type, true, list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item[] FindItemsByType(Type[] types, bool recurse = true)
|
public Item[] FindItemsByType(Type[] types, bool recurse = true)
|
||||||
{
|
{
|
||||||
if (m_FindItemsList.Count > 0)
|
if (m_FindItemsList.Count > 0)
|
||||||
|
{
|
||||||
m_FindItemsList.Clear();
|
m_FindItemsList.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
RecurseFindItemsByType(this, types, recurse, m_FindItemsList);
|
RecurseFindItemsByType(this, types, recurse, m_FindItemsList);
|
||||||
|
|
||||||
|
|
@ -1416,7 +1610,9 @@ namespace Server.Items
|
||||||
private static void RecurseFindItemsByType(Item current, Type[] types, bool recurse, List<Item> list)
|
private static void RecurseFindItemsByType(Item current, Type[] types, bool recurse, List<Item> list)
|
||||||
{
|
{
|
||||||
if (current == null || current.Items.Count == 0)
|
if (current == null || current.Items.Count == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var items = current.Items;
|
var items = current.Items;
|
||||||
|
|
||||||
|
|
@ -1425,10 +1621,14 @@ namespace Server.Items
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
|
|
||||||
if (InTypeList(item, types))
|
if (InTypeList(item, types))
|
||||||
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
if (recurse && item is Container)
|
if (recurse && item is Container)
|
||||||
|
{
|
||||||
RecurseFindItemsByType(item, types, true, list);
|
RecurseFindItemsByType(item, types, true, list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1437,7 +1637,9 @@ namespace Server.Items
|
||||||
private static Item RecurseFindItemByType(Item current, Type type, bool recurse)
|
private static Item RecurseFindItemByType(Item current, Type type, bool recurse)
|
||||||
{
|
{
|
||||||
if (current == null || current.Items.Count == 0)
|
if (current == null || current.Items.Count == 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var list = current.Items;
|
var list = current.Items;
|
||||||
|
|
||||||
|
|
@ -1446,14 +1648,18 @@ namespace Server.Items
|
||||||
var item = list[i];
|
var item = list[i];
|
||||||
|
|
||||||
if (type.IsInstanceOfType(item))
|
if (type.IsInstanceOfType(item))
|
||||||
|
{
|
||||||
return item;
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
if (recurse && item is Container)
|
if (recurse && item is Container)
|
||||||
{
|
{
|
||||||
var check = RecurseFindItemByType(item, type, true);
|
var check = RecurseFindItemByType(item, type, true);
|
||||||
|
|
||||||
if (check != null)
|
if (check != null)
|
||||||
|
{
|
||||||
return check;
|
return check;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1465,7 +1671,9 @@ namespace Server.Items
|
||||||
private static Item RecurseFindItemByType(Item current, Type[] types, bool recurse)
|
private static Item RecurseFindItemByType(Item current, Type[] types, bool recurse)
|
||||||
{
|
{
|
||||||
if (current == null || current.Items.Count == 0)
|
if (current == null || current.Items.Count == 0)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var list = current.Items;
|
var list = current.Items;
|
||||||
|
|
||||||
|
|
@ -1473,14 +1681,19 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
var item = list[i];
|
var item = list[i];
|
||||||
|
|
||||||
if (InTypeList(item, types)) return item;
|
if (InTypeList(item, types))
|
||||||
|
{
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
if (recurse && item is Container)
|
if (recurse && item is Container)
|
||||||
{
|
{
|
||||||
var check = RecurseFindItemByType(item, types, true);
|
var check = RecurseFindItemByType(item, types, true);
|
||||||
|
|
||||||
if (check != null)
|
if (check != null)
|
||||||
|
{
|
||||||
return check;
|
return check;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1517,10 +1730,16 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
var container = queue.Dequeue();
|
var container = queue.Dequeue();
|
||||||
foreach (var item in container.Items)
|
foreach (var item in container.Items)
|
||||||
|
{
|
||||||
if (item is T typedItem && predicate?.Invoke(typedItem) != false)
|
if (item is T typedItem && predicate?.Invoke(typedItem) != false)
|
||||||
|
{
|
||||||
items.Add(typedItem);
|
items.Add(typedItem);
|
||||||
|
}
|
||||||
else if (recurse && item is Container itemContainer)
|
else if (recurse && item is Container itemContainer)
|
||||||
|
{
|
||||||
queue.Enqueue(itemContainer);
|
queue.Enqueue(itemContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|
@ -1556,9 +1775,14 @@ namespace Server.Items
|
||||||
foreach (var item in container.Items)
|
foreach (var item in container.Items)
|
||||||
{
|
{
|
||||||
if (item is T typedItem && predicate?.Invoke(typedItem) != false)
|
if (item is T typedItem && predicate?.Invoke(typedItem) != false)
|
||||||
|
{
|
||||||
return typedItem;
|
return typedItem;
|
||||||
|
}
|
||||||
|
|
||||||
if (recurse && item is Container itemContainer)
|
if (recurse && item is Container itemContainer)
|
||||||
|
{
|
||||||
queue.Enqueue(itemContainer);
|
queue.Enqueue(itemContainer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1623,7 +1847,9 @@ namespace Server.Items
|
||||||
line = line.Trim();
|
line = line.Trim();
|
||||||
|
|
||||||
if (line.Length == 0 || line.StartsWith("#"))
|
if (line.Length == 0 || line.StartsWith("#"))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -1635,7 +1861,9 @@ namespace Server.Items
|
||||||
|
|
||||||
var aRect = split[1].Split(' ');
|
var aRect = split[1].Split(' ');
|
||||||
if (aRect.Length < 4)
|
if (aRect.Length < 4)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var x = Utility.ToInt32(aRect[0]);
|
var x = Utility.ToInt32(aRect[0]);
|
||||||
var y = Utility.ToInt32(aRect[1]);
|
var y = Utility.ToInt32(aRect[1]);
|
||||||
|
|
@ -1659,9 +1887,13 @@ namespace Server.Items
|
||||||
var id = Utility.ToInt32(aIDs[i]);
|
var id = Utility.ToInt32(aIDs[i]);
|
||||||
|
|
||||||
if (m_Table.ContainsKey(id))
|
if (m_Table.ContainsKey(id))
|
||||||
|
{
|
||||||
Console.WriteLine(@"Warning: double ItemID entry in Data\containers.cfg");
|
Console.WriteLine(@"Warning: double ItemID entry in Data\containers.cfg");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_Table[id] = data;
|
m_Table[id] = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* Containers.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Accounting;
|
using Server.Accounting;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
|
|
@ -88,14 +68,18 @@ namespace Server.Items
|
||||||
Opened = reader.ReadBool();
|
Opened = reader.ReadBool();
|
||||||
|
|
||||||
if (Owner == null)
|
if (Owner == null)
|
||||||
|
{
|
||||||
Delete();
|
Delete();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ItemID == 0xE41)
|
if (ItemID == 0xE41)
|
||||||
|
{
|
||||||
ItemID = 0xE7C;
|
ItemID = 0xE7C;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|
@ -103,7 +87,9 @@ namespace Server.Items
|
||||||
Opened = false;
|
Opened = false;
|
||||||
|
|
||||||
if (SendDeleteOnClose)
|
if (SendDeleteOnClose)
|
||||||
|
{
|
||||||
Owner?.Send(RemovePacket);
|
Owner?.Send(RemovePacket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSingleClick(Mobile from)
|
public override void OnSingleClick(Mobile from)
|
||||||
|
|
@ -129,7 +115,9 @@ namespace Server.Items
|
||||||
public override int GetTotal(TotalType type)
|
public override int GetTotal(TotalType type)
|
||||||
{
|
{
|
||||||
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold)
|
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold)
|
||||||
|
{
|
||||||
return Owner.Account.TotalGold;
|
return Owner.Account.TotalGold;
|
||||||
|
}
|
||||||
|
|
||||||
return base.GetTotal(type);
|
return base.GetTotal(type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* ItemBounds.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Layer.cs *
|
* File: Layer.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: LightType.cs *
|
* File: LightType.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* SecureTradeContainer.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Accounting;
|
using Server.Accounting;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
|
|
@ -40,7 +20,10 @@ namespace Server.Items
|
||||||
|
|
||||||
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
|
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
|
||||||
{
|
{
|
||||||
if (item == Trade.From.VirtualCheck || item == Trade.To.VirtualCheck) return true;
|
if (item == Trade.From.VirtualCheck || item == Trade.To.VirtualCheck)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var to = Trade.From.Container != this ? Trade.From.Mobile : Trade.To.Mobile;
|
var to = Trade.From.Container != this ? Trade.From.Mobile : Trade.To.Mobile;
|
||||||
|
|
||||||
|
|
@ -59,37 +42,51 @@ namespace Server.Items
|
||||||
public override void OnItemAdded(Item item)
|
public override void OnItemAdded(Item item)
|
||||||
{
|
{
|
||||||
if (!(item is VirtualCheck))
|
if (!(item is VirtualCheck))
|
||||||
|
{
|
||||||
ClearChecks();
|
ClearChecks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnItemRemoved(Item item)
|
public override void OnItemRemoved(Item item)
|
||||||
{
|
{
|
||||||
if (!(item is VirtualCheck))
|
if (!(item is VirtualCheck))
|
||||||
|
{
|
||||||
ClearChecks();
|
ClearChecks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSubItemAdded(Item item)
|
public override void OnSubItemAdded(Item item)
|
||||||
{
|
{
|
||||||
if (!(item is VirtualCheck))
|
if (!(item is VirtualCheck))
|
||||||
|
{
|
||||||
ClearChecks();
|
ClearChecks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSubItemRemoved(Item item)
|
public override void OnSubItemRemoved(Item item)
|
||||||
{
|
{
|
||||||
if (!(item is VirtualCheck))
|
if (!(item is VirtualCheck))
|
||||||
|
{
|
||||||
ClearChecks();
|
ClearChecks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearChecks()
|
public void ClearChecks()
|
||||||
{
|
{
|
||||||
if (Trade == null)
|
if (Trade == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Trade.From?.IsDisposed == false)
|
if (Trade.From?.IsDisposed == false)
|
||||||
|
{
|
||||||
Trade.From.Accepted = false;
|
Trade.From.Accepted = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Trade.To?.IsDisposed == false)
|
if (Trade.To?.IsDisposed == false)
|
||||||
|
{
|
||||||
Trade.To.Accepted = false;
|
Trade.To.Accepted = false;
|
||||||
|
}
|
||||||
|
|
||||||
Trade.Update();
|
Trade.Update();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: VirtualCheck.cs *
|
* File: VirtualCheck.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -78,7 +78,10 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
var c = GetSecureTradeCont();
|
var c = GetSecureTradeCont();
|
||||||
|
|
||||||
if (check == null || c == null) return base.IsAccessibleTo(check);
|
if (check == null || c == null)
|
||||||
|
{
|
||||||
|
return base.IsAccessibleTo(check);
|
||||||
|
}
|
||||||
|
|
||||||
return c.RootParent == check && IsChildOf(c);
|
return c.RootParent == check && IsChildOf(c);
|
||||||
}
|
}
|
||||||
|
|
@ -125,11 +128,19 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
var c = GetSecureTradeCont();
|
var c = GetSecureTradeCont();
|
||||||
|
|
||||||
if (c?.Trade == null) return;
|
if (c?.Trade == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (user == c.Trade.From.Mobile)
|
if (user == c.Trade.From.Mobile)
|
||||||
|
{
|
||||||
c.Trade.UpdateFromCurrency();
|
c.Trade.UpdateFromCurrency();
|
||||||
else if (user == c.Trade.To.Mobile) c.Trade.UpdateToCurrency();
|
}
|
||||||
|
else if (user == c.Trade.To.Mobile)
|
||||||
|
{
|
||||||
|
c.Trade.UpdateToCurrency();
|
||||||
|
}
|
||||||
|
|
||||||
c.ClearChecks();
|
c.ClearChecks();
|
||||||
}
|
}
|
||||||
|
|
@ -194,7 +205,9 @@ namespace Server.Items
|
||||||
base.OnServerClose(owner);
|
base.OnServerClose(owner);
|
||||||
|
|
||||||
if (Check?.Deleted == false)
|
if (Check?.Deleted == false)
|
||||||
|
{
|
||||||
Check.UpdateTrade(User);
|
Check.UpdateTrade(User);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|
@ -202,17 +215,25 @@ namespace Server.Items
|
||||||
User.CloseGump<EditGump>();
|
User.CloseGump<EditGump>();
|
||||||
|
|
||||||
if (Check?.Deleted == false)
|
if (Check?.Deleted == false)
|
||||||
|
{
|
||||||
Check.UpdateTrade(User);
|
Check.UpdateTrade(User);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Check = null;
|
Check = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Send()
|
public void Send()
|
||||||
{
|
{
|
||||||
if (Check?.Deleted == false)
|
if (Check?.Deleted == false)
|
||||||
|
{
|
||||||
User.SendGump(this);
|
User.SendGump(this);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Close();
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Refresh(bool recompile)
|
public void Refresh(bool recompile)
|
||||||
|
|
@ -224,7 +245,9 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recompile)
|
if (recompile)
|
||||||
|
{
|
||||||
CompileLayout();
|
CompileLayout();
|
||||||
|
}
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
Send();
|
Send();
|
||||||
|
|
@ -233,7 +256,9 @@ namespace Server.Items
|
||||||
private void CompileLayout()
|
private void CompileLayout()
|
||||||
{
|
{
|
||||||
if (Check?.Deleted != false)
|
if (Check?.Deleted != false)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Entries.ForEach(e => e.Parent = null);
|
Entries.ForEach(e => e.Parent = null);
|
||||||
Entries.Clear();
|
Entries.Clear();
|
||||||
|
|
@ -353,7 +378,9 @@ namespace Server.Items
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated)
|
if (updated)
|
||||||
|
{
|
||||||
User.SendMessage("Your offer has been updated.");
|
User.SendMessage("Your offer has been updated.");
|
||||||
|
}
|
||||||
|
|
||||||
if (refresh && Check?.Deleted == false)
|
if (refresh && Check?.Deleted == false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
* VirtualHair.cs
|
|
||||||
* -------------------
|
|
||||||
* begin : May 1, 2002
|
|
||||||
* copyright : (C) The RunUO Software Team
|
|
||||||
* email : info@runuo.com
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* 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 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: IPEndPointConverter.cs *
|
* File: IPEndPointConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -25,7 +25,9 @@ namespace Server.Json
|
||||||
public override IPEndPoint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
public override IPEndPoint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
{
|
{
|
||||||
if (IPEndPoint.TryParse(reader.GetString(), out var ipep))
|
if (IPEndPoint.TryParse(reader.GetString(), out var ipep))
|
||||||
|
{
|
||||||
return ipep;
|
return ipep;
|
||||||
|
}
|
||||||
|
|
||||||
throw new JsonException("IPEndPoint must be in the correct format");
|
throw new JsonException("IPEndPoint must be in the correct format");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: IPEndPointConverterFactory.cs *
|
* File: IPEndPointConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: MapConverter.cs *
|
* File: MapConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: MapConverterFactory.cs *
|
* File: MapConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: NullableStructSerializer.cs *
|
* File: NullableStructSerializer.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -25,9 +25,13 @@ namespace System.Text.Json.Serialization
|
||||||
public override void Write(Utf8JsonWriter writer, TStruct? value, JsonSerializerOptions options)
|
public override void Write(Utf8JsonWriter writer, TStruct? value, JsonSerializerOptions options)
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
{
|
||||||
writer.WriteNullValue();
|
writer.WriteNullValue();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
JsonSerializer.Serialize(writer, value.Value, options);
|
JsonSerializer.Serialize(writer, value.Value, options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: NullableStructSerializerFactory.cs *
|
* File: NullableStructSerializerFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -20,7 +20,9 @@ namespace System.Text.Json.Serialization
|
||||||
public override bool CanConvert(Type typeToConvert)
|
public override bool CanConvert(Type typeToConvert)
|
||||||
{
|
{
|
||||||
if (!typeToConvert.IsGenericType || typeToConvert.GetGenericTypeDefinition() != typeof(Nullable<>))
|
if (!typeToConvert.IsGenericType || typeToConvert.GetGenericTypeDefinition() != typeof(Nullable<>))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var structType = typeToConvert.GenericTypeArguments[0];
|
var structType = typeToConvert.GenericTypeArguments[0];
|
||||||
return !structType.IsPrimitive && structType.Namespace?.StartsWith(nameof(System)) != true && !structType.IsEnum;
|
return !structType.IsPrimitive && structType.Namespace?.StartsWith(nameof(System)) != true && !structType.IsEnum;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Point2DConverter.cs *
|
* File: Point2DConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -30,19 +30,25 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndArray)
|
if (reader.TokenType == JsonTokenType.EndArray)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType == JsonTokenType.Number)
|
if (reader.TokenType == JsonTokenType.Number)
|
||||||
{
|
{
|
||||||
if (count < 2)
|
if (count < 2)
|
||||||
|
{
|
||||||
data[count] = reader.GetInt32();
|
data[count] = reader.GetInt32();
|
||||||
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 2)
|
if (count > 2)
|
||||||
|
{
|
||||||
throw new JsonException("Point2D must be an array of x, y");
|
throw new JsonException("Point2D must be an array of x, y");
|
||||||
|
}
|
||||||
|
|
||||||
return new Point2D(data[0], data[1]);
|
return new Point2D(data[0], data[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -55,10 +61,14 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndObject)
|
if (reader.TokenType == JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||||
|
{
|
||||||
throw new JsonException("Invalid json structure for Point2D object");
|
throw new JsonException("Invalid json structure for Point2D object");
|
||||||
|
}
|
||||||
|
|
||||||
var key = reader.GetString();
|
var key = reader.GetString();
|
||||||
|
|
||||||
|
|
@ -72,7 +82,9 @@ namespace Server.Json
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.Number)
|
if (reader.TokenType != JsonTokenType.Number)
|
||||||
|
{
|
||||||
throw new JsonException($"Value for {key} must be a number");
|
throw new JsonException($"Value for {key} must be a number");
|
||||||
|
}
|
||||||
|
|
||||||
data[i] = reader.GetInt32();
|
data[i] = reader.GetInt32();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Point2DConverterFactory.cs *
|
* File: Point2DConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Point3DConverter.cs *
|
* File: Point3DConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -30,19 +30,25 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndArray)
|
if (reader.TokenType == JsonTokenType.EndArray)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType == JsonTokenType.Number)
|
if (reader.TokenType == JsonTokenType.Number)
|
||||||
{
|
{
|
||||||
if (count < 3)
|
if (count < 3)
|
||||||
|
{
|
||||||
data[count] = reader.GetInt32();
|
data[count] = reader.GetInt32();
|
||||||
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 3)
|
if (count > 3)
|
||||||
|
{
|
||||||
throw new JsonException("Point3D must be an array of x, y, z");
|
throw new JsonException("Point3D must be an array of x, y, z");
|
||||||
|
}
|
||||||
|
|
||||||
return new Point3D(data[0], data[1], data[2]);
|
return new Point3D(data[0], data[1], data[2]);
|
||||||
}
|
}
|
||||||
|
|
@ -55,10 +61,14 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndObject)
|
if (reader.TokenType == JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||||
|
{
|
||||||
throw new JsonException("Invalid json structure for Point3D object");
|
throw new JsonException("Invalid json structure for Point3D object");
|
||||||
|
}
|
||||||
|
|
||||||
var key = reader.GetString();
|
var key = reader.GetString();
|
||||||
|
|
||||||
|
|
@ -73,7 +83,9 @@ namespace Server.Json
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.Number)
|
if (reader.TokenType != JsonTokenType.Number)
|
||||||
|
{
|
||||||
throw new JsonException($"Value for {key} must be a number");
|
throw new JsonException($"Value for {key} must be a number");
|
||||||
|
}
|
||||||
|
|
||||||
data[i] = reader.GetInt32();
|
data[i] = reader.GetInt32();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Point3DConverterFactory.cs *
|
* File: Point3DConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Rectangle3DConverter.cs *
|
* File: Rectangle3DConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -30,19 +30,25 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndArray)
|
if (reader.TokenType == JsonTokenType.EndArray)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType == JsonTokenType.Number)
|
if (reader.TokenType == JsonTokenType.Number)
|
||||||
{
|
{
|
||||||
if (count < 6)
|
if (count < 6)
|
||||||
|
{
|
||||||
data[count] = reader.GetInt32();
|
data[count] = reader.GetInt32();
|
||||||
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 6)
|
if (count > 6)
|
||||||
|
{
|
||||||
throw new JsonException("Rectangle3D must be an array of x, y, z, h, w, d");
|
throw new JsonException("Rectangle3D must be an array of x, y, z, h, w, d");
|
||||||
|
}
|
||||||
|
|
||||||
return new Rectangle3D(data[0], data[1], data[2], data[3], data[4], data[5]);
|
return new Rectangle3D(data[0], data[1], data[2], data[3], data[4], data[5]);
|
||||||
}
|
}
|
||||||
|
|
@ -59,10 +65,14 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndObject)
|
if (reader.TokenType == JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||||
|
{
|
||||||
throw new JsonException("Invalid json structure for Rectangle3D object");
|
throw new JsonException("Invalid json structure for Rectangle3D object");
|
||||||
|
}
|
||||||
|
|
||||||
var key = reader.GetString();
|
var key = reader.GetString();
|
||||||
|
|
||||||
|
|
@ -71,7 +81,9 @@ namespace Server.Json
|
||||||
if (key == "start" || key == "end")
|
if (key == "start" || key == "end")
|
||||||
{
|
{
|
||||||
if (objType > -1 && objType != 2)
|
if (objType > -1 && objType != 2)
|
||||||
|
{
|
||||||
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
||||||
|
}
|
||||||
|
|
||||||
objType = 2;
|
objType = 2;
|
||||||
|
|
||||||
|
|
@ -107,20 +119,31 @@ namespace Server.Json
|
||||||
if (i < 10)
|
if (i < 10)
|
||||||
{
|
{
|
||||||
if (objType > -1 && objType != 0)
|
if (objType > -1 && objType != 0)
|
||||||
|
{
|
||||||
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
||||||
|
}
|
||||||
|
|
||||||
objType = 0;
|
objType = 0;
|
||||||
data[i] = reader.GetInt32();
|
data[i] = reader.GetInt32();
|
||||||
if (i == 2) hasZ = true;
|
if (i == 2)
|
||||||
|
{
|
||||||
|
hasZ = true;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objType > -1 && objType != 1)
|
if (objType > -1 && objType != 1)
|
||||||
|
{
|
||||||
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
throw new JsonException("Rectangle3D must have a start/end, or x/y/z/w/h/d, but not both.");
|
||||||
|
}
|
||||||
|
|
||||||
objType = 1;
|
objType = 1;
|
||||||
data[i - 10] = reader.GetInt32();
|
data[i - 10] = reader.GetInt32();
|
||||||
if (i == 12 || i == 15) hasZ = true;
|
if (i == 12 || i == 15)
|
||||||
|
{
|
||||||
|
hasZ = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasZ)
|
if (!hasZ)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: Rectangle3DConverterFactory.cs *
|
* File: Rectangle3DConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: TimeSpanConverter.cs *
|
* File: TimeSpanConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: TimeSpanConverterFactory.cs *
|
* File: TimeSpanConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: TypeConverter.cs *
|
* File: TypeConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -24,7 +24,9 @@ namespace Server.Json
|
||||||
public override Type Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
public override Type Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
{
|
{
|
||||||
if (reader.TokenType != JsonTokenType.String)
|
if (reader.TokenType != JsonTokenType.String)
|
||||||
|
{
|
||||||
throw new JsonException("The JSON value could not be converted to System.Type");
|
throw new JsonException("The JSON value could not be converted to System.Type");
|
||||||
|
}
|
||||||
|
|
||||||
return AssemblyHandler.FindFirstTypeForName(reader.GetString());
|
return AssemblyHandler.FindFirstTypeForName(reader.GetString());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: TypeConverterFactory.cs *
|
* File: TypeConverterFactory.cs *
|
||||||
* *
|
* *
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ModernUO *
|
* ModernUO *
|
||||||
* Copyright (C) 2019-2020 - ModernUO Development Team *
|
* Copyright 2019-2020 - ModernUO Development Team *
|
||||||
* Email: hi@modernuo.com *
|
* Email: hi@modernuo.com *
|
||||||
* File: WorldLocationConverter.cs *
|
* File: WorldLocationConverter.cs *
|
||||||
* *
|
* *
|
||||||
|
|
@ -32,14 +32,20 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndArray)
|
if (reader.TokenType == JsonTokenType.EndArray)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType == JsonTokenType.Number)
|
if (reader.TokenType == JsonTokenType.Number)
|
||||||
{
|
{
|
||||||
if (count < 3)
|
if (count < 3)
|
||||||
|
{
|
||||||
data[count] = reader.GetInt32();
|
data[count] = reader.GetInt32();
|
||||||
|
}
|
||||||
else if (count == 3)
|
else if (count == 3)
|
||||||
|
{
|
||||||
map = Map.Maps[reader.GetInt32()];
|
map = Map.Maps[reader.GetInt32()];
|
||||||
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +58,9 @@ namespace Server.Json
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasMap || count < 3 || count > 4)
|
if (!hasMap || count < 3 || count > 4)
|
||||||
|
{
|
||||||
throw new JsonException("WorldLocation must be an array of x, y, z, and map");
|
throw new JsonException("WorldLocation must be an array of x, y, z, and map");
|
||||||
|
}
|
||||||
|
|
||||||
return new WorldLocation(data[0], data[1], data[2], map);
|
return new WorldLocation(data[0], data[1], data[2], map);
|
||||||
}
|
}
|
||||||
|
|
@ -70,10 +78,14 @@ namespace Server.Json
|
||||||
{
|
{
|
||||||
reader.Read();
|
reader.Read();
|
||||||
if (reader.TokenType == JsonTokenType.EndObject)
|
if (reader.TokenType == JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.PropertyName)
|
if (reader.TokenType != JsonTokenType.PropertyName)
|
||||||
|
{
|
||||||
throw new JsonException("Invalid Json structure for WorldLocation object");
|
throw new JsonException("Invalid Json structure for WorldLocation object");
|
||||||
|
}
|
||||||
|
|
||||||
var key = reader.GetString();
|
var key = reader.GetString();
|
||||||
|
|
||||||
|
|
@ -88,17 +100,23 @@ namespace Server.Json
|
||||||
};
|
};
|
||||||
|
|
||||||
if (i == 5)
|
if (i == 5)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
if (hasLoc)
|
if (hasLoc)
|
||||||
|
{
|
||||||
throw new JsonException("WorldLocation must have loc or x, y, z, but not both");
|
throw new JsonException("WorldLocation must have loc or x, y, z, but not both");
|
||||||
|
}
|
||||||
|
|
||||||
if (reader.TokenType != JsonTokenType.Number)
|
if (reader.TokenType != JsonTokenType.Number)
|
||||||
|
{
|
||||||
throw new JsonException($"Value for {key} must be a number");
|
throw new JsonException($"Value for {key} must be a number");
|
||||||
|
}
|
||||||
|
|
||||||
hasXYZ = true;
|
hasXYZ = true;
|
||||||
data[i] = reader.GetInt32();
|
data[i] = reader.GetInt32();
|
||||||
|
|
@ -108,7 +126,9 @@ namespace Server.Json
|
||||||
if (i == 3)
|
if (i == 3)
|
||||||
{
|
{
|
||||||
if (hasXYZ)
|
if (hasXYZ)
|
||||||
|
{
|
||||||
throw new JsonException("WorldLocation must have loc or x, y, z, but not both");
|
throw new JsonException("WorldLocation must have loc or x, y, z, but not both");
|
||||||
|
}
|
||||||
|
|
||||||
hasLoc = true;
|
hasLoc = true;
|
||||||
var loc = new Point3DConverter().Read(ref reader, typeof(Point3D), options);
|
var loc = new Point3DConverter().Read(ref reader, typeof(Point3D), options);
|
||||||
|
|
@ -128,7 +148,9 @@ namespace Server.Json
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasMap || count < 2)
|
if (!hasMap || count < 2)
|
||||||
|
{
|
||||||
throw new JsonException("WorldLocation must have an x, y, z, and map properties");
|
throw new JsonException("WorldLocation must have an x, y, z, and map properties");
|
||||||
|
}
|
||||||
|
|
||||||
return new WorldLocation(data[0], data[1], data[2], map);
|
return new WorldLocation(data[0], data[1], data[2], map);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue