Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bfa1e09b7a | |||
| 2dee327763 | |||
| 44b2c31339 | |||
| ef41957f11 | |||
| 253dd69de1 | |||
| 3b424bd377 | |||
| 5a57ef47a4 | |||
| f431b7b70b | |||
| a7bb6fbdbe | |||
| 2f01828bba | |||
| 4c34b8ab7b | |||
| dd52e49c99 | |||
| a30406c046 | |||
| e7cb7677a0 | |||
| afb4993dee | |||
| 85c7ca9d98 | |||
| cd64ea0b31 | |||
| f3aa797317 | |||
| b2ed9782fc | |||
| fb1c5f7701 | |||
| 4237125bcf | |||
| 5c72b69f56 | |||
| dadf7801a3 | |||
| 7fd9c04fff | |||
| aabe8a2000 | |||
| db589f13d9 | |||
| 77dde7033a | |||
| 3298105447 | |||
| ab69e4898f | |||
| 315be89daa | |||
| 239b6e2009 | |||
| 5e8894dbcf | |||
| b04d390b79 | |||
| 6ed19a8b5b | |||
| cc826a64a7 | |||
| 7cfbab2b09 | |||
| 804eecd53a | |||
| 6a8e01bb58 | |||
| dbaa7b5c18 | |||
| 3c289bb339 | |||
| bca15c8132 | |||
| 6e7fc48d74 | |||
| 24d288ec7d | |||
| f55936985c | |||
| a9617175ce | |||
| 9c80a68c9b | |||
| a3013e76de | |||
| b320ab8775 | |||
| 7daa67ff42 | |||
| 16548700e4 | |||
| 7c278b2fcf | |||
| aa9d9f15fc | |||
| 2fb4c8d3fb | |||
| 0177c3a68d | |||
| 6c618a43d9 | |||
| 88176bccc6 | |||
| 0816d987f8 | |||
| 75c77c6b71 | |||
| 0eb67f698c | |||
| b5aefdc354 | |||
| 87d32727bb | |||
| 468b09ef08 | |||
| a2532378f2 | |||
| 62b7b9804d | |||
| 0f557172ed | |||
| f4eed23a15 | |||
| ac93d959f6 | |||
| 1f465957e6 | |||
| 7e284aba50 | |||
| d234227c4e | |||
| b648dbb476 | |||
| 806d7531c8 | |||
| 9c37530c24 | |||
| 6af37f14b9 | |||
| 865179d7f4 | |||
| 27ed6a81f9 | |||
| c067770961 | |||
| 560e5823c6 | |||
| 14de09eef6 | |||
| b0cdc6888d | |||
| 48da2566b0 | |||
| e01cdd967e | |||
| 4bc60a3a6a | |||
| e7c01d096b |
+33
-12
@@ -5,6 +5,7 @@ on:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'feature/client-tweaks'
|
||||
- 'test/discord-presence'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
@@ -41,6 +42,11 @@ jobs:
|
||||
pyinstaller --version
|
||||
python -m pip show pyinstaller pyinstaller-hooks-contrib
|
||||
|
||||
- name: Configure x86 MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x86
|
||||
|
||||
- name: Syntax check
|
||||
run: python -m py_compile setup_tool.py setup_tool_dynamic.py remote_packages.py tests/test_safety.py
|
||||
|
||||
@@ -65,35 +71,50 @@ jobs:
|
||||
if (-not (Test-Path "dist/WoW_Modernization_Tool.exe")) { throw "Build output missing" }
|
||||
Get-Item "dist/WoW_Modernization_Tool.exe" | Format-List Name,Length,LastWriteTime
|
||||
|
||||
- name: Create ZIP package
|
||||
shell: pwsh
|
||||
run: |
|
||||
$zip = "dist/WoW_Modernization_Tool.zip"
|
||||
if (Test-Path $zip) { Remove-Item $zip -Force }
|
||||
Compress-Archive -Path "dist/WoW_Modernization_Tool.exe" -DestinationPath $zip -CompressionLevel Optimal
|
||||
if (-not (Test-Path $zip)) { throw "ZIP package missing" }
|
||||
Get-Item $zip | Format-List Name,Length,LastWriteTime
|
||||
|
||||
- name: Upload test artifact
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') && !(github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.2') }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WoW_Modernization_Tool-test
|
||||
path: dist/WoW_Modernization_Tool.exe
|
||||
path: |
|
||||
dist/WoW_Modernization_Tool.exe
|
||||
dist/WoW_Modernization_Tool.zip
|
||||
if-no-files-found: error
|
||||
|
||||
# One-time production promotion for v2.0. The exact commit message keeps
|
||||
# normal main pushes from publishing or modifying the v2.0 release.
|
||||
- name: Create GitHub Release v2.0
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.0' }}
|
||||
# One-time production promotion for v2.2. The exact commit message keeps
|
||||
# normal main pushes from publishing or modifying the v2.2 release.
|
||||
- name: Create GitHub Release v2.2
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.head_commit.message == 'release v2.2' }}
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
tag_name: v2.0
|
||||
tag_name: v2.2
|
||||
target_commitish: ${{ github.sha }}
|
||||
files: dist/WoW_Modernization_Tool.exe
|
||||
files: |
|
||||
dist/WoW_Modernization_Tool.exe
|
||||
dist/WoW_Modernization_Tool.zip
|
||||
fail_on_unmatched_files: true
|
||||
name: "WoW Modernization Tool v2.0"
|
||||
overwrite_files: true
|
||||
name: "WoW Modernization Tool v2.2"
|
||||
body_path: RELEASE_NOTES.md
|
||||
generate_release_notes: true
|
||||
previous_tag: v1.1
|
||||
generate_release_notes: false
|
||||
make_latest: true
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
files: dist/WoW_Modernization_Tool.exe
|
||||
files: |
|
||||
dist/WoW_Modernization_Tool.exe
|
||||
dist/WoW_Modernization_Tool.zip
|
||||
fail_on_unmatched_files: true
|
||||
name: "WoW Modernization Tool ${{ github.ref_name }}"
|
||||
body_path: RELEASE_NOTES.md
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Modernization Tool asset provenance
|
||||
|
||||
Audit date: 2026-08-31
|
||||
|
||||
This document tracks project branding and game-facing non-binary assets that
|
||||
need provenance separate from software DLL/EXE licensing.
|
||||
|
||||
## Project icon
|
||||
|
||||
### `PurpleWowLogo.ico`
|
||||
|
||||
- Git blob SHA-1:
|
||||
`7285e997cb6d635101d0d000867af75878894719`
|
||||
- Current use: PyInstaller application icon and bundled application resource
|
||||
- Provenance status: **unresolved-project-branding-asset**
|
||||
|
||||
The file name suggests World of Warcraft-themed branding, but this audit did
|
||||
not establish its original creator or source license. No claim is made that
|
||||
Modernization Tool owns any Blizzard logo, trademark, or underlying game art
|
||||
that may be represented by the icon.
|
||||
|
||||
Until provenance is confirmed, the project should avoid representing the icon
|
||||
as an official Blizzard asset or as evidence of Blizzard affiliation.
|
||||
|
||||
## AutoLogin GlueXML files
|
||||
|
||||
Source reference:
|
||||
|
||||
- https://github.com/MarcelineVQ/turtle-autologin
|
||||
|
||||
Current comparison:
|
||||
|
||||
| File | Status | Current Git blob SHA-1 |
|
||||
| --- | --- | --- |
|
||||
| `Payload/Data/Interface/GlueXML/AutoLogin.xml` | exact upstream Git blob match | `65c7d0c08ba62ad9b1630aae6faa0046f96295d1` |
|
||||
| `Payload/Data/Interface/GlueXML/GlueXML.toc` | exact upstream Git blob match | `11ab97c6dc64385c2c8d717d0182fbee538484ff` |
|
||||
| `Payload/Data/Interface/GlueXML/AutoLogin.lua` | modified upstream-derived variant | `1de856864a16399977e6220714bd1249da0dcefe` |
|
||||
|
||||
The upstream `AutoLogin.lua` Git blob observed during the audit was
|
||||
`979af097982379ca14e4266dfea41f65452a9561`. The Modernization Tool variant
|
||||
contains additional secure-default behavior and therefore is not byte-identical.
|
||||
|
||||
The source repository did not expose a project-wide license file during this
|
||||
audit, so this provenance record does not itself establish redistribution
|
||||
permission.
|
||||
|
||||
## Audio and visual mods
|
||||
|
||||
The tool may bundle or download visual/audio replacements from community
|
||||
projects. Their source URLs and many exact file hashes are recorded in
|
||||
`Payload/Fallback/versions.json`.
|
||||
|
||||
Game-facing media can have rights separate from the software that installs it.
|
||||
Do not infer that an MIT/GPL/BSD license covering installer code automatically
|
||||
covers Blizzard artwork, sounds, or other game assets.
|
||||
|
||||
## Trademark boundary
|
||||
|
||||
World of Warcraft, Warcraft, Blizzard Entertainment, and associated logos,
|
||||
names, artwork, audio, client files, and game assets remain the property of
|
||||
their respective rights holders.
|
||||
|
||||
Modernization Tool is an independent community project and does not claim
|
||||
official status or endorsement.
|
||||
@@ -0,0 +1,76 @@
|
||||
# Modernization Tool binary provenance
|
||||
|
||||
Audit date: 2026-08-31
|
||||
|
||||
This document is the human-readable companion to
|
||||
`Payload/Fallback/versions.json`, which contains machine-readable source,
|
||||
version, SHA-256, and size records for many bundled components.
|
||||
|
||||
No remaining payload binary was modified during this provenance pass.
|
||||
|
||||
## Distribution status
|
||||
|
||||
| Component | Distribution mode after this audit | Source / provenance | License status |
|
||||
| --- | --- | --- | --- |
|
||||
| VanillaFixes | bundled + install support | hannesmann/vanillafixes v1.5.3 | MIT verified |
|
||||
| DXVK | bundled | doitsujin/dxvk v2.6.1 x86 | zlib/libpng verified |
|
||||
| vanilla-tweaks | bundled fallback + online update | tubtubs/vanilla-tweaks | MIT verified |
|
||||
| Nampower | bundled fallback + online update | brues-code/nampower v4.6.1 | BSD-style terms verified |
|
||||
| VanillaHelpers | bundled fallback + online update | isfir/VanillaHelpers v1.1.2 | GPL/LGPL documents verified |
|
||||
| VanillaMultiMonitorFix | bundled fallback + online update | Mates1500/VanillaMultiMonitorFix 0.2 | MIT verified |
|
||||
| ClassicAPI | bundled fallback + online update | brues-code/ClassicAPI | GPL v3 verified |
|
||||
| AuctionQueryThrottle | bundled fallback + online update | brues-code/AuctionQueryThrottle | GPL v3 verified |
|
||||
| SuperWoW | **upstream-only** | balakethelock/SuperWoW release | redistribution restricted upstream |
|
||||
| SuperAPI | **upstream-only** | balakethelock/SuperAPI master | no bundled copy after this audit |
|
||||
| UnitXP_SP3 | bundled fallback + online update | brues-code/UnitXP_SP3 v90 | project-wide license not independently located |
|
||||
| Interact | bundled fallback + online update | lookino/Interact v1.0.4 | project-wide license not independently located |
|
||||
| No1600x1200 | bundled fallback + online update | RetroCro/TurtleWoW-Mods | project-wide license not independently located |
|
||||
| PerfBoost | bundled | RetroCro/TurtleWoW-Mods backup source | project-wide license not independently located |
|
||||
| WeirdPerformance | bundled | Dusk92/WeirdUtils 0.7.3 | provenance recorded; license record pending |
|
||||
| WeirdUtils modules | bundled | MarcelineVQ/WeirdUtils releases | provenance recorded; license record pending |
|
||||
| FishPing | bundled fallback + online source | notsureawake/FishPing | project-wide license not independently located |
|
||||
| NoErrorSounds | bundled fallback + online source | Macumbafeh/NoErrorSounds | project-wide license not independently located |
|
||||
| Warlock Muted Demons | bundled fallback + online source | spzilyk/Warlock-Muted-Demons | project-wide license not independently located |
|
||||
|
||||
## SuperWoW change
|
||||
|
||||
Before this audit the repository contained:
|
||||
|
||||
- `Payload/SuperWoWhook.dll`
|
||||
- SHA-256 recorded in `versions.json`:
|
||||
`bd214b32c878649e94ce654835946bd05e0ce7710e8f01bae10d8ab50a89351d`
|
||||
- source:
|
||||
`balakethelock/SuperWoW` release package
|
||||
|
||||
That bundled fallback is removed by this audit because the current upstream
|
||||
license restricts redistribution without express written permission.
|
||||
|
||||
The installation feature itself is retained: `remote_packages.install_superwow`
|
||||
already downloads the official upstream release and downloads SuperAPI directly
|
||||
from its upstream repository.
|
||||
|
||||
## SuperAPI change
|
||||
|
||||
The previous bundled fallback under
|
||||
`Payload/Interface/Addons/SuperAPI/` is removed together with the SuperWoW
|
||||
fallback. The installer continues to obtain SuperAPI directly from
|
||||
`balakethelock/SuperAPI` when SuperWoW is installed.
|
||||
|
||||
## Hash manifest
|
||||
|
||||
For components that remain bundled, the canonical machine-readable hashes are
|
||||
kept in `Payload/Fallback/versions.json`.
|
||||
|
||||
When updating a binary:
|
||||
|
||||
1. obtain it from the documented upstream source;
|
||||
2. verify the version;
|
||||
3. update the SHA-256 and size;
|
||||
4. preserve the applicable license/permission;
|
||||
5. update this document if the distribution mode changes.
|
||||
|
||||
## Important boundary
|
||||
|
||||
A matching hash proves file identity against the recorded source artifact. It
|
||||
does not by itself prove that redistribution is licensed. License/permission
|
||||
status must be tracked separately.
|
||||
@@ -0,0 +1,23 @@
|
||||
Modernization Tool - Project License Notice
|
||||
|
||||
Copyright (c) 2026 Dusk-92. All rights reserved.
|
||||
|
||||
This notice applies only to original Modernization Tool source code,
|
||||
documentation, configuration, and other material for which Dusk-92 holds the
|
||||
copyright.
|
||||
|
||||
No rights are granted by this notice to third-party software, binaries,
|
||||
libraries, addons, patches, audio, artwork, trademarks, game data, or other
|
||||
material that may be referenced, downloaded, installed, or redistributed by
|
||||
this project. Those materials remain subject to their own copyright notices,
|
||||
licenses, permissions, and other applicable terms.
|
||||
|
||||
Nothing in this file grants any right to Blizzard Entertainment intellectual
|
||||
property, including World of Warcraft names, marks, artwork, audio, client
|
||||
files, or other game assets.
|
||||
|
||||
Third-party attribution, redistribution status, and preserved license texts are
|
||||
documented in THIRD_PARTY_NOTICES.md, PROJECT_IDENTITY.md, Docs/, and LICENSES/.
|
||||
|
||||
This project is provided as-is, without warranty of any kind, to the maximum
|
||||
extent permitted by applicable law.
|
||||
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2017 Philip Rebohle
|
||||
Copyright (c) 2019 Joshua Ashton
|
||||
Copyright (c) 2019 Robin Kertels
|
||||
Copyright (c) 2023 Jeffrey Ellison
|
||||
|
||||
zlib/libpng license
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
– The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
– Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
|
||||
– This notice may not be removed or altered from any source distribution.
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,26 @@
|
||||
Copyright (c) 2017-2023, namreeb (legal@namreeb.org)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Preserved third-party license texts
|
||||
|
||||
This directory stores documentary copies of licenses for third-party
|
||||
components referenced, downloaded, or redistributed by Modernization Tool.
|
||||
|
||||
The presence of a license here does **not** apply that license to Modernization
|
||||
Tool as a whole. Each license applies only to the upstream material covered by
|
||||
its copyright holder.
|
||||
|
||||
Preserved files:
|
||||
|
||||
- `VanillaFixes-MIT.txt`
|
||||
- `DXVK-zlib.txt`
|
||||
- `vanilla-tweaks-MIT.txt`
|
||||
- `Nampower-BSD.txt`
|
||||
- `VanillaHelpers-GPL-3.0.txt`
|
||||
- `VanillaHelpers-LGPL-3.0.txt`
|
||||
- `VanillaMultiMonitorFix-MIT.txt`
|
||||
- `GPL-3.0.txt` — reference copy for GPL-v3 components such as ClassicAPI and
|
||||
AuctionQueryThrottle
|
||||
- `SuperWoW-LICENSE.txt` — preserved for the upstream-only SuperWoW component
|
||||
|
||||
See `../THIRD_PARTY_NOTICES.md` and `../Docs/BINARY_PROVENANCE.md` for the
|
||||
scope, distribution mode, and source of each component.
|
||||
@@ -0,0 +1,16 @@
|
||||
Copyright © 2024 Balake. All rights reserved.
|
||||
|
||||
This program is licensed for personal use only. Commercial
|
||||
use, distribution, modification, or any form of exploitation
|
||||
for profit is strictly prohibited without the express written
|
||||
permission of the copyright holder.
|
||||
|
||||
World of Warcarft is the intellectual property of Blizzard
|
||||
Entertainment, Inc. This mod is not affiliated with or
|
||||
endorsed by Blizzard Entertainment in any way.
|
||||
|
||||
This mod is created and distributed under the principles of
|
||||
fair use, including commentary, criticism, and transformative
|
||||
use for personal enjoyment and educational purposes.
|
||||
|
||||
This mod is provided "as is," without warranty of any kind.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Hannes Mann
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Martin Pecánek
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 brndd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,50 @@
|
||||
# Modernization Tool project identity
|
||||
|
||||
## Canonical project
|
||||
|
||||
The canonical repository designated by the project maintainer is:
|
||||
|
||||
- https://github.com/Dusk-92/Modernization-Tool
|
||||
|
||||
Mirrors, package caches, downstream forks, repackaged executables, and modified
|
||||
copies hosted elsewhere are independent unless the canonical project explicitly
|
||||
states otherwise.
|
||||
|
||||
## Independent community project
|
||||
|
||||
Modernization Tool is an independent community project. It is not affiliated
|
||||
with, sponsored by, approved by, or endorsed by Blizzard Entertainment.
|
||||
|
||||
Compatibility with World of Warcraft, Vanilla WoW 1.12-compatible clients,
|
||||
Turtle WoW-like environments, or any third-party plugin, addon, patcher, or
|
||||
community project does not imply affiliation, endorsement, partnership, or
|
||||
ownership.
|
||||
|
||||
World of Warcraft, Warcraft, Blizzard Entertainment, and associated names,
|
||||
marks, artwork, audio, client files, and game assets remain the property of
|
||||
their respective rights holders.
|
||||
|
||||
## Third-party projects
|
||||
|
||||
Modernization Tool can download, install, configure, or in some cases bundle
|
||||
third-party components. Those projects remain independent from Modernization
|
||||
Tool and retain their own copyright, licensing, support, and distribution
|
||||
terms.
|
||||
|
||||
A source link, compatibility label, credit, installer entry, or bundled fallback
|
||||
does not imply that the upstream author endorses Modernization Tool.
|
||||
|
||||
See `THIRD_PARTY_NOTICES.md`, `Docs/BINARY_PROVENANCE.md`, and
|
||||
`LICENSES/` for the current provenance and redistribution record.
|
||||
|
||||
## Support boundary
|
||||
|
||||
Dusk-92 is responsible only for Modernization Tool releases published by the
|
||||
canonical repository. Upstream component authors are not responsible for this
|
||||
tool, its packaging decisions, or downstream modifications.
|
||||
|
||||
## Historical provenance
|
||||
|
||||
Do not erase historical attribution, source URLs, hashes, license notices, or
|
||||
provenance records when a component is updated or replaced. Update the records
|
||||
instead so the repository keeps a traceable history.
|
||||
@@ -140,17 +140,6 @@
|
||||
"source": "https://raw.githubusercontent.com/RetroCro/TurtleWoW-Mods/refs/heads/main/Archive/DLL%20BACKUP/perf_boost.dll",
|
||||
"version": "RetroCro main"
|
||||
},
|
||||
"SuperWoW": {
|
||||
"files": [
|
||||
{
|
||||
"path": "Payload/SuperWoWhook.dll",
|
||||
"sha256": "bd214b32c878649e94ce654835946bd05e0ce7710e8f01bae10d8ab50a89351d",
|
||||
"size": 1000448
|
||||
}
|
||||
],
|
||||
"source": "https://github.com/balakethelock/SuperWoW/releases/download/Release/SuperWoW.release.2.2.zip",
|
||||
"version": "Release"
|
||||
},
|
||||
"UnitXP_SP3": {
|
||||
"files": [
|
||||
{
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
### Addon to allow compability between the mod and vanilla default interface. Also adds a minimap icon to change some mod settings. It is recommended for addon makers to read this to get a gist of some of the mod's features
|
||||
|
||||
### Settings
|
||||
Right click the minimap icon to choose persistent options for:
|
||||
- Autoloot
|
||||
- Clickthrough
|
||||
- GUID in combat log/events
|
||||
- FoV
|
||||
- Background Sound
|
||||
- Uncapped Sounds
|
||||
- Targetting circle style
|
||||
|
||||
**NOTE: If using Vanilla Tweaks quickloot all of the Autoloot options will be reversed (always on will actually be always off, Shift to toggle on will be Shift to toggle off etc).**
|
||||
|
||||
### Other features
|
||||
- Adds "mouseover" support to all default blizzard unitframes
|
||||
- Shows item charges in bag
|
||||
- Allows Shift clicking a spell in your spellbook to link it to chat
|
||||
- Adds chat command to toggle showing unit names or GUIDs in combat log
|
||||
|
||||
## Modules:
|
||||
https://github.com/balakethelock/SuperAPI_Castlib provides improved castbars, alternatively the latest version of pfui/shaguplates now do the same
|
||||
@@ -1,192 +0,0 @@
|
||||
-- No superwow, no superapi
|
||||
local version = tonumber(SUPERWOW_VERSION)
|
||||
|
||||
if not version or version < 2.2 then
|
||||
StaticPopupDialogs["UPDATE_SUPERWOW"] = {
|
||||
text = "No SuperWoW detected. Please download latest version.",
|
||||
button1 = "Download",
|
||||
button2 = TEXT(IGNORE),
|
||||
OnAccept = function(data)
|
||||
local url = "https://github.com/balakethelock/SuperWoW/releases/tag/Release"
|
||||
|
||||
if not ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Show()
|
||||
end
|
||||
|
||||
ChatFrameEditBox:SetText(url)
|
||||
ChatFrameEditBox:SetFocus()
|
||||
ChatFrameEditBox:HighlightText()
|
||||
end,
|
||||
timeout = 0,
|
||||
exclusive = 1,
|
||||
whileDead = 1,
|
||||
hideOnEscape = 1
|
||||
};
|
||||
|
||||
DEFAULT_CHAT_FRAME:AddMessage("No SuperWoW detected. Please download latest version https://github.com/balakethelock/SuperWoW ");
|
||||
StaticPopup_Show("UPDATE_SUPERWOW");
|
||||
return
|
||||
end
|
||||
|
||||
SUPERAPI_ContainerItemsTable = {}
|
||||
|
||||
SuperAPI = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDebug-2.0", "AceModuleCore-2.0", "AceConsole-2.0", "AceDB-2.0", "AceHook-2.1")
|
||||
SuperAPI:RegisterDB("SuperAPIDB")
|
||||
SuperAPI.frame = CreateFrame("Frame", "SuperAPI", UIParent)
|
||||
|
||||
function SuperAPI:OnEnable()
|
||||
-- Let macro frame allow 511 characters
|
||||
MacroFrame_LoadUI();
|
||||
MacroFrameText:SetMaxLetters(511);
|
||||
MACROFRAME_CHAR_LIMIT = "%d/511 Characters Used";
|
||||
|
||||
-- Change chat bubbles options name
|
||||
OPTION_TOOLTIP_PARTY_CHAT_BUBBLES = "Shows whisper, party, raid, and battleground chat text in speech bubbles above characters' heads.";
|
||||
PARTY_CHAT_BUBBLES_TEXT = "Show Whisper and Group Chat Bubbles";
|
||||
|
||||
SuperAPI.SetItemRefOriginal = SetItemRef
|
||||
SuperAPI.SpellButton_OnClickOriginal = SpellButton_OnClick
|
||||
SuperAPI.SetItemButtonCountOriginal = SetItemButtonCount
|
||||
SuperAPI.SetActionOriginal = GameTooltip.SetAction
|
||||
SuperAPI.UnitFrame_OnEnterOriginal = UnitFrame_OnEnter
|
||||
SuperAPI.UnitFrame_OnLeaveOriginal = UnitFrame_OnLeave
|
||||
SuperAPI.CombatText_AddMessageOriginal = CombatText_AddMessage
|
||||
SuperAPI.QuestLogTitleButton_OnClickOriginal = QuestLogTitleButton_OnClick
|
||||
|
||||
-- activate hooks
|
||||
SetItemRef = SuperAPI.SetItemRef
|
||||
SpellButton_OnClick = SuperAPI.SpellButton_OnClick
|
||||
SetItemButtonCount = SuperAPI.SetItemButtonCount
|
||||
GameTooltip.SetAction = SuperAPI.SetAction
|
||||
UnitFrame_OnEnter = SuperAPI.UnitFrame_OnEnter
|
||||
UnitFrame_OnLeave = SuperAPI.UnitFrame_OnLeave
|
||||
CombatText_AddMessage = SuperAPI.CombatText_AddMessage
|
||||
QuestLogTitleButton_OnClick = SuperAPI.QuestLogTitleButton_OnClick
|
||||
|
||||
|
||||
-- SuperAPI.frame:RegisterEvent("BAG_UPDATE")
|
||||
-- SuperAPI.frame:RegisterEvent("BAG_UPDATE_COOLDOWN")
|
||||
SuperAPI.frame:SetScript("OnEvent", SuperAPI.OnEvent)
|
||||
|
||||
-- this chatcommand is empty. It is essential for showing tooltips of macros
|
||||
-- the format for showing a tooltip on a macro is EXACTLY this: /tooltip spell:spellid and then skip line
|
||||
SLASH_MACROTOOLTIP1 = "/tooltip"
|
||||
SlashCmdList["MACROTOOLTIP"] = function(cmd)
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffffcc00SuperAPI|cffffaaaa Loaded. Check the minimap icon for options.")
|
||||
end
|
||||
|
||||
function SuperAPI:OnEvent()
|
||||
if (event == "BAG_UPDATE_COOLDOWN" or event == "BAG_UPDATE") then
|
||||
SUPERAPI_ContainerItemsTable = {}
|
||||
for ibag = 0, 4 do
|
||||
for islot = 1, GetContainerNumSlots(ibag) do
|
||||
local bagitemlink = GetContainerItemLink(ibag, islot)
|
||||
if bagitemlink then
|
||||
local _, _, bagitemID = strfind(bagitemlink, "item:(%d+)")
|
||||
bagitemID = tonumber(bagitemID)
|
||||
SUPERAPI_ContainerItemsTable[bagitemID] = { bag = ibag; slot = islot }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- HOOKS --
|
||||
-- Global function to get a spell link from its exact id
|
||||
SuperAPI.GetSpellLink = function(id)
|
||||
local spellname = SpellInfo(id)
|
||||
local link = "\124cffffffff\124Henchant:" .. id .. "\124h[" .. spellname .. "]\124h\124r"
|
||||
return link
|
||||
end
|
||||
|
||||
-- reformat "Enchant" itemlinks to better supported "Spell" itemlinks
|
||||
SuperAPI.SetItemRef = function(link, text, button)
|
||||
link = gsub(link, "spell:", "enchant:")
|
||||
SuperAPI.SetItemRefOriginal(link, text, button)
|
||||
end
|
||||
|
||||
-- hooking spellbook frame to get a spell link on shift clicking a spell's button with chatframe open
|
||||
SuperAPI.SpellButton_OnClick = function(drag)
|
||||
if ((not drag) and IsShiftKeyDown() and ChatFrameEditBox:IsVisible() and (not MacroFrame or not MacroFrame:IsVisible())) then
|
||||
local bookId = SpellBook_GetSpellID(this:GetID());
|
||||
local _, _, spellID = GetSpellName(bookId, SpellBookFrame.bookType)
|
||||
local link = SuperAPI.GetSpellLink(spellID)
|
||||
ChatFrameEditBox:Insert(link)
|
||||
else
|
||||
SuperAPI.SpellButton_OnClickOriginal(drag)
|
||||
end
|
||||
end
|
||||
|
||||
-- hooking bags item button frames to show uses count
|
||||
SuperAPI.SetItemButtonCount = function(button, count)
|
||||
if not button or not count then
|
||||
return SuperAPI.SetItemButtonCountOriginal(button, count)
|
||||
end
|
||||
if (count < 0) then
|
||||
if (count < -999) then
|
||||
count = "*";
|
||||
end
|
||||
getglobal(button:GetName() .. "Count"):SetText(-count);
|
||||
getglobal(button:GetName() .. "Count"):Show();
|
||||
getglobal(button:GetName() .. "Count"):SetFontObject(NumberFontNormalYellow);
|
||||
else
|
||||
getglobal(button:GetName() .. "Count"):SetFontObject(NumberFontNormal);
|
||||
SuperAPI.SetItemButtonCountOriginal(button, count)
|
||||
end
|
||||
end
|
||||
|
||||
-- hooking actionbutton tooltip to show item tooltip on macros
|
||||
SuperAPI.SetAction = function(this, buttonID)
|
||||
--local name, actiontype, macroID = GetActionText(buttonID)
|
||||
--if actiontype == "MACRO" then
|
||||
-- local _,_, body = GetMacroInfo(macroID)
|
||||
-- local _,_, itemID = strfind(body, "^/tooltip item:(%d+)")
|
||||
-- if itemID then
|
||||
-- itemID = tonumber(itemID)
|
||||
-- iteminfo = SUPERAPI_ContainerItemsTable[itemID]
|
||||
-- if iteminfo then
|
||||
-- return this:SetBagItem(iteminfo.bag, iteminfo.slot)
|
||||
-- end
|
||||
-- end
|
||||
--end
|
||||
--
|
||||
return SuperAPI.SetActionOriginal(this, buttonID)
|
||||
end
|
||||
|
||||
-- Add Mouseover casting to default blizzard unitframes and all unitframe addons that use the same function
|
||||
SuperAPI.UnitFrame_OnEnter = function()
|
||||
SuperAPI.UnitFrame_OnEnterOriginal()
|
||||
SetMouseoverUnit(this.unit)
|
||||
end
|
||||
|
||||
SuperAPI.UnitFrame_OnLeave = function()
|
||||
SuperAPI.UnitFrame_OnLeaveOriginal()
|
||||
SetMouseoverUnit()
|
||||
end
|
||||
|
||||
-- Fix scrolling combat text healer name
|
||||
SuperAPI.CombatText_AddMessage = function(message, scrollFunction, r, g, b, displayType, isStaggered)
|
||||
local newMessage = gsub(message, "(%s%[)(0x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x)(%])", function(bracket1, hex, bracket2)
|
||||
if UnitIsUnit(hex, "player") then return nil
|
||||
else return " ["..UnitName(hex).."]" end
|
||||
end)
|
||||
return SuperAPI.CombatText_AddMessageOriginal(newMessage, scrollFunction, r, g, b, displayType, isStaggered)
|
||||
end
|
||||
|
||||
-- Link quest in chat from Blizzard QuestLog
|
||||
SuperAPI.QuestLogTitleButton_OnClick = function(button)
|
||||
local questIndex = this:GetID() + FauxScrollFrame_GetOffset(QuestLogListScrollFrame);
|
||||
|
||||
if ( IsShiftKeyDown() ) then
|
||||
if ( not this.isHeader ) then
|
||||
if ( ChatFrameEditBox:IsVisible() ) then
|
||||
local questLink = GetQuestLinkForLogIndex(questIndex)
|
||||
ChatFrameEditBox:Insert(questLink);
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return SuperAPI.QuestLogTitleButton_OnClickOriginal(button)
|
||||
end
|
||||
@@ -1,25 +0,0 @@
|
||||
## Interface: 11200
|
||||
## Title: SuperAPI |cFFFF8080-balake-|r
|
||||
## Notes: the companion compatibility addon to the mod of the same name.
|
||||
## Author: balake
|
||||
## SavedVariablesPerCharacter: SuperAPIDB
|
||||
## X-Embeds: Ace2, FuBarPlugin-2.0, CompostLib, DewDropLib, TabletLib
|
||||
|
||||
libs\AceLibrary\AceLibrary.lua
|
||||
|
||||
libs\AceOO-2.0\AceOO-2.0.lua
|
||||
libs\AceAddon-2.0\AceAddon-2.0.lua
|
||||
libs\AceConsole-2.0\AceConsole-2.0.lua
|
||||
libs\AceHook-2.1\AceHook-2.1.lua
|
||||
libs\AceDB-2.0\AceDB-2.0.lua
|
||||
libs\AceDebug-2.0\AceDebug-2.0.lua
|
||||
libs\AceEvent-2.0\AceEvent-2.0.lua
|
||||
libs\AceLocale-2.2\AceLocale-2.2.lua
|
||||
libs\AceModuleCore-2.0\AceModuleCore-2.0.lua
|
||||
|
||||
libs\Dewdrop\Dewdrop-2.0.lua
|
||||
libs\Tablet\Tablet-2.0.lua
|
||||
libs\FuBarPlugin\FuBarPlugin-2.0.lua
|
||||
|
||||
SuperAPI.lua
|
||||
SuperAPIOptions.lua
|
||||
@@ -1,416 +0,0 @@
|
||||
-- No superwow, no superapi
|
||||
if not SuperAPI then
|
||||
return
|
||||
end
|
||||
|
||||
SuperAPI.AUTOLOOT_OPTIONS = {
|
||||
"Always on",
|
||||
"Always off",
|
||||
"Shift to toggle on",
|
||||
"Shift to toggle off",
|
||||
}
|
||||
|
||||
SuperAPI.SELECTION_CIRCLE_STYLE = {
|
||||
"Default - incomplete circle",
|
||||
"Full circle (must download texture)",
|
||||
"Full circle with arrow for facing direction (must download texture)",
|
||||
"Classic incomplete circle oriented in facing direction",
|
||||
}
|
||||
|
||||
SuperAPI.NAMEPLATE_MOTION = {
|
||||
"Overlap",
|
||||
"Default spread",
|
||||
"Smart spread",
|
||||
"Compact spread",
|
||||
}
|
||||
|
||||
SuperAPI:RegisterDefaults("profile", {
|
||||
autoloot = SuperAPI.AUTOLOOT_OPTIONS[3],
|
||||
clickthrough = false,
|
||||
})
|
||||
|
||||
SuperAPI.IfShiftAutoloot = function()
|
||||
if IsShiftKeyDown() then
|
||||
SetAutoloot(1)
|
||||
else
|
||||
SetAutoloot(0)
|
||||
end
|
||||
end
|
||||
|
||||
SuperAPI.IfShiftNoAutoloot = function()
|
||||
if IsShiftKeyDown() then
|
||||
SetAutoloot(0)
|
||||
else
|
||||
SetAutoloot(1)
|
||||
end
|
||||
end
|
||||
|
||||
SuperAPI.cmdtable = {
|
||||
type = "group",
|
||||
handler = SuperAPI,
|
||||
args = {
|
||||
autoloot = {
|
||||
type = "text",
|
||||
name = "Autoloot (Read tooltip)",
|
||||
desc = "Specifies autoloot behavior. If using Vanilla Tweaks quickloot all of these will be reversed (always on will actually be always off, Shift to toggle on will be Shift to toggle off etc).",
|
||||
order = 10,
|
||||
validate = SuperAPI.AUTOLOOT_OPTIONS,
|
||||
get = function()
|
||||
return SuperAPI.db.profile.autoloot
|
||||
end,
|
||||
set = function(v)
|
||||
SuperAPI.db.profile.autoloot = v
|
||||
if v == SuperAPI.AUTOLOOT_OPTIONS[1] then
|
||||
-- "Always on"
|
||||
SetAutoloot(1)
|
||||
SuperAPI.frame:SetScript("OnUpdate", nil)
|
||||
elseif v == SuperAPI.AUTOLOOT_OPTIONS[2] then
|
||||
-- "Always off"
|
||||
SetAutoloot(0)
|
||||
SuperAPI.frame:SetScript("OnUpdate", nil)
|
||||
elseif v == SuperAPI.AUTOLOOT_OPTIONS[3] then
|
||||
-- "Shift to toggle on"
|
||||
SetAutoloot(0)
|
||||
SuperAPI.frame:SetScript("OnUpdate", SuperAPI.IfShiftAutoloot)
|
||||
elseif v == SuperAPI.AUTOLOOT_OPTIONS[4] then
|
||||
-- "Shift to toggle off"
|
||||
SetAutoloot(1)
|
||||
SuperAPI.frame:SetScript("OnUpdate", SuperAPI.IfShiftNoAutoloot)
|
||||
end
|
||||
end,
|
||||
},
|
||||
clickthrough = {
|
||||
type = "toggle",
|
||||
name = "Clickthrough corpses",
|
||||
desc = "Allows you to click through corpses to loot corpses underneath them.",
|
||||
order = 20,
|
||||
get = function()
|
||||
return Clickthrough() == 1
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
Clickthrough(1)
|
||||
else
|
||||
Clickthrough(0)
|
||||
end
|
||||
SuperAPI.db.profile.clickthrough = v
|
||||
end,
|
||||
},
|
||||
fov = {
|
||||
type = "range",
|
||||
name = "Field of view",
|
||||
desc = "Changes the field of view of the game. Requires UI Reload.",
|
||||
order = 30,
|
||||
min = 0.1,
|
||||
max = 3.14,
|
||||
step = 0.05,
|
||||
get = function()
|
||||
return GetCVar("FoV")
|
||||
end,
|
||||
set = function(v)
|
||||
SetCVar("FoV", v)
|
||||
end,
|
||||
},
|
||||
selectioncircle = {
|
||||
type = "text",
|
||||
name = "Selection circle style",
|
||||
desc = "Changes the style of the selection circle.",
|
||||
order = 40,
|
||||
validate = SuperAPI.SELECTION_CIRCLE_STYLE,
|
||||
get = function()
|
||||
local selectioncircle = GetCVar("SelectionCircleStyle")
|
||||
if selectioncircle then
|
||||
return SuperAPI.SELECTION_CIRCLE_STYLE[tonumber(selectioncircle)]
|
||||
end
|
||||
end,
|
||||
set = function(v)
|
||||
if v == SuperAPI.SELECTION_CIRCLE_STYLE[1] then
|
||||
SetCVar("SelectionCircleStyle", "1")
|
||||
elseif v == SuperAPI.SELECTION_CIRCLE_STYLE[2] then
|
||||
SetCVar("SelectionCircleStyle", "2")
|
||||
elseif v == SuperAPI.SELECTION_CIRCLE_STYLE[3] then
|
||||
SetCVar("SelectionCircleStyle", "3")
|
||||
elseif v == SuperAPI.SELECTION_CIRCLE_STYLE[4] then
|
||||
SetCVar("SelectionCircleStyle", "4")
|
||||
end
|
||||
end,
|
||||
},
|
||||
backgroundsound = {
|
||||
type = "toggle",
|
||||
name = "Background sound",
|
||||
desc = "Allows game sound to play even when the window is in the background.",
|
||||
order = 60,
|
||||
get = function()
|
||||
return GetCVar("BackgroundSound") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("BackgroundSound", "1")
|
||||
else
|
||||
SetCVar("BackgroundSound", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
uncappedsounds = {
|
||||
type = "toggle",
|
||||
name = "Uncapped sounds",
|
||||
desc = "Allows more game sounds to play at the same time by removing hardcoded limit. This will also set SoundSoftwareChannels and SoundMaxHardwareChannels to 64. If you experience any weird crashes you may want to turn this off.",
|
||||
order = 70,
|
||||
get = function()
|
||||
return GetCVar("UncapSounds") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("UncapSounds", "1")
|
||||
SetCVar("SoundSoftwareChannels", "64")
|
||||
SetCVar("SoundMaxHardwareChannels", "64")
|
||||
else
|
||||
SetCVar("UncapSounds", "0")
|
||||
SetCVar("SoundSoftwareChannels", "12")
|
||||
SetCVar("SoundMaxHardwareChannels", "12")
|
||||
end
|
||||
end,
|
||||
},
|
||||
lootsparkle = {
|
||||
type = "toggle",
|
||||
name = "Loot Sparkle",
|
||||
desc = "Toggle loot sparkle effect on lootable treasure.",
|
||||
order = 80,
|
||||
get = function()
|
||||
return GetCVar("LootSparkle") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("LootSparkle", "1")
|
||||
else
|
||||
SetCVar("LootSparkle", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
healingtext = {
|
||||
type = "toggle",
|
||||
name = "Floating Healing Text",
|
||||
desc = "Toggle display of in-world healing feedback.",
|
||||
order = 85,
|
||||
get = function()
|
||||
return GetCVar("HealingText") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("HealingText", "1")
|
||||
else
|
||||
SetCVar("HealingText", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
nameplates = {
|
||||
type = "group",
|
||||
name = "Nameplate Settings",
|
||||
desc = "Group of settings related to Nameplates",
|
||||
order = 90,
|
||||
args = {
|
||||
nameplaterange = {
|
||||
type = "range",
|
||||
name = "Nameplate range",
|
||||
desc = "Changes the range at which Nameplates appear.",
|
||||
order = 1,
|
||||
min = 10,
|
||||
max = 80,
|
||||
step = 1,
|
||||
get = function()
|
||||
return GetCVar("NameplateRange")
|
||||
end,
|
||||
set = function(v)
|
||||
SetCVar("NameplateRange", v)
|
||||
end,
|
||||
},
|
||||
nameplatemotion = {
|
||||
type = "text",
|
||||
name = "Nameplate Motion",
|
||||
desc = "Changes the behavior of moving nameplates.",
|
||||
order = 2,
|
||||
validate = SuperAPI.NAMEPLATE_MOTION,
|
||||
get = function()
|
||||
local nameplatemotionSetting = GetCVar("NameplateMotion")
|
||||
if nameplatemotionSetting then
|
||||
return SuperAPI.NAMEPLATE_MOTION[(tonumber(nameplatemotionSetting))+1]
|
||||
end
|
||||
end,
|
||||
set = function(v)
|
||||
if v == SuperAPI.NAMEPLATE_MOTION[1] then
|
||||
SetCVar("NameplateMotion", "0")
|
||||
elseif v == SuperAPI.NAMEPLATE_MOTION[2] then
|
||||
SetCVar("NameplateMotion", "1")
|
||||
elseif v == SuperAPI.NAMEPLATE_MOTION[3] then
|
||||
SetCVar("NameplateMotion", "2")
|
||||
elseif v == SuperAPI.NAMEPLATE_MOTION[4] then
|
||||
SetCVar("NameplateMotion", "3")
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
},
|
||||
chatbubbles = {
|
||||
type = "group",
|
||||
name = "Chat Bubble Settings",
|
||||
desc = "Group of settings related to Chat Bubbles that appear above units",
|
||||
order = 100,
|
||||
args = {
|
||||
chatbubblerange = {
|
||||
type = "range",
|
||||
name = "Chat Bubbles range",
|
||||
desc = "Changes the range at which Chat Bubbles appear.",
|
||||
order = 1007,
|
||||
min = 10,
|
||||
max = 200,
|
||||
step = 5,
|
||||
get = function()
|
||||
return GetCVar("ChatBubbleRange")
|
||||
end,
|
||||
set = function(v)
|
||||
SetCVar("ChatBubbleRange", v)
|
||||
end,
|
||||
},
|
||||
togglesay = {
|
||||
type = "toggle",
|
||||
name = "Say Chat Bubbles",
|
||||
desc = "Toggle say and yell chat bubbles on/off",
|
||||
order = 1009,
|
||||
get = function()
|
||||
return GetCVar("ChatBubbles") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("ChatBubbles", "1")
|
||||
else
|
||||
SetCVar("ChatBubbles", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
togglepartybubbles = {
|
||||
type = "toggle",
|
||||
name = "Party Chat Bubbles",
|
||||
desc = "Toggle party chat bubbles on/off",
|
||||
order = 1008,
|
||||
get = function()
|
||||
return GetCVar("ChatBubblesParty") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("ChatBubblesParty", "1")
|
||||
else
|
||||
SetCVar("ChatBubblesParty", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
toggleraidbubbles = {
|
||||
type = "toggle",
|
||||
name = "Raid Chat Bubbles",
|
||||
desc = "Toggle raid chat bubbles on/off",
|
||||
order = 1010,
|
||||
get = function()
|
||||
return GetCVar("ChatBubblesRaid") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("ChatBubblesRaid", "1")
|
||||
else
|
||||
SetCVar("ChatBubblesRaid", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
togglebgbubbles = {
|
||||
type = "toggle",
|
||||
name = "Battleground Chat Bubbles",
|
||||
desc = "Toggle battleground chat bubbles on/off",
|
||||
order = 1020,
|
||||
get = function()
|
||||
return GetCVar("ChatBubblesBattleground") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("ChatBubblesBattleground", "1")
|
||||
else
|
||||
SetCVar("ChatBubblesBattleground", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
togglewhisperbubbles = {
|
||||
type = "toggle",
|
||||
name = "Whisper Chat Bubbles",
|
||||
desc = "Toggle whisper chat bubbles on/off",
|
||||
order = 1030,
|
||||
get = function()
|
||||
return GetCVar("ChatBubblesWhisper") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("ChatBubblesWhisper", "1")
|
||||
else
|
||||
SetCVar("ChatBubblesWhisper", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
togglecreaturebubbles = {
|
||||
type = "toggle",
|
||||
name = "Creature Chat Bubbles",
|
||||
desc = "Toggle chat bubbles on creatures on/off",
|
||||
order = 1040,
|
||||
get = function()
|
||||
return GetCVar("ChatBubblesCreatures") == "1"
|
||||
end,
|
||||
set = function(v)
|
||||
if v == true then
|
||||
SetCVar("ChatBubblesCreatures", "1")
|
||||
else
|
||||
SetCVar("ChatBubblesCreatures", "0")
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
},
|
||||
superwowLink = {
|
||||
type = "execute",
|
||||
name = "Support The Project",
|
||||
desc = "All your donations are deeply appreciated! The community support is what keeps SuperWoW going",
|
||||
func = function()
|
||||
local url = "https://ko-fi.com/balakesuperwow"
|
||||
|
||||
if not ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Show()
|
||||
end
|
||||
|
||||
ChatFrameEditBox:SetText(url)
|
||||
ChatFrameEditBox:SetFocus()
|
||||
ChatFrameEditBox:HighlightText()
|
||||
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
local deuce = SuperAPI:NewModule("SuperAPI Options Menu")
|
||||
deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar
|
||||
deuce.consoleCmd = not deuce.hasFuBar
|
||||
|
||||
SuperAPIOptions = AceLibrary("AceAddon-2.0"):new("AceDB-2.0", "FuBarPlugin-2.0")
|
||||
SuperAPIOptions.name = "FuBar - SuperAPI"
|
||||
SuperAPIOptions:RegisterDB("SuperAPIDB")
|
||||
SuperAPIOptions.hasIcon = "Interface\\Icons\\inv_misc_book_06"
|
||||
SuperAPIOptions.defaultMinimapPosition = 180
|
||||
SuperAPIOptions.independentProfile = true
|
||||
SuperAPIOptions.hideWithoutStandby = false
|
||||
|
||||
SuperAPIOptions.OnMenuRequest = SuperAPI.cmdtable
|
||||
local args = AceLibrary("FuBarPlugin-2.0"):GetAceOptionsDataTable(SuperAPIOptions)
|
||||
for k, v in pairs(args) do
|
||||
if SuperAPIOptions.OnMenuRequest.args[k] == nil then
|
||||
SuperAPIOptions.OnMenuRequest.args[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
function SuperAPIOptions:OnEnable()
|
||||
-- activate saved settings
|
||||
SuperAPI.cmdtable.args.autoloot.set(SuperAPI.db.profile.autoloot)
|
||||
SuperAPI.cmdtable.args.clickthrough.set(SuperAPI.db.profile.clickthrough)
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,245 +0,0 @@
|
||||
--[[
|
||||
Name: AceDebug-2.0
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceDebug-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceDebug-2.0
|
||||
Description: Mixin to allow for simple debugging capabilities.
|
||||
Dependencies: AceLibrary, AceOO-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceDebug-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17639 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
local DEBUGGING, TOGGLE_DEBUGGING
|
||||
|
||||
if GetLocale() == "frFR" then
|
||||
DEBUGGING = "D\195\169boguage"
|
||||
TOGGLE_DEBUGGING = "Activer/d\195\169sactiver le d\195\169boguage"
|
||||
elseif GetLocale() == "esES" then
|
||||
DEBUGGING = "Depurar"
|
||||
TOGGLE_DEBUGGING = "Activar/desactivar depurar"
|
||||
elseif GetLocale() == "deDE" then
|
||||
DEBUGGING = "Debuggen"
|
||||
TOGGLE_DEBUGGING = "Aktiviert/Deaktiviert Debugging"
|
||||
elseif GetLocale() == "koKR" then
|
||||
DEBUGGING = "디버깅"
|
||||
TOGGLE_DEBUGGING = "디버깅 기능 사용함/사용안함"
|
||||
elseif GetLocale() == "zhTW" then
|
||||
DEBUGGING = "除錯"
|
||||
TOGGLE_DEBUGGING = "啟用/停用除錯功能"
|
||||
elseif GetLocale() == "zhCN" then
|
||||
DEBUGGING = "\232\176\131\232\175\149"
|
||||
TOGGLE_DEBUGGING = "\229\144\175\231\148\168/\231\166\129\231\148\168 \232\176\131\232\175\149"
|
||||
elseif GetLocale() == "ruRU" then
|
||||
DEBUGGING = "Отладка"
|
||||
TOGGLE_DEBUGGING = "Вкл/Выкл отладку для этого аддона."
|
||||
else -- enUS
|
||||
DEBUGGING = "Debugging"
|
||||
TOGGLE_DEBUGGING = "Enable/disable debugging"
|
||||
end
|
||||
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local math_mod = math.mod or math.fmod
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local AceDebug = AceOO.Mixin {"Debug", "CustomDebug", "IsDebugging", "SetDebugging", "SetDebugLevel", "LevelDebug", "CustomLevelDebug", "GetDebugLevel"}
|
||||
|
||||
local function print(text, r, g, b, frame, delay)
|
||||
(frame or DEFAULT_CHAT_FRAME):AddMessage(text, r, g, b, 1, delay or 5)
|
||||
end
|
||||
|
||||
local tmp
|
||||
|
||||
function AceDebug:CustomDebug(r, g, b, frame, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.debugging then return end
|
||||
|
||||
local output = string.format("|cff7fff7f(DEBUG) %s:[%s%3d]|r", tostring(self), date("%H:%M:%S"), math_mod(GetTime(), 1) * 1000)
|
||||
|
||||
if string.find(tostring(a1), "%%") then
|
||||
output = output .. " " .. string.format(tostring(a1), tostring(a2), tostring(a3), tostring(a4), tostring(a5), tostring(a6), tostring(a7), tostring(a8), tostring(a9), tostring(a10), tostring(a11), tostring(a12), tostring(a13), tostring(a14), tostring(a15), tostring(a16), tostring(a17), tostring(a18), tostring(a19), tostring(a20))
|
||||
else
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
end
|
||||
|
||||
-- This block dynamically rebuilds the tmp array stopping on the first nil.
|
||||
table.insert(tmp, output)
|
||||
|
||||
table.insert(tmp, tostring(a1))
|
||||
table.insert(tmp, a2)
|
||||
table.insert(tmp, a3)
|
||||
table.insert(tmp, a4)
|
||||
table.insert(tmp, a5)
|
||||
table.insert(tmp, a6)
|
||||
table.insert(tmp, a7)
|
||||
table.insert(tmp, a8)
|
||||
table.insert(tmp, a9)
|
||||
table.insert(tmp, a10)
|
||||
table.insert(tmp, a11)
|
||||
table.insert(tmp, a12)
|
||||
table.insert(tmp, a13)
|
||||
table.insert(tmp, a14)
|
||||
table.insert(tmp, a15)
|
||||
table.insert(tmp, a16)
|
||||
table.insert(tmp, a17)
|
||||
table.insert(tmp, a18)
|
||||
table.insert(tmp, a19)
|
||||
table.insert(tmp, a20)
|
||||
while tmp[table.getn(tmp)] == nil do
|
||||
table.remove(tmp)
|
||||
end
|
||||
for k = 1, table.getn(tmp) do
|
||||
tmp[k] = tostring(tmp[k])
|
||||
end
|
||||
|
||||
output = table.concat(tmp, " ")
|
||||
|
||||
for k,v in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
table_setn(tmp, 0)
|
||||
end
|
||||
|
||||
print(output, r, g, b, frame or self.debugFrame, delay)
|
||||
end
|
||||
|
||||
function AceDebug:Debug(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
AceDebug.CustomDebug(self, nil, nil, nil, nil, nil, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
function AceDebug:IsDebugging()
|
||||
return self.debugging
|
||||
end
|
||||
|
||||
function AceDebug:SetDebugging(debugging)
|
||||
self.debugging = debugging
|
||||
end
|
||||
|
||||
-- Takes a number 1-3
|
||||
-- Level 1: Critical messages that every user should receive
|
||||
-- Level 2: Should be used for local debugging (function calls, etc)
|
||||
-- Level 3: Very verbose debugging, will dump everything and anything
|
||||
-- If set to nil, you will receive no debug information
|
||||
function AceDebug:SetDebugLevel(level)
|
||||
AceDebug:argCheck(level, 1, "number", "nil")
|
||||
if not level then
|
||||
self.debuglevel = nil
|
||||
return
|
||||
end
|
||||
if level < 1 or level > 3 then
|
||||
AceDebug:error("Bad argument #1 to `SetDebugLevel`, must be a number 1-3")
|
||||
end
|
||||
self.debuglevel = level
|
||||
end
|
||||
|
||||
function AceDebug:GetDebugLevel()
|
||||
return self.debuglevel
|
||||
end
|
||||
|
||||
function AceDebug:CustomLevelDebug(level, r, g, b, frame, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.debugging or not self.debuglevel then return end
|
||||
AceDebug:argCheck(level, 1, "number")
|
||||
if level < 1 or level > 3 then
|
||||
AceDebug:error("Bad argument #1 to `LevelDebug`, must be a number 1-3")
|
||||
end
|
||||
if level > self.debuglevel then return end
|
||||
|
||||
local output = string.format("|cff7fff7f(DEBUG) %s:[%s.%3d]|r", tostring(self), date("%H:%M:%S"), math_mod(GetTime(), 1) * 1000)
|
||||
|
||||
if string.find(tostring(a1), "%%") then
|
||||
output = output .. " " .. string.format(tostring(a1), tostring(a2), tostring(a3), tostring(a4), tostring(a5), tostring(a6), tostring(a7), tostring(a8), tostring(a9), tostring(a10), tostring(a11), tostring(a12), tostring(a13), tostring(a14), tostring(a15), tostring(a16), tostring(a17), tostring(a18), tostring(a19), tostring(a20))
|
||||
else
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
end
|
||||
|
||||
-- This block dynamically rebuilds the tmp array stopping on the first nil.
|
||||
table.insert(tmp, output)
|
||||
|
||||
table.insert(tmp, tostring(a1))
|
||||
table.insert(tmp, a2)
|
||||
table.insert(tmp, a3)
|
||||
table.insert(tmp, a4)
|
||||
table.insert(tmp, a5)
|
||||
table.insert(tmp, a6)
|
||||
table.insert(tmp, a7)
|
||||
table.insert(tmp, a8)
|
||||
table.insert(tmp, a9)
|
||||
table.insert(tmp, a10)
|
||||
table.insert(tmp, a11)
|
||||
table.insert(tmp, a12)
|
||||
table.insert(tmp, a13)
|
||||
table.insert(tmp, a14)
|
||||
table.insert(tmp, a15)
|
||||
table.insert(tmp, a16)
|
||||
table.insert(tmp, a17)
|
||||
table.insert(tmp, a18)
|
||||
table.insert(tmp, a19)
|
||||
table.insert(tmp, a20)
|
||||
while tmp[table.getn(tmp)] == nil do
|
||||
table.remove(tmp)
|
||||
end
|
||||
for k = 1, table.getn(tmp) do
|
||||
tmp[k] = tostring(tmp[k])
|
||||
end
|
||||
|
||||
output = table.concat(tmp, " ")
|
||||
|
||||
for k,v in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
table_setn(tmp, 0)
|
||||
end
|
||||
|
||||
print(output, r, g, b, frame or self.debugFrame, delay)
|
||||
end
|
||||
|
||||
function AceDebug:LevelDebug(level, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.debugging or not self.debuglevel then return end
|
||||
AceDebug:argCheck(level, 1, "number")
|
||||
if level < 1 or level > 3 then
|
||||
AceDebug:error("Bad argument #1 to `LevelDebug`, must be a number 1-3")
|
||||
end
|
||||
if level > self.debuglevel then return end
|
||||
|
||||
AceDebug.CustomLevelDebug(self, level, nil, nil, nil, nil, nil, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
|
||||
local options
|
||||
function AceDebug:GetAceOptionsDataTable(target)
|
||||
if not options then
|
||||
options = {
|
||||
debug = {
|
||||
name = DEBUGGING,
|
||||
desc = TOGGLE_DEBUGGING,
|
||||
type = "toggle",
|
||||
get = "IsDebugging",
|
||||
set = "SetDebugging",
|
||||
order = -2,
|
||||
}
|
||||
}
|
||||
end
|
||||
return options
|
||||
end
|
||||
AceLibrary:Register(AceDebug, MAJOR_VERSION, MINOR_VERSION, AceDebug.activate)
|
||||
AceDebug = AceLibrary(MAJOR_VERSION)
|
||||
@@ -1,973 +0,0 @@
|
||||
--[[
|
||||
Name: AceEvent-2.0
|
||||
Revision: $Rev: 17803 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceEvent-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceEvent-2.0
|
||||
Description: Mixin to allow for event handling, scheduling, and inter-addon
|
||||
communication.
|
||||
Dependencies: AceLibrary, AceOO-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceEvent-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17803 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local Mixin = AceOO.Mixin
|
||||
local AceEvent = Mixin {
|
||||
"RegisterEvent",
|
||||
"RegisterAllEvents",
|
||||
"UnregisterEvent",
|
||||
"UnregisterAllEvents",
|
||||
"TriggerEvent",
|
||||
"ScheduleEvent",
|
||||
"ScheduleRepeatingEvent",
|
||||
"CancelScheduledEvent",
|
||||
"CancelAllScheduledEvents",
|
||||
"IsEventRegistered",
|
||||
"IsEventScheduled",
|
||||
"RegisterBucketEvent",
|
||||
"UnregisterBucketEvent",
|
||||
"UnregisterAllBucketEvents",
|
||||
"IsBucketEventRegistered",
|
||||
}
|
||||
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local weakKey = {__mode="k"}
|
||||
local new, del
|
||||
do
|
||||
local list = setmetatable({}, weakKey)
|
||||
function new()
|
||||
local t = next(list)
|
||||
if t then
|
||||
list[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function del(t)
|
||||
setmetatable(t, nil)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
list[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
local FAKE_NIL
|
||||
local RATE
|
||||
|
||||
local eventsWhichHappenOnce = {
|
||||
PLAYER_LOGIN = true,
|
||||
AceEvent_FullyInitialized = true,
|
||||
VARIABLES_LOADED = true,
|
||||
PLAYER_LOGOUT = true,
|
||||
}
|
||||
|
||||
local registeringFromAceEvent
|
||||
function AceEvent:RegisterEvent(event, method, once)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
if self == AceEvent and not registeringFromAceEvent then
|
||||
AceEvent:argCheck(method, 3, "function")
|
||||
self = method
|
||||
else
|
||||
AceEvent:argCheck(method, 3, "string", "function", "nil", "boolean", "number")
|
||||
if type(method) == "boolean" or type(method) == "number" then
|
||||
AceEvent:argCheck(once, 4, "nil")
|
||||
once, method = method, event
|
||||
end
|
||||
end
|
||||
AceEvent:argCheck(once, 4, "number", "boolean", "nil")
|
||||
if eventsWhichHappenOnce[event] then
|
||||
once = true
|
||||
end
|
||||
local throttleRate
|
||||
if type(once) == "number" then
|
||||
throttleRate, once = once
|
||||
end
|
||||
if not method then
|
||||
method = event
|
||||
end
|
||||
if type(method) == "string" and type(self[method]) ~= "function" then
|
||||
AceEvent:error("Cannot register event %q to method %q, it does not exist", event, method)
|
||||
else
|
||||
assert(type(method) == "function" or type(method) == "string")
|
||||
end
|
||||
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if not AceEvent_registry[event] then
|
||||
AceEvent_registry[event] = new()
|
||||
AceEvent.frame:RegisterEvent(event)
|
||||
end
|
||||
|
||||
local remember = true
|
||||
if AceEvent_registry[event][self] then
|
||||
remember = false
|
||||
end
|
||||
AceEvent_registry[event][self] = method
|
||||
|
||||
local AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
if once then
|
||||
if not AceEvent_onceRegistry then
|
||||
AceEvent.onceRegistry = new()
|
||||
AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
end
|
||||
if not AceEvent_onceRegistry[event] then
|
||||
AceEvent_onceRegistry[event] = new()
|
||||
end
|
||||
AceEvent_onceRegistry[event][self] = true
|
||||
else
|
||||
if AceEvent_onceRegistry and AceEvent_onceRegistry[event] then
|
||||
AceEvent_onceRegistry[event][self] = nil
|
||||
if not next(AceEvent_onceRegistry[event]) then
|
||||
AceEvent_onceRegistry[event] = del(AceEvent_onceRegistry[event])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
if throttleRate then
|
||||
if not AceEvent_throttleRegistry then
|
||||
AceEvent.throttleRegistry = new()
|
||||
AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
end
|
||||
if not AceEvent_throttleRegistry[event] then
|
||||
AceEvent_throttleRegistry[event] = new()
|
||||
end
|
||||
if AceEvent_throttleRegistry[event][self] then
|
||||
AceEvent_throttleRegistry[event][self] = del(AceEvent_throttleRegistry[event][self])
|
||||
end
|
||||
AceEvent_throttleRegistry[event][self] = setmetatable(new(), weakKey)
|
||||
local t = AceEvent_throttleRegistry[event][self]
|
||||
t[RATE] = throttleRate
|
||||
else
|
||||
if AceEvent_throttleRegistry and AceEvent_throttleRegistry[event] then
|
||||
if AceEvent_throttleRegistry[event][self] then
|
||||
AceEvent_throttleRegistry[event][self] = del(AceEvent_throttleRegistry[event][self])
|
||||
end
|
||||
if not next(AceEvent_throttleRegistry[event]) then
|
||||
AceEvent_throttleRegistry[event] = del(AceEvent_throttleRegistry[event])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if remember then
|
||||
AceEvent:TriggerEvent("AceEvent_EventRegistered", self, event)
|
||||
end
|
||||
end
|
||||
|
||||
local ALL_EVENTS
|
||||
|
||||
function AceEvent:RegisterAllEvents(method)
|
||||
if self == AceEvent then
|
||||
AceEvent:argCheck(method, 1, "function")
|
||||
self = method
|
||||
else
|
||||
AceEvent:argCheck(method, 1, "string", "function")
|
||||
if type(method) == "string" and type(self[method]) ~= "function" then
|
||||
AceEvent:error("Cannot register all events to method %q, it does not exist", method)
|
||||
end
|
||||
end
|
||||
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if not AceEvent_registry[ALL_EVENTS] then
|
||||
AceEvent_registry[ALL_EVENTS] = new()
|
||||
AceEvent.frame:RegisterAllEvents()
|
||||
end
|
||||
|
||||
AceEvent_registry[ALL_EVENTS][self] = method
|
||||
end
|
||||
|
||||
local _G = getfenv(0)
|
||||
local memstack, timestack = {}, {}
|
||||
local memdiff, timediff
|
||||
function AceEvent:TriggerEvent(event, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if (not AceEvent_registry[event] or not next(AceEvent_registry[event])) and (not AceEvent_registry[ALL_EVENTS] or not next(AceEvent_registry[ALL_EVENTS])) then
|
||||
return
|
||||
end
|
||||
local _G_event = _G.event
|
||||
_G.event = event
|
||||
local lastEvent = AceEvent.currentEvent
|
||||
AceEvent.currentEvent = event
|
||||
|
||||
local AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
local AceEvent_debugTable = AceEvent.debugTable
|
||||
if AceEvent_onceRegistry and AceEvent_onceRegistry[event] then
|
||||
local tmp = new()
|
||||
for obj, method in pairs(AceEvent_onceRegistry[event]) do
|
||||
tmp[obj] = AceEvent_registry[event] and AceEvent_registry[event][obj] or nil
|
||||
end
|
||||
local obj = next(tmp)
|
||||
while obj do
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
if not AceEvent_debugTable[event] then
|
||||
AceEvent_debugTable[event] = new()
|
||||
end
|
||||
if not AceEvent_debugTable[event][obj] then
|
||||
AceEvent_debugTable[event][obj] = new()
|
||||
AceEvent_debugTable[event][obj].mem = 0
|
||||
AceEvent_debugTable[event][obj].time = 0
|
||||
AceEvent_debugTable[event][obj].count = 0
|
||||
end
|
||||
if memdiff then
|
||||
table.insert(memstack, memdiff)
|
||||
table.insert(timestack, timediff)
|
||||
end
|
||||
memdiff, timediff = 0, 0
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
local method = tmp[obj]
|
||||
AceEvent.UnregisterEvent(obj, event)
|
||||
if type(method) == "string" then
|
||||
local obj_method = obj[method]
|
||||
if obj_method then
|
||||
obj_method(obj, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
elseif method then -- function
|
||||
method(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
local dmem, dtime = memdiff, timediff
|
||||
mem, time = gcinfo() - mem - memdiff, GetTime() - time - timediff
|
||||
AceEvent_debugTable[event][obj].mem = AceEvent_debugTable[event][obj].mem + mem
|
||||
AceEvent_debugTable[event][obj].time = AceEvent_debugTable[event][obj].time + time
|
||||
AceEvent_debugTable[event][obj].count = AceEvent_debugTable[event][obj].count + 1
|
||||
|
||||
memdiff, timediff = table.remove(memstack), table.remove(timestack)
|
||||
if memdiff then
|
||||
memdiff = memdiff + mem + dmem
|
||||
timediff = timediff + time + dtime
|
||||
end
|
||||
end
|
||||
tmp[obj] = nil
|
||||
obj = next(tmp)
|
||||
end
|
||||
del(tmp)
|
||||
end
|
||||
|
||||
local AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
local throttleTable = AceEvent_throttleRegistry and AceEvent_throttleRegistry[event]
|
||||
if AceEvent_registry[event] then
|
||||
local tmp = new()
|
||||
for obj, method in pairs(AceEvent_registry[event]) do
|
||||
tmp[obj] = method
|
||||
end
|
||||
local obj = next(tmp)
|
||||
while obj do
|
||||
local method = tmp[obj]
|
||||
local continue = false
|
||||
if throttleTable and throttleTable[obj] then
|
||||
local a1 = a1
|
||||
if a1 == nil then
|
||||
a1 = FAKE_NIL
|
||||
end
|
||||
if not throttleTable[obj][a1] or GetTime() - throttleTable[obj][a1] >= throttleTable[obj][RATE] then
|
||||
throttleTable[obj][a1] = GetTime()
|
||||
else
|
||||
continue = true
|
||||
end
|
||||
end
|
||||
if not continue then
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
if not AceEvent_debugTable[event] then
|
||||
AceEvent_debugTable[event] = new()
|
||||
end
|
||||
if not AceEvent_debugTable[event][obj] then
|
||||
AceEvent_debugTable[event][obj] = new()
|
||||
AceEvent_debugTable[event][obj].mem = 0
|
||||
AceEvent_debugTable[event][obj].time = 0
|
||||
AceEvent_debugTable[event][obj].count = 0
|
||||
end
|
||||
if memdiff then
|
||||
table.insert(memstack, memdiff)
|
||||
table.insert(timestack, timediff)
|
||||
end
|
||||
memdiff, timediff = 0, 0
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
if type(method) == "string" then
|
||||
local obj_method = obj[method]
|
||||
if obj_method then
|
||||
obj_method(obj, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
elseif method then -- function
|
||||
method(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
local dmem, dtime = memdiff, timediff
|
||||
mem, time = gcinfo() - mem - memdiff, GetTime() - time - timediff
|
||||
AceEvent_debugTable[event][obj].mem = AceEvent_debugTable[event][obj].mem + mem
|
||||
AceEvent_debugTable[event][obj].time = AceEvent_debugTable[event][obj].time + time
|
||||
AceEvent_debugTable[event][obj].count = AceEvent_debugTable[event][obj].count + 1
|
||||
|
||||
memdiff, timediff = table.remove(memstack), table.remove(timestack)
|
||||
if memdiff then
|
||||
memdiff = memdiff + mem + dmem
|
||||
timediff = timediff + time + dtime
|
||||
end
|
||||
end
|
||||
end
|
||||
tmp[obj] = nil
|
||||
obj = next(tmp)
|
||||
end
|
||||
del(tmp)
|
||||
end
|
||||
if AceEvent_registry[ALL_EVENTS] then
|
||||
local tmp = new()
|
||||
for obj, method in pairs(AceEvent_registry[ALL_EVENTS]) do
|
||||
tmp[obj] = method
|
||||
end
|
||||
local obj = next(tmp)
|
||||
while obj do
|
||||
local method = tmp[obj]
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
if not AceEvent_debugTable[event] then
|
||||
AceEvent_debugTable[event] = new()
|
||||
end
|
||||
if not AceEvent_debugTable[event][obj] then
|
||||
AceEvent_debugTable[event][obj] = new()
|
||||
AceEvent_debugTable[event][obj].mem = 0
|
||||
AceEvent_debugTable[event][obj].time = 0
|
||||
AceEvent_debugTable[event][obj].count = 0
|
||||
end
|
||||
if memdiff then
|
||||
table.insert(memstack, memdiff)
|
||||
table.insert(timestack, timediff)
|
||||
end
|
||||
memdiff, timediff = 0, 0
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
if type(method) == "string" then
|
||||
local obj_method = obj[method]
|
||||
if obj_method then
|
||||
obj_method(obj, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
elseif method then -- function
|
||||
method(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
local dmem, dtime = memdiff, timediff
|
||||
mem, time = gcinfo() - mem - memdiff, GetTime() - time - timediff
|
||||
AceEvent_debugTable[event][obj].mem = AceEvent_debugTable[event][obj].mem + mem
|
||||
AceEvent_debugTable[event][obj].time = AceEvent_debugTable[event][obj].time + time
|
||||
AceEvent_debugTable[event][obj].count = AceEvent_debugTable[event][obj].count + 1
|
||||
|
||||
memdiff, timediff = table.remove(memstack), table.remove(timestack)
|
||||
if memdiff then
|
||||
memdiff = memdiff + mem + dmem
|
||||
timediff = timediff + time + dtime
|
||||
end
|
||||
end
|
||||
tmp[obj] = nil
|
||||
obj = next(tmp)
|
||||
end
|
||||
del(tmp)
|
||||
end
|
||||
_G.event = _G_event
|
||||
AceEvent.currentEvent = lastEvent
|
||||
end
|
||||
|
||||
-- local accessors
|
||||
local getn = table.getn
|
||||
local tinsert = table.insert
|
||||
local tremove = table.remove
|
||||
local floor = math.floor
|
||||
local GetTime = GetTime
|
||||
local next = next
|
||||
local pairs = pairs
|
||||
local unpack = unpack
|
||||
|
||||
local delayRegistry
|
||||
local tmp = {}
|
||||
local function OnUpdate()
|
||||
local t = GetTime()
|
||||
for k,v in pairs(delayRegistry) do
|
||||
tmp[k] = true
|
||||
end
|
||||
for k in pairs(tmp) do
|
||||
local v = delayRegistry[k]
|
||||
if v then
|
||||
local v_time = v.time
|
||||
if not v_time then
|
||||
delayRegistry[k] = del(v)
|
||||
elseif v_time <= t then
|
||||
local v_repeatDelay = v.repeatDelay
|
||||
if v_repeatDelay then
|
||||
-- use the event time, not the current time, else timing inaccuracies add up over time
|
||||
v.time = v_time + v_repeatDelay
|
||||
end
|
||||
local event = v.event
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
if type(event) == "function" then
|
||||
event(unpack(v))
|
||||
else
|
||||
AceEvent:TriggerEvent(event, unpack(v))
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
mem, time = gcinfo() - mem, GetTime() - time
|
||||
v.mem = v.mem + mem
|
||||
v.timeSpent = v.timeSpent + time
|
||||
v.count = v.count + 1
|
||||
end
|
||||
if not v_repeatDelay then
|
||||
local x = delayRegistry[k]
|
||||
if x and x.time == v_time then -- check if it was manually reset
|
||||
delayRegistry[k] = del(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for k in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
if not next(delayRegistry) then
|
||||
AceEvent.frame:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function ScheduleEvent(self, repeating, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
local id
|
||||
if type(event) == "string" or type(event) == "table" then
|
||||
if type(event) == "table" then
|
||||
if not delayRegistry or not delayRegistry[event] then
|
||||
AceEvent:error("Bad argument #2 to `ScheduleEvent'. Improper id table fed in.")
|
||||
end
|
||||
end
|
||||
if type(delay) ~= "number" then
|
||||
id, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20 = event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20
|
||||
AceEvent:argCheck(event, 3, "string", "function", --[[ so message is right ]] "number")
|
||||
AceEvent:argCheck(delay, 4, "number")
|
||||
self:CancelScheduledEvent(id)
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(event, 2, "string", "function")
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
end
|
||||
|
||||
if not delayRegistry then
|
||||
AceEvent.delayRegistry = new()
|
||||
delayRegistry = AceEvent.delayRegistry
|
||||
AceEvent.frame:SetScript("OnUpdate", OnUpdate)
|
||||
end
|
||||
local t
|
||||
if type(id) == "table" then
|
||||
for k in pairs(id) do
|
||||
id[k] = nil
|
||||
end
|
||||
t = id
|
||||
else
|
||||
t = new()
|
||||
end
|
||||
t[1] = a1
|
||||
t[2] = a2
|
||||
t[3] = a3
|
||||
t[4] = a4
|
||||
t[5] = a5
|
||||
t[6] = a6
|
||||
t[7] = a7
|
||||
t[8] = a8
|
||||
t[9] = a9
|
||||
t[10] = a10
|
||||
t[11] = a11
|
||||
t[12] = a12
|
||||
t[13] = a13
|
||||
t[14] = a14
|
||||
t[15] = a15
|
||||
t[16] = a16
|
||||
t[17] = a17
|
||||
t[18] = a18
|
||||
t[19] = a19
|
||||
t[20] = a20
|
||||
table_setn(t, 20)
|
||||
t.event = event
|
||||
t.time = GetTime() + delay
|
||||
t.self = self
|
||||
t.id = id or t
|
||||
t.repeatDelay = repeating and delay
|
||||
if AceEvent_debugTable then
|
||||
t.mem = 0
|
||||
t.count = 0
|
||||
t.timeSpent = 0
|
||||
end
|
||||
delayRegistry[t.id] = t
|
||||
AceEvent.frame:Show()
|
||||
return t.id
|
||||
end
|
||||
|
||||
function AceEvent:ScheduleEvent(event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if type(event) == "string" or type(event) == "table" then
|
||||
if type(event) == "table" then
|
||||
if not delayRegistry or not delayRegistry[event] then
|
||||
AceEvent:error("Bad argument #2 to `ScheduleEvent'. Improper id table fed in.")
|
||||
end
|
||||
end
|
||||
if type(delay) ~= "number" then
|
||||
AceEvent:argCheck(delay, 3, "string", "function", --[[ so message is right ]] "number")
|
||||
AceEvent:argCheck(a1, 4, "number")
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(event, 2, "string", "function")
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
end
|
||||
|
||||
return ScheduleEvent(self, false, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
function AceEvent:ScheduleRepeatingEvent(event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if type(event) == "string" or type(event) == "table" then
|
||||
if type(event) == "table" then
|
||||
if not delayRegistry or not delayRegistry[event] then
|
||||
AceEvent:error("Bad argument #2 to `ScheduleEvent'. Improper id table fed in.")
|
||||
end
|
||||
end
|
||||
if type(delay) ~= "number" then
|
||||
AceEvent:argCheck(delay, 3, "string", "function", --[[ so message is right ]] "number")
|
||||
AceEvent:argCheck(a1, 4, "number")
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(event, 2, "string", "function")
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
end
|
||||
|
||||
return ScheduleEvent(self, true, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
function AceEvent:CancelScheduledEvent(t)
|
||||
AceEvent:argCheck(t, 2, "string", "table")
|
||||
if delayRegistry then
|
||||
local v = delayRegistry[t]
|
||||
if v then
|
||||
delayRegistry[t] = del(v)
|
||||
if not next(delayRegistry) then
|
||||
AceEvent.frame:Hide()
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function AceEvent:IsEventScheduled(t)
|
||||
AceEvent:argCheck(t, 2, "string", "table")
|
||||
if delayRegistry then
|
||||
local v = delayRegistry[t]
|
||||
if v then
|
||||
return true, v.time - GetTime()
|
||||
end
|
||||
end
|
||||
return false, nil
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterEvent(event)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if AceEvent_registry[event] and AceEvent_registry[event][self] then
|
||||
AceEvent_registry[event][self] = nil
|
||||
local AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
if AceEvent_onceRegistry and AceEvent_onceRegistry[event] and AceEvent_onceRegistry[event][self] then
|
||||
AceEvent_onceRegistry[event][self] = nil
|
||||
if not next(AceEvent_onceRegistry[event]) then
|
||||
AceEvent_onceRegistry[event] = del(AceEvent_onceRegistry[event])
|
||||
end
|
||||
end
|
||||
local AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
if AceEvent_throttleRegistry and AceEvent_throttleRegistry[event] and AceEvent_throttleRegistry[event][self] then
|
||||
AceEvent_throttleRegistry[event][self] = del(AceEvent_throttleRegistry[event][self])
|
||||
if not next(AceEvent_throttleRegistry[event]) then
|
||||
AceEvent_throttleRegistry[event] = del(AceEvent_throttleRegistry[event])
|
||||
end
|
||||
end
|
||||
if not next(AceEvent_registry[event]) then
|
||||
AceEvent_registry[event] = del(AceEvent_registry[event])
|
||||
if not AceEvent_registry[ALL_EVENTS] or not next(AceEvent_registry[ALL_EVENTS]) then
|
||||
AceEvent.frame:UnregisterEvent(event)
|
||||
end
|
||||
end
|
||||
else
|
||||
if self == AceEvent then
|
||||
error(string.format("Cannot unregister event %q. Improperly unregistering from AceEvent-2.0.", event), 2)
|
||||
else
|
||||
AceEvent:error("Cannot unregister event %q. %q is not registered with it.", event, self)
|
||||
end
|
||||
end
|
||||
AceEvent:TriggerEvent("AceEvent_EventUnregistered", self, event)
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterAllEvents()
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if AceEvent_registry[ALL_EVENTS] and AceEvent_registry[ALL_EVENTS][self] then
|
||||
AceEvent_registry[ALL_EVENTS][self] = nil
|
||||
if not next(AceEvent_registry[ALL_EVENTS]) then
|
||||
del(AceEvent_registry[ALL_EVENTS])
|
||||
AceEvent.frame:UnregisterAllEvents()
|
||||
for k,v in pairs(AceEvent_registry) do
|
||||
if k ~= ALL_EVENTS then
|
||||
AceEvent.frame:RegisterEvent(k)
|
||||
end
|
||||
end
|
||||
AceEvent_registry[event] = nil
|
||||
end
|
||||
end
|
||||
local first = true
|
||||
for event, data in pairs(AceEvent_registry) do
|
||||
if first then
|
||||
if AceEvent_registry.AceEvent_EventUnregistered then
|
||||
event = "AceEvent_EventUnregistered"
|
||||
else
|
||||
first = false
|
||||
end
|
||||
end
|
||||
local x = data[self]
|
||||
data[self] = nil
|
||||
if x and event ~= ALL_EVENTS then
|
||||
if not next(data) then
|
||||
del(data)
|
||||
if not AceEvent_registry[ALL_EVENTS] or not next(AceEvent_registry[ALL_EVENTS]) then
|
||||
AceEvent.frame:UnregisterEvent(event)
|
||||
end
|
||||
AceEvent_registry[event] = nil
|
||||
end
|
||||
AceEvent:TriggerEvent("AceEvent_EventUnregistered", self, event)
|
||||
end
|
||||
if first then
|
||||
event = nil
|
||||
end
|
||||
end
|
||||
if AceEvent.onceRegistry then
|
||||
for event, data in pairs(AceEvent.onceRegistry) do
|
||||
data[self] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:CancelAllScheduledEvents()
|
||||
if delayRegistry then
|
||||
for k,v in pairs(delayRegistry) do
|
||||
if v.self == self then
|
||||
delayRegistry[k] = del(v)
|
||||
end
|
||||
end
|
||||
if not next(delayRegistry) then
|
||||
AceEvent.frame:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:IsEventRegistered(event)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if self == AceEvent then
|
||||
return AceEvent_registry[event] and next(AceEvent_registry[event]) and true or false
|
||||
end
|
||||
if AceEvent_registry[event] and AceEvent_registry[event][self] then
|
||||
return true, AceEvent_registry[event][self]
|
||||
end
|
||||
return false, nil
|
||||
end
|
||||
|
||||
local bucketfunc
|
||||
function AceEvent:RegisterBucketEvent(event, delay, method)
|
||||
AceEvent:argCheck(event, 2, "string", "table")
|
||||
if type(event) == "table" then
|
||||
for k,v in pairs(event) do
|
||||
if type(k) ~= "number" then
|
||||
AceEvent:error("All keys to argument #2 to `RegisterBucketEvent' must be numbers.")
|
||||
elseif type(v) ~= "string" then
|
||||
AceEvent:error("All values to argument #2 to `RegisterBucketEvent' must be strings.")
|
||||
end
|
||||
end
|
||||
end
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
if AceEvent == self then
|
||||
AceEvent:argCheck(method, 4, "function")
|
||||
self = method
|
||||
else
|
||||
if type(event) == "string" then
|
||||
AceEvent:argCheck(method, 4, "string", "function", "nil")
|
||||
if not method then
|
||||
method = event
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(method, 4, "string", "function")
|
||||
end
|
||||
|
||||
if type(method) == "string" and type(self[method]) ~= "function" then
|
||||
AceEvent:error("Cannot register event %q to method %q, it does not exist", event, method)
|
||||
end
|
||||
end
|
||||
if not AceEvent.buckets then
|
||||
AceEvent.buckets = new()
|
||||
end
|
||||
if not AceEvent.buckets[event] then
|
||||
AceEvent.buckets[event] = new()
|
||||
end
|
||||
if not AceEvent.buckets[event][self] then
|
||||
AceEvent.buckets[event][self] = new()
|
||||
AceEvent.buckets[event][self].current = new()
|
||||
AceEvent.buckets[event][self].self = self
|
||||
else
|
||||
AceEvent.CancelScheduledEvent(self, AceEvent.buckets[event][self].id)
|
||||
end
|
||||
local bucket = AceEvent.buckets[event][self]
|
||||
bucket.method = method
|
||||
|
||||
local func = function(arg1)
|
||||
bucket.run = true
|
||||
if arg1 then
|
||||
bucket.current[arg1] = true
|
||||
end
|
||||
end
|
||||
AceEvent.buckets[event][self].func = func
|
||||
if type(event) == "string" then
|
||||
AceEvent.RegisterEvent(self, event, func)
|
||||
else
|
||||
for _,v in ipairs(event) do
|
||||
AceEvent.RegisterEvent(self, v, func)
|
||||
end
|
||||
end
|
||||
if not bucketfunc then
|
||||
bucketfunc = function(bucket)
|
||||
local current = bucket.current
|
||||
local method = bucket.method
|
||||
local self = bucket.self
|
||||
if bucket.run then
|
||||
if type(method) == "string" then
|
||||
self[method](self, current)
|
||||
elseif method then -- function
|
||||
method(current)
|
||||
end
|
||||
for k in pairs(current) do
|
||||
current[k] = nil
|
||||
k = nil
|
||||
end
|
||||
bucket.run = false
|
||||
end
|
||||
end
|
||||
end
|
||||
bucket.id = AceEvent.ScheduleRepeatingEvent(self, bucketfunc, delay, bucket)
|
||||
end
|
||||
|
||||
function AceEvent:IsBucketEventRegistered(event)
|
||||
AceEvent:argCheck(event, 2, "string", "table")
|
||||
return AceEvent.buckets and AceEvent.buckets[event] and AceEvent.buckets[event][self]
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterBucketEvent(event)
|
||||
AceEvent:argCheck(event, 2, "string", "table")
|
||||
if not AceEvent.buckets or not AceEvent.buckets[event] or not AceEvent.buckets[event][self] then
|
||||
AceEvent:error("Cannot unregister bucket event %q. %q is not registered with it.", event, self)
|
||||
end
|
||||
|
||||
local bucket = AceEvent.buckets[event][self]
|
||||
|
||||
if type(event) == "string" then
|
||||
AceEvent.UnregisterEvent(self, event)
|
||||
else
|
||||
for _,v in ipairs(event) do
|
||||
AceEvent.UnregisterEvent(self, v)
|
||||
end
|
||||
end
|
||||
AceEvent:CancelScheduledEvent(bucket.id)
|
||||
|
||||
del(bucket.current)
|
||||
AceEvent.buckets[event][self] = del(AceEvent.buckets[event][self])
|
||||
if not next(AceEvent.buckets[event]) then
|
||||
AceEvent.buckets[event] = del(AceEvent.buckets[event])
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterAllBucketEvents()
|
||||
if not AceEvent.buckets or not next(AceEvent.buckets) then
|
||||
return
|
||||
end
|
||||
for k,v in pairs(AceEvent.buckets) do
|
||||
if v == self then
|
||||
AceEvent.UnregisterBucketEvent(self, k)
|
||||
k = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:OnEmbedDisable(target)
|
||||
self.UnregisterAllEvents(target)
|
||||
|
||||
self.CancelAllScheduledEvents(target)
|
||||
|
||||
self.UnregisterAllBucketEvents(target)
|
||||
end
|
||||
|
||||
function AceEvent:EnableDebugging()
|
||||
if not self.debugTable then
|
||||
self.debugTable = new()
|
||||
|
||||
if delayRegistry then
|
||||
for k,v in pairs(self.delayRegistry) do
|
||||
if not v.mem then
|
||||
v.mem = 0
|
||||
v.count = 0
|
||||
v.timeSpent = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:IsFullyInitialized()
|
||||
return self.postInit or false
|
||||
end
|
||||
|
||||
function AceEvent:IsPostPlayerLogin()
|
||||
return self.playerLogin or false
|
||||
end
|
||||
|
||||
function AceEvent:activate(oldLib, oldDeactivate)
|
||||
AceEvent = self
|
||||
|
||||
if oldLib then
|
||||
self.onceRegistry = oldLib.onceRegistry
|
||||
self.throttleRegistry = oldLib.throttleRegistry
|
||||
self.delayRegistry = oldLib.delayRegistry
|
||||
self.buckets = oldLib.buckets
|
||||
self.registry = oldLib.registry
|
||||
self.frame = oldLib.frame
|
||||
self.debugTable = oldLib.debugTable
|
||||
self.playerLogin = oldLib.pew or DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage and true
|
||||
self.postInit = oldLib.postInit or self.playerLogin and ChatTypeInfo and ChatTypeInfo.WHISPER and ChatTypeInfo.WHISPER.r and true
|
||||
self.ALL_EVENTS = oldLib.ALL_EVENTS
|
||||
self.FAKE_NIL = oldLib.FAKE_NIL
|
||||
self.RATE = oldLib.RATE
|
||||
end
|
||||
if not self.registry then
|
||||
self.registry = {}
|
||||
end
|
||||
if not self.frame then
|
||||
self.frame = CreateFrame("Frame", "AceEvent20Frame")
|
||||
end
|
||||
if not self.ALL_EVENTS then
|
||||
self.ALL_EVENTS = {}
|
||||
end
|
||||
if not self.FAKE_NIL then
|
||||
self.FAKE_NIL = {}
|
||||
end
|
||||
if not self.RATE then
|
||||
self.RATE = {}
|
||||
end
|
||||
ALL_EVENTS = self.ALL_EVENTS
|
||||
FAKE_NIL = self.FAKE_NIL
|
||||
RATE = self.RATE
|
||||
local inPlw = false
|
||||
local blacklist = {
|
||||
UNIT_INVENTORY_CHANGED = true,
|
||||
BAG_UPDATE = true,
|
||||
ITEM_LOCK_CHANGED = true,
|
||||
ACTIONBAR_SLOT_CHANGED = true,
|
||||
}
|
||||
self.frame:SetScript("OnEvent", function()
|
||||
local event = event
|
||||
if event == "PLAYER_ENTERING_WORLD" then
|
||||
inPlw = false
|
||||
elseif event == "PLAYER_LEAVING_WORLD" then
|
||||
inPlw = true
|
||||
end
|
||||
if event and (not inPlw or not blacklist[event]) then
|
||||
self:TriggerEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
|
||||
end
|
||||
end)
|
||||
if self.delayRegistry then
|
||||
delayRegistry = self.delayRegistry
|
||||
self.frame:SetScript("OnUpdate", OnUpdate)
|
||||
end
|
||||
|
||||
self:UnregisterAllEvents()
|
||||
self:CancelAllScheduledEvents()
|
||||
|
||||
registeringFromAceEvent = true
|
||||
self:RegisterEvent("LOOT_OPENED", function()
|
||||
SendAddonMessage("LOOT_OPENED", "", "RAID")
|
||||
end)
|
||||
registeringFromAceEvent = nil
|
||||
|
||||
if not self.playerLogin then
|
||||
registeringFromAceEvent = true
|
||||
self:RegisterEvent("PLAYER_LOGIN", function()
|
||||
self.playerLogin = true
|
||||
end, true)
|
||||
registeringFromAceEvent = nil
|
||||
end
|
||||
|
||||
if not self.postInit then
|
||||
local isReload = true
|
||||
local function func()
|
||||
self.postInit = true
|
||||
self:TriggerEvent("AceEvent_FullyInitialized")
|
||||
if self.registry["CHAT_MSG_CHANNEL_NOTICE"] and self.registry["CHAT_MSG_CHANNEL_NOTICE"][self] then
|
||||
self:UnregisterEvent("CHAT_MSG_CHANNEL_NOTICE")
|
||||
end
|
||||
if self.registry["MEETINGSTONE_CHANGED"] and self.registry["MEETINGSTONE_CHANGED"][self] then
|
||||
self:UnregisterEvent("MEETINGSTONE_CHANGED")
|
||||
end
|
||||
if self.registry["MINIMAP_ZONE_CHANGED"] and self.registry["MINIMAP_ZONE_CHANGED"][self] then
|
||||
self:UnregisterEvent("MINIMAP_ZONE_CHANGED")
|
||||
end
|
||||
if self.registry["LANGUAGE_LIST_CHANGED"] and self.registry["LANGUAGE_LIST_CHANGED"][self] then
|
||||
self:UnregisterEvent("LANGUAGE_LIST_CHANGED")
|
||||
end
|
||||
end
|
||||
registeringFromAceEvent = true
|
||||
local f = function()
|
||||
self.playerLogin = true
|
||||
self:ScheduleEvent("AceEvent_FullyInitialized", func, 1)
|
||||
end
|
||||
self:RegisterEvent("MEETINGSTONE_CHANGED", f, true)
|
||||
self:RegisterEvent("CHAT_MSG_CHANNEL_NOTICE", function()
|
||||
self:ScheduleEvent("AceEvent_FullyInitialized", func, 0.05)
|
||||
end)
|
||||
self:RegisterEvent("LANGUAGE_LIST_CHANGED", function()
|
||||
if self.registry["MEETINGSTONE_CHANGED"] and self.registry["MEETINGSTONE_CHANGED"][self] then
|
||||
registeringFromAceEvent = true
|
||||
self:UnregisterEvent("MEETINGSTONE_CHANGED")
|
||||
self:RegisterEvent("MINIMAP_ZONE_CHANGED", f, true)
|
||||
registeringFromAceEvent = nil
|
||||
end
|
||||
end)
|
||||
self:ScheduleEvent("AceEvent_FullyInitialized", func, 10)
|
||||
registeringFromAceEvent = nil
|
||||
end
|
||||
|
||||
self.super.activate(self, oldLib, oldDeactivate)
|
||||
if oldLib then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceEvent, MAJOR_VERSION, MINOR_VERSION, AceEvent.activate)
|
||||
AceEvent = AceLibrary(MAJOR_VERSION)
|
||||
@@ -1,569 +0,0 @@
|
||||
--[[
|
||||
Name: AceHook-2.1
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceHook-2.1
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceHook-2.1
|
||||
Description: Mixin to allow for safe hooking of functions, methods, and scripts.
|
||||
Dependencies: AceLibrary, AceOO-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceHook-2.1"
|
||||
local MINOR_VERSION = "$Revision: 17638 $"
|
||||
|
||||
-- This ensures the code is only executed if the libary doesn't already exist, or is a newer version
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
--[[---------------------------------------------------------------------------------
|
||||
Create the library object
|
||||
----------------------------------------------------------------------------------]]
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local AceHook = AceOO.Mixin {
|
||||
"Hook",
|
||||
"HookScript",
|
||||
"SecureHook",
|
||||
"Unhook",
|
||||
"UnhookAll",
|
||||
"HookReport",
|
||||
"IsHooked",
|
||||
}
|
||||
|
||||
--[[---------------------------------------------------------------------------------
|
||||
Library Definitions
|
||||
----------------------------------------------------------------------------------]]
|
||||
|
||||
local protFuncs = {
|
||||
CameraOrSelectOrMoveStart = true, CameraOrSelectOrMoveStop = true,
|
||||
TurnOrActionStart = true, TurnOrActionStop = true,
|
||||
PitchUpStart = true, PitchUpStop = true,
|
||||
PitchDownStart = true, PitchDownStop = true,
|
||||
MoveBackwardStart = true, MoveBackwardStop = true,
|
||||
MoveForwardStart = true, MoveForwardStop = true,
|
||||
Jump = true, StrafeLeftStart = true,
|
||||
StrafeLeftStop = true, StrafeRightStart = true,
|
||||
StrafeRightStop = true, ToggleMouseMove = true,
|
||||
ToggleRun = true, TurnLeftStart = true,
|
||||
TurnLeftStop = true, TurnRightStart = true,
|
||||
TurnRightStop = true,
|
||||
}
|
||||
|
||||
local function issecurevariable(x)
|
||||
if protFuncs[x] then
|
||||
return 1
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local _G = getfenv(0)
|
||||
|
||||
local function hooksecurefunc(arg1, arg2, arg3)
|
||||
if type(arg1) == "string" then
|
||||
arg1, arg2, arg3 = _G, arg1, arg2
|
||||
end
|
||||
local orig = arg1[arg2]
|
||||
arg1[arg2] = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
local x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20 = orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
|
||||
arg3(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
|
||||
return x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20
|
||||
end
|
||||
end
|
||||
|
||||
local protectedScripts = {
|
||||
OnClick = true,
|
||||
}
|
||||
|
||||
|
||||
local handlers, scripts, actives, registry
|
||||
|
||||
--[[---------------------------------------------------------------------------------
|
||||
Private definitions (Not exposed)
|
||||
----------------------------------------------------------------------------------]]
|
||||
|
||||
local new, del
|
||||
do
|
||||
local list = setmetatable({}, {__mode = "k"})
|
||||
function new()
|
||||
local t = next(list)
|
||||
if not t then
|
||||
return {}
|
||||
end
|
||||
list[t] = nil
|
||||
return t
|
||||
end
|
||||
|
||||
function del(t)
|
||||
setmetatable(t, nil)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
list[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
local function createFunctionHook(self, func, handler, orig, secure)
|
||||
if not secure then
|
||||
if type(handler) == "string" then
|
||||
-- The handler is a method, need to self it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
else
|
||||
-- secure hooks don't call the original method
|
||||
if type(handler) == "string" then
|
||||
-- The handler is a method, need to self it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function createMethodHook(self, object, method, handler, orig, secure, script)
|
||||
if script then
|
||||
if type(handler) == "string" then
|
||||
local uid
|
||||
uid = function()
|
||||
if actives[uid] then
|
||||
return self[handler](self, object)
|
||||
else
|
||||
return orig()
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function()
|
||||
if actives[uid] then
|
||||
return handler(object)
|
||||
else
|
||||
return orig()
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
elseif not secure then
|
||||
if type(handler) == "string" then
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
else
|
||||
-- secure hooks don't call the original method
|
||||
if type(handler) == "string" then
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function hookFunction(self, func, handler, secure)
|
||||
local orig = _G[func]
|
||||
|
||||
if not orig or type(orig) ~= "function" then
|
||||
AceHook:error("Attempt to hook a non-existant function %q", func)
|
||||
end
|
||||
|
||||
if not handler then
|
||||
handler = func
|
||||
end
|
||||
|
||||
if registry[self][func] then
|
||||
local uid = registry[self][func]
|
||||
|
||||
if actives[uid] then
|
||||
-- We have an active hook from this source. Don't multi-hook
|
||||
AceHook:error("%q already has an active hook from this source.", func)
|
||||
end
|
||||
|
||||
if handlers[uid] == handler then
|
||||
-- The hook is inactive, so reactivate it
|
||||
actives[uid] = true
|
||||
return
|
||||
else
|
||||
AceHook:error("There is a stale hook for %q can't hook or reactivate.", func)
|
||||
end
|
||||
end
|
||||
|
||||
if type(handler) == "string" then
|
||||
if type(self[handler]) ~= "function" then
|
||||
AceHook:error("Could not find the the handler %q when hooking function %q", handler, func)
|
||||
end
|
||||
elseif type(handler) ~= "function" then
|
||||
AceHook:error("Could not find the handler you supplied when hooking %q", func)
|
||||
end
|
||||
|
||||
local uid = createFunctionHook(self, func, handler, orig, secure)
|
||||
registry[self][func] = uid
|
||||
actives[uid] = true
|
||||
handlers[uid] = handler
|
||||
|
||||
if not secure then
|
||||
_G[func] = uid
|
||||
self.hooks[func] = orig
|
||||
else
|
||||
hooksecurefunc(func, uid)
|
||||
end
|
||||
end
|
||||
|
||||
local function unhookFunction(self, func)
|
||||
if not registry[self][func] then
|
||||
AceHook:error("Tried to unhook %q which is not currently hooked.", func)
|
||||
end
|
||||
|
||||
local uid = registry[self][func]
|
||||
|
||||
if actives[uid] then
|
||||
-- See if we own the global function
|
||||
if self.hooks[func] and _G[func] == uid then
|
||||
_G[func] = self.hooks[func]
|
||||
self.hooks[func] = nil
|
||||
registry[self][func] = nil
|
||||
handlers[uid] = nil
|
||||
scripts[uid] = nil
|
||||
actives[uid] = nil
|
||||
-- Magically all-done
|
||||
else
|
||||
actives[uid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function hookMethod(self, obj, method, handler, script, secure)
|
||||
if not handler then
|
||||
handler = method
|
||||
end
|
||||
|
||||
if not obj or type(obj) ~= "table" then
|
||||
AceHook:error("The object you supplied could not be found, or isn't a table.")
|
||||
end
|
||||
|
||||
local uid = registry[self][obj] and registry[self][obj][method]
|
||||
if uid then
|
||||
if actives[uid] then
|
||||
-- We have an active hook from this source. Don't multi-hook
|
||||
AceHook:error("%q already has an active hook from this source.", method)
|
||||
end
|
||||
|
||||
if handlers[uid] == handler then
|
||||
-- The hook is inactive, reactivate it.
|
||||
actives[uid] = true
|
||||
return
|
||||
else
|
||||
AceHook:error("There is a stale hook for %q can't hook or reactivate.", method)
|
||||
end
|
||||
end
|
||||
|
||||
if type(handler) == "string" then
|
||||
if type(self[handler]) ~= "function" then
|
||||
AceHook:error("Could not find the handler %q you supplied when hooking method %q", handler, method)
|
||||
end
|
||||
elseif type(handler) ~= "function" then
|
||||
AceHook:error("Could not find the handler you supplied when hooking method %q", method)
|
||||
end
|
||||
|
||||
local orig
|
||||
if script then
|
||||
if not obj.GetScript then
|
||||
AceHook:error("The object you supplied does not have a GetScript method.")
|
||||
end
|
||||
if not obj:HasScript(method) then
|
||||
AceHook:error("The object you supplied doesn't allow the %q method.", method)
|
||||
end
|
||||
|
||||
orig = obj:GetScript(method)
|
||||
if type(orig) ~= "function" then
|
||||
-- Sometimes there is not a original function for a script.
|
||||
orig = function() end
|
||||
end
|
||||
else
|
||||
orig = obj[method]
|
||||
end
|
||||
if not orig then
|
||||
AceHook:error("Could not find the method or script %q you are trying to hook.", method)
|
||||
end
|
||||
|
||||
if not registry[self][obj] then
|
||||
registry[self][obj] = new()
|
||||
end
|
||||
|
||||
if not self.hooks[obj] then
|
||||
self.hooks[obj] = new()
|
||||
end
|
||||
|
||||
local uid = createMethodHook(self, obj, method, handler, orig, secure, script)
|
||||
registry[self][obj][method] = uid
|
||||
actives[uid] = true
|
||||
handlers[uid] = handler
|
||||
scripts[uid] = script and true or nil
|
||||
|
||||
if script then
|
||||
obj:SetScript(method, uid)
|
||||
self.hooks[obj][method] = orig
|
||||
elseif not secure then
|
||||
obj[method] = uid
|
||||
self.hooks[obj][method] = orig
|
||||
else
|
||||
hooksecurefunc(obj, method, uid)
|
||||
end
|
||||
end
|
||||
|
||||
local function unhookMethod(self, obj, method)
|
||||
if not registry[self][obj] or not registry[self][obj][method] then
|
||||
AceHook:error("Attempt to unhook a method %q that is not currently hooked.", method)
|
||||
return
|
||||
end
|
||||
|
||||
local uid = registry[self][obj][method]
|
||||
|
||||
if actives[uid] then
|
||||
if scripts[uid] then -- If this is a script
|
||||
if obj:GetScript(method) == uid then
|
||||
-- We own the script. Revert to normal.
|
||||
obj:SetScript(method, self.hooks[obj][method])
|
||||
self.hooks[obj][method] = nil
|
||||
registry[self][obj][method] = nil
|
||||
handlers[uid] = nil
|
||||
scripts[uid] = nil
|
||||
actives[uid] = nil
|
||||
else
|
||||
actives[uid] = nil
|
||||
end
|
||||
else
|
||||
if self.hooks[obj] and self.hooks[obj][method] and obj[method] == uid then
|
||||
-- We own the method. Revert to normal.
|
||||
obj[method] = self.hooks[obj][method]
|
||||
self.hooks[obj][method] = nil
|
||||
registry[self][obj][method] = nil
|
||||
handlers[uid] = nil
|
||||
actives[uid] = nil
|
||||
else
|
||||
actives[uid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.hooks[obj] and not next(self.hooks[obj]) then
|
||||
self.hooks[obj] = del(self.hooks[obj])
|
||||
end
|
||||
if not next(registry[self][obj]) then
|
||||
registry[self][obj] = del(registry[self][obj])
|
||||
end
|
||||
end
|
||||
|
||||
-- ("function" [, handler] [, hookSecure]) or (object, "method" [, handler] [, hookSecure])
|
||||
function AceHook:Hook(object, method, handler, hookSecure)
|
||||
if type(object) == "string" then
|
||||
method, handler, hookSecure = object, method, handler
|
||||
if handler == true then
|
||||
handler, hookSecure = nil, true
|
||||
end
|
||||
if not hookSecure and issecurevariable(method) then
|
||||
AceHook:error("Attempt to hook secure function %q. Use `SecureHook' or add `true' to the argument list to override.", method)
|
||||
end
|
||||
AceHook:argCheck(handler, 3, "function", "string", "nil")
|
||||
AceHook:argCheck(hookSecure, 4, "boolean", "nil")
|
||||
hookFunction(self, method, handler, false)
|
||||
else
|
||||
if handler == true then
|
||||
handler, hookSecure = nil, true
|
||||
end
|
||||
if not hookSecure and issecurevariable(object, method) then
|
||||
AceHook:error("Attempt to hook secure method %q. Use `SecureHook' or add `true' to the argument list to override.", method)
|
||||
end
|
||||
AceHook:argCheck(object, 2, "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
AceHook:argCheck(handler, 4, "function", "string", "nil")
|
||||
AceHook:argCheck(hookSecure, 5, "boolean", "nil")
|
||||
hookMethod(self, object, method, handler, false, false)
|
||||
end
|
||||
end
|
||||
|
||||
-- ("function", handler) or (object, "method", handler)
|
||||
function AceHook:SecureHook(object, method, handler)
|
||||
if type(object) == "string" then
|
||||
method, handler = object, method
|
||||
AceHook:argCheck(handler, 3, "function", "string", "nil")
|
||||
hookFunction(self, method, handler, true)
|
||||
else
|
||||
AceHook:argCheck(object, 2, "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
AceHook:argCheck(handler, 4, "function", "string", "nil")
|
||||
hookMethod(self, object, method, handler, false, true)
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:HookScript(frame, script, handler)
|
||||
AceHook:argCheck(frame, 2, "table")
|
||||
if not frame[0] or type(frame.IsFrameType) ~= "function" then
|
||||
AceHook:error("Bad argument #2 to `HookScript'. Expected frame.")
|
||||
end
|
||||
AceHook:argCheck(script, 3, "string")
|
||||
AceHook:argCheck(handler, 4, "function", "string", "nil")
|
||||
hookMethod(self, frame, script, handler, true, false)
|
||||
end
|
||||
|
||||
-- ("function") or (object, "method")
|
||||
function AceHook:IsHooked(obj, method)
|
||||
if type(obj) == "string" then
|
||||
if registry[self][obj] and actives[registry[self][obj]] then
|
||||
return true, handlers[registry[self][obj]]
|
||||
end
|
||||
else
|
||||
AceHook:argCheck(obj, 2, "string", "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
if registry[self][obj] and registry[self][obj][method] and actives[registry[self][obj][method]] then
|
||||
return true, handlers[registry[self][obj][method]]
|
||||
end
|
||||
end
|
||||
|
||||
return false, nil
|
||||
end
|
||||
|
||||
-- ("function") or (object, "method")
|
||||
function AceHook:Unhook(obj, method)
|
||||
if type(obj) == "string" then
|
||||
unhookFunction(self, obj)
|
||||
else
|
||||
AceHook:argCheck(obj, 2, "string", "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
unhookMethod(self, obj, method)
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:UnhookAll()
|
||||
for key, value in pairs(registry[self]) do
|
||||
if type(key) == "table" then
|
||||
for method in pairs(value) do
|
||||
self:Unhook(key, method)
|
||||
end
|
||||
else
|
||||
self:Unhook(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:HookReport()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("This is a list of all active hooks for this object:")
|
||||
if not next(registry[self]) then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("No hooks")
|
||||
end
|
||||
|
||||
for key, value in pairs(registry[self]) do
|
||||
if type(value) == "table" then
|
||||
for method, uid in pairs(value) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("object: %s method: %q |cff%s|r%s", tostring(key), method, actives[uid] and "00ff00Active" or "ffff00Inactive", not self.hooks[key][method] and " |cff7f7fff-Secure-|r" or ""))
|
||||
end
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("function: %q |cff%s|r%s", tostring(key), actives[value] and "00ff00Active" or "ffff00Inactive", not self.hooks[key] and " |cff7f7fff-Secure-|r" or ""))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:OnInstanceInit(object)
|
||||
if not object.hooks then
|
||||
object.hooks = new()
|
||||
end
|
||||
if not registry[object] then
|
||||
registry[object] = new()
|
||||
end
|
||||
end
|
||||
|
||||
AceHook.OnManualEmbed = AceHook.OnInstanceInit
|
||||
|
||||
function AceHook:OnEmbedDisable(target)
|
||||
self.UnhookAll(target)
|
||||
end
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
AceHook = self
|
||||
|
||||
self.handlers = oldLib and oldLib.handlers or {}
|
||||
self.registry = oldLib and oldLib.registry or {}
|
||||
self.scripts = oldLib and oldLib.scripts or {}
|
||||
self.actives = oldLib and oldLib.actives or {}
|
||||
|
||||
handlers = self.handlers
|
||||
registry = self.registry
|
||||
scripts = self.scripts
|
||||
actives = self.actives
|
||||
|
||||
AceHook.super.activate(self, oldLib, oldDeactivate)
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceHook, MAJOR_VERSION, MINOR_VERSION, activate)
|
||||
@@ -1,757 +0,0 @@
|
||||
--[[
|
||||
Name: AceLibrary
|
||||
Revision: $Rev: 17722 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Iriel (iriel@vigilance-committee.org)
|
||||
Tekkub (tekkub@gmail.com)
|
||||
Revision: $Rev: 17722 $
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceLibrary
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceLibrary
|
||||
Description: Versioning library to handle other library instances, upgrading,
|
||||
and proper access.
|
||||
It also provides a base for libraries to work off of, providing
|
||||
proper error tools. It is handy because all the errors occur in the
|
||||
file that called it, not in the library file itself.
|
||||
Dependencies: None
|
||||
]]
|
||||
|
||||
local ACELIBRARY_MAJOR = "AceLibrary"
|
||||
local ACELIBRARY_MINOR = "$Revision: 17722 $"
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary and AceLibrary:HasInstance(ACELIBRARY_MAJOR) then return end -- lua51 check
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local string_gfind = string.gmatch or string.gfind
|
||||
|
||||
local _G = getfenv(0)
|
||||
local previous = _G[ACELIBRARY_MAJOR]
|
||||
if previous and not previous:IsNewVersion(ACELIBRARY_MAJOR, ACELIBRARY_MINOR) then return end
|
||||
|
||||
local function safecall(func,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
local success, err = pcall(func,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
if not success then geterrorhandler()(err) end
|
||||
end
|
||||
|
||||
-- @table AceLibrary
|
||||
-- @brief System to handle all versioning of libraries.
|
||||
local AceLibrary = {}
|
||||
local AceLibrary_mt = {}
|
||||
setmetatable(AceLibrary, AceLibrary_mt)
|
||||
|
||||
local tmp
|
||||
local function error(self, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if type(self) ~= "table" then
|
||||
_G.error(string.format("Bad argument #1 to `error' (table expected, got %s)", type(self)), 2)
|
||||
end
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
else
|
||||
for k in pairs(tmp) do tmp[k] = nil end
|
||||
table_setn(tmp, 0)
|
||||
end
|
||||
|
||||
table.insert(tmp, a1)
|
||||
table.insert(tmp, a2)
|
||||
table.insert(tmp, a3)
|
||||
table.insert(tmp, a4)
|
||||
table.insert(tmp, a5)
|
||||
table.insert(tmp, a6)
|
||||
table.insert(tmp, a7)
|
||||
table.insert(tmp, a8)
|
||||
table.insert(tmp, a9)
|
||||
table.insert(tmp, a10)
|
||||
table.insert(tmp, a11)
|
||||
table.insert(tmp, a12)
|
||||
table.insert(tmp, a13)
|
||||
table.insert(tmp, a14)
|
||||
table.insert(tmp, a15)
|
||||
table.insert(tmp, a16)
|
||||
table.insert(tmp, a17)
|
||||
table.insert(tmp, a18)
|
||||
table.insert(tmp, a19)
|
||||
table.insert(tmp, a20)
|
||||
|
||||
local stack = debugstack()
|
||||
if not message then
|
||||
local _,_,second = string.find(stack, "\n(.-)\n")
|
||||
message = "error raised! " .. second
|
||||
else
|
||||
for i = 1,table.getn(tmp) do
|
||||
tmp[i] = tostring(tmp[i])
|
||||
end
|
||||
for i = 1,10 do
|
||||
table.insert(tmp, "nil")
|
||||
end
|
||||
message = string.format(message, unpack(tmp))
|
||||
end
|
||||
|
||||
if getmetatable(self) and getmetatable(self).__tostring then
|
||||
message = string.format("%s: %s", tostring(self), message)
|
||||
elseif type(rawget(self, 'GetLibraryVersion')) == "function" and AceLibrary:HasInstance(self:GetLibraryVersion()) then
|
||||
message = string.format("%s: %s", self:GetLibraryVersion(), message)
|
||||
elseif type(rawget(self, 'class')) == "table" and type(rawget(self.class, 'GetLibraryVersion')) == "function" and AceLibrary:HasInstance(self.class:GetLibraryVersion()) then
|
||||
message = string.format("%s: %s", self.class:GetLibraryVersion(), message)
|
||||
end
|
||||
|
||||
local first = string.gsub(stack, "\n.*", "")
|
||||
local file = string.gsub(first, ".*\\(.*).lua:%d+: .*", "%1")
|
||||
file = string.gsub(file, "([%(%)%.%*%+%-%[%]%?%^%$%%])", "%%%1")
|
||||
|
||||
local i = 0
|
||||
for s in string_gfind(stack, "\n([^\n]*)") do
|
||||
i = i + 1
|
||||
if not string.find(s, file .. "%.lua:%d+:") then
|
||||
file = string.gsub(s, "^.*\\(.*).lua:%d+: .*", "%1")
|
||||
file = string.gsub(file, "([%(%)%.%*%+%-%[%]%?%^%$%%])", "%%%1")
|
||||
break
|
||||
end
|
||||
end
|
||||
local j = 0
|
||||
for s in string_gfind(stack, "\n([^\n]*)") do
|
||||
j = j + 1
|
||||
if j > i and not string.find(s, file .. "%.lua:%d+:") then
|
||||
_G.error(message, j + 1)
|
||||
return
|
||||
end
|
||||
end
|
||||
_G.error(message, 2)
|
||||
return
|
||||
end
|
||||
|
||||
local function assert(self, condition, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not condition then
|
||||
if not message then
|
||||
local stack = debugstack()
|
||||
local _,_,second = string.find(stack, "\n(.-)\n")
|
||||
message = "assertion failed! " .. second
|
||||
end
|
||||
error(self, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
return
|
||||
end
|
||||
return condition
|
||||
end
|
||||
|
||||
local function argCheck(self, arg, num, kind, kind2, kind3, kind4, kind5)
|
||||
if type(num) ~= "number" then
|
||||
error(self, "Bad argument #3 to `argCheck' (number expected, got %s)", type(num))
|
||||
elseif type(kind) ~= "string" then
|
||||
error(self, "Bad argument #4 to `argCheck' (string expected, got %s)", type(kind))
|
||||
end
|
||||
local errored = false
|
||||
arg = type(arg)
|
||||
if arg ~= kind and arg ~= kind2 and arg ~= kind3 and arg ~= kind4 and arg ~= kind5 then
|
||||
local _,_,func = string.find(debugstack(), "`argCheck'.-([`<].-['>])")
|
||||
if not func then
|
||||
_,_,func = string.find(debugstack(), "([`<].-['>])")
|
||||
end
|
||||
if kind5 then
|
||||
error(self, "Bad argument #%s to %s (%s, %s, %s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, kind4, kind5, arg)
|
||||
elseif kind4 then
|
||||
error(self, "Bad argument #%s to %s (%s, %s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, kind4, arg)
|
||||
elseif kind3 then
|
||||
error(self, "Bad argument #%s to %s (%s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, arg)
|
||||
elseif kind2 then
|
||||
error(self, "Bad argument #%s to %s (%s or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, arg)
|
||||
else
|
||||
error(self, "Bad argument #%s to %s (%s expected, got %s)", tonumber(num) or 0/0, func, kind, arg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function pcall(self, func, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20 = _G.pcall(func, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not a1 then
|
||||
error(self, string.gsub(a2, ".-%.lua:%d-: ", ""))
|
||||
else
|
||||
return a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20
|
||||
end
|
||||
end
|
||||
|
||||
local recurse = {}
|
||||
local function addToPositions(t, major)
|
||||
if not AceLibrary.positions[t] or AceLibrary.positions[t] == major then
|
||||
rawset(t, recurse, true)
|
||||
AceLibrary.positions[t] = major
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == "table" and not rawget(v, recurse) then
|
||||
addToPositions(v, major)
|
||||
end
|
||||
if type(k) == "table" and not rawget(k, recurse) then
|
||||
addToPositions(k, major)
|
||||
end
|
||||
end
|
||||
local mt = getmetatable(t)
|
||||
if mt and not rawget(mt, recurse) then
|
||||
addToPositions(mt, major)
|
||||
end
|
||||
rawset(t, recurse, nil)
|
||||
end
|
||||
end
|
||||
|
||||
local function svnRevisionToNumber(text)
|
||||
if type(text) == "string" then
|
||||
if string.find(text, "^%$Revision: (%d+) %$$") then
|
||||
return tonumber((string.gsub(text, "^%$Revision: (%d+) %$$", "%1")))
|
||||
elseif string.find(text, "^%$Rev: (%d+) %$$") then
|
||||
return tonumber((string.gsub(text, "^%$Rev: (%d+) %$$", "%1")))
|
||||
elseif string.find(text, "^%$LastChangedRevision: (%d+) %$$") then
|
||||
return tonumber((string.gsub(text, "^%$LastChangedRevision: (%d+) %$$", "%1")))
|
||||
end
|
||||
elseif type(text) == "number" then
|
||||
return text
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local crawlReplace
|
||||
do
|
||||
local recurse = {}
|
||||
local function func(t, to, from)
|
||||
if recurse[t] then
|
||||
return
|
||||
end
|
||||
recurse[t] = true
|
||||
local mt = getmetatable(t)
|
||||
setmetatable(t, nil)
|
||||
rawset(t, to, rawget(t, from))
|
||||
rawset(t, from, nil)
|
||||
for k,v in pairs(t) do
|
||||
if v == from then
|
||||
t[k] = to
|
||||
elseif type(v) == "table" then
|
||||
if not recurse[v] then
|
||||
func(v, to, from)
|
||||
end
|
||||
end
|
||||
|
||||
if type(k) == "table" then
|
||||
if not recurse[k] then
|
||||
func(k, to, from)
|
||||
end
|
||||
end
|
||||
end
|
||||
setmetatable(t, mt)
|
||||
if mt then
|
||||
if mt == from then
|
||||
setmetatable(t, to)
|
||||
elseif not recurse[mt] then
|
||||
func(mt, to, from)
|
||||
end
|
||||
end
|
||||
end
|
||||
function crawlReplace(t, to, from)
|
||||
func(t, to, from)
|
||||
for k in pairs(recurse) do
|
||||
recurse[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- @function destroyTable
|
||||
-- @brief remove all the contents of a table
|
||||
-- @param t table to destroy
|
||||
local function destroyTable(t)
|
||||
setmetatable(t, nil)
|
||||
for k,v in pairs(t) do t[k] = nil end
|
||||
table_setn(t, 0)
|
||||
end
|
||||
|
||||
local function isFrame(frame)
|
||||
return type(frame) == "table" and type(rawget(frame, 0)) == "userdata" and type(rawget(frame, 'IsFrameType')) == "function" and getmetatable(frame) and type(rawget(getmetatable(frame), '__index')) == "function"
|
||||
end
|
||||
|
||||
local new, del
|
||||
do
|
||||
local tables = setmetatable({}, {__mode = "k"})
|
||||
|
||||
function new()
|
||||
local t = next(tables)
|
||||
if t then
|
||||
tables[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function del(t, depth)
|
||||
if depth and depth > 0 then
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == "table" and not isFrame(v) then
|
||||
del(v, depth - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
destroyTable(t)
|
||||
tables[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- @function copyTable
|
||||
-- @brief Create a shallow copy of a table and return it.
|
||||
-- @param from The table to copy from
|
||||
-- @return A shallow copy of the table
|
||||
local function copyTable(from)
|
||||
local to = new()
|
||||
for k,v in pairs(from) do to[k] = v end
|
||||
table_setn(to, table.getn(from))
|
||||
setmetatable(to, getmetatable(from))
|
||||
return to
|
||||
end
|
||||
|
||||
-- @function deepTransfer
|
||||
-- @brief Fully transfer all data, keeping proper previous table
|
||||
-- backreferences stable.
|
||||
-- @param to The table with which data is to be injected into
|
||||
-- @param from The table whose data will be injected into the first
|
||||
-- @param saveFields If available, a shallow copy of the basic data is saved
|
||||
-- in here.
|
||||
-- @param list The account of table references
|
||||
-- @param list2 The current status on which tables have been traversed.
|
||||
local deepTransfer
|
||||
do
|
||||
-- @function examine
|
||||
-- @brief Take account of all the table references to be shared
|
||||
-- between the to and from tables.
|
||||
-- @param to The table with which data is to be injected into
|
||||
-- @param from The table whose data will be injected into the first
|
||||
-- @param list An account of the table references
|
||||
local function examine(to, from, list, major)
|
||||
list[from] = to
|
||||
for k,v in pairs(from) do
|
||||
if rawget(to, k) and type(from[k]) == "table" and type(to[k]) == "table" and not list[from[k]] then
|
||||
if from[k] == to[k] then
|
||||
list[from[k]] = to[k]
|
||||
elseif AceLibrary.positions[from[v]] ~= major and AceLibrary.positions[from[v]] then
|
||||
list[from[k]] = from[k]
|
||||
elseif not list[from[k]] then
|
||||
examine(to[k], from[k], list, major)
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function deepTransfer(to, from, saveFields, major, list, list2)
|
||||
setmetatable(to, nil)
|
||||
local createdList
|
||||
if not list then
|
||||
createdList = true
|
||||
list = new()
|
||||
list2 = new()
|
||||
examine(to, from, list, major)
|
||||
end
|
||||
list2[to] = to
|
||||
for k,v in pairs(to) do
|
||||
if type(rawget(from, k)) ~= "table" or type(v) ~= "table" or isFrame(v) then
|
||||
if saveFields then
|
||||
saveFields[k] = v
|
||||
end
|
||||
to[k] = nil
|
||||
elseif v ~= _G then
|
||||
if saveFields then
|
||||
saveFields[k] = copyTable(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
for k in pairs(from) do
|
||||
if rawget(to, k) and to[k] ~= from[k] and AceLibrary.positions[to[k]] == major and from[k] ~= _G then
|
||||
if not list2[to[k]] then
|
||||
deepTransfer(to[k], from[k], nil, major, list, list2)
|
||||
end
|
||||
to[k] = list[to[k]] or list2[to[k]]
|
||||
else
|
||||
rawset(to, k, from[k])
|
||||
end
|
||||
end
|
||||
table_setn(to, table.getn(from))
|
||||
setmetatable(to, getmetatable(from))
|
||||
local mt = getmetatable(to)
|
||||
if mt then
|
||||
if list[mt] then
|
||||
setmetatable(to, list[mt])
|
||||
elseif mt.__index and list[mt.__index] then
|
||||
mt.__index = list[mt.__index]
|
||||
end
|
||||
end
|
||||
destroyTable(from)
|
||||
if createdList then
|
||||
del(list)
|
||||
del(list2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- @method TryToLoadStandalone
|
||||
-- @brief Attempt to find and load a standalone version of the requested library
|
||||
-- @param major A string representing the major version
|
||||
-- @return If library is found, return values from the call to LoadAddOn are returned
|
||||
-- If the library has been requested previously, nil is returned.
|
||||
local function TryToLoadStandalone(major)
|
||||
if not AceLibrary.scannedlibs then AceLibrary.scannedlibs = {} end
|
||||
if AceLibrary.scannedlibs[major] then return end
|
||||
|
||||
AceLibrary.scannedlibs[major] = true
|
||||
|
||||
local name, _, _, enabled, loadable = GetAddOnInfo(major)
|
||||
if loadable then
|
||||
return LoadAddOn(name)
|
||||
end
|
||||
|
||||
for i=1,GetNumAddOns() do
|
||||
if GetAddOnMetadata(i, "X-AceLibrary-"..major) then
|
||||
local name, _, _, enabled, loadable = GetAddOnInfo(i)
|
||||
if loadable then
|
||||
return LoadAddOn(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- @method IsNewVersion
|
||||
-- @brief Obtain whether the supplied version would be an upgrade to the
|
||||
-- current version. This allows for bypass code in library
|
||||
-- declaration.
|
||||
-- @param major A string representing the major version
|
||||
-- @param minor An integer or an svn revision string representing the minor version
|
||||
-- @return whether the supplied version would be newer than what is
|
||||
-- currently available.
|
||||
function AceLibrary:IsNewVersion(major, minor)
|
||||
argCheck(self, major, 2, "string")
|
||||
TryToLoadStandalone(major)
|
||||
|
||||
if type(minor) == "string" then
|
||||
local m = svnRevisionToNumber(minor)
|
||||
if m then
|
||||
minor = m
|
||||
else
|
||||
_G.error(string.format("Bad argument #3 to `IsNewVersion'. Must be a number or SVN revision string. %q is not appropriate", minor), 2)
|
||||
end
|
||||
end
|
||||
argCheck(self, minor, 3, "number")
|
||||
local data = self.libs[major]
|
||||
if not data then
|
||||
return true
|
||||
end
|
||||
return data.minor < minor
|
||||
end
|
||||
|
||||
-- @method HasInstance
|
||||
-- @brief Returns whether an instance exists. This allows for optional support of a library.
|
||||
-- @param major A string representing the major version.
|
||||
-- @param minor (optional) An integer or an svn revision string representing the minor version.
|
||||
-- @return Whether an instance exists.
|
||||
function AceLibrary:HasInstance(major, minor)
|
||||
argCheck(self, major, 2, "string")
|
||||
TryToLoadStandalone(major)
|
||||
|
||||
if minor then
|
||||
if type(minor) == "string" then
|
||||
local m = svnRevisionToNumber(minor)
|
||||
if m then
|
||||
minor = m
|
||||
else
|
||||
_G.error(string.format("Bad argument #3 to `HasInstance'. Must be a number or SVN revision string. %q is not appropriate", minor), 2)
|
||||
end
|
||||
end
|
||||
argCheck(self, minor, 3, "number")
|
||||
if not self.libs[major] then
|
||||
return
|
||||
end
|
||||
return self.libs[major].minor == minor
|
||||
end
|
||||
return self.libs[major] and true
|
||||
end
|
||||
|
||||
-- @method GetInstance
|
||||
-- @brief Returns the library with the given major/minor version.
|
||||
-- @param major A string representing the major version.
|
||||
-- @param minor (optional) An integer or an svn revision string representing the minor version.
|
||||
-- @return The library with the given major/minor version.
|
||||
function AceLibrary:GetInstance(major, minor)
|
||||
argCheck(self, major, 2, "string")
|
||||
TryToLoadStandalone(major)
|
||||
|
||||
local data = self.libs[major]
|
||||
if not data then
|
||||
_G.error(string.format("Cannot find a library instance of %s.", major), 2)
|
||||
return
|
||||
end
|
||||
if minor then
|
||||
if type(minor) == "string" then
|
||||
local m = svnRevisionToNumber(minor)
|
||||
if m then
|
||||
minor = m
|
||||
else
|
||||
_G.error(string.format("Bad argument #3 to `GetInstance'. Must be a number or SVN revision string. %q is not appropriate", minor), 2)
|
||||
end
|
||||
end
|
||||
argCheck(self, minor, 2, "number")
|
||||
if data.minor ~= minor then
|
||||
_G.error(string.format("Cannot find a library instance of %s, minor version %d.", major, minor), 2)
|
||||
return
|
||||
end
|
||||
end
|
||||
return data.instance
|
||||
end
|
||||
|
||||
-- Syntax sugar. AceLibrary("FooBar-1.0")
|
||||
AceLibrary_mt.__call = AceLibrary.GetInstance
|
||||
|
||||
local donothing
|
||||
|
||||
local AceEvent
|
||||
|
||||
-- @method Register
|
||||
-- @brief Registers a new version of a given library.
|
||||
-- @param newInstance the library to register
|
||||
-- @param major the major version of the library
|
||||
-- @param minor the minor version of the library
|
||||
-- @param activateFunc (optional) A function to be called when the library is
|
||||
-- fully activated. Takes the arguments
|
||||
-- (newInstance [, oldInstance, oldDeactivateFunc]). If
|
||||
-- oldInstance is given, you should probably call
|
||||
-- oldDeactivateFunc(oldInstance).
|
||||
-- @param deactivateFunc (optional) A function to be called by a newer library's
|
||||
-- activateFunc.
|
||||
-- @param externalFunc (optional) A function to be called whenever a new
|
||||
-- library is registered.
|
||||
function AceLibrary:Register(newInstance, major, minor, activateFunc, deactivateFunc, externalFunc)
|
||||
argCheck(self, newInstance, 2, "table")
|
||||
argCheck(self, major, 3, "string")
|
||||
if type(minor) == "string" then
|
||||
local m = svnRevisionToNumber(minor)
|
||||
if m then
|
||||
minor = m
|
||||
else
|
||||
_G.error(string.format("Bad argument #4 to `Register'. Must be a number or SVN revision string. %q is not appropriate", minor), 2)
|
||||
end
|
||||
end
|
||||
argCheck(self, minor, 4, "number")
|
||||
if math.floor(minor) ~= minor or minor < 0 then
|
||||
error(self, "Bad argument #4 to `Register' (integer >= 0 expected, got %s)", minor)
|
||||
end
|
||||
argCheck(self, activateFunc, 5, "function", "nil")
|
||||
argCheck(self, deactivateFunc, 6, "function", "nil")
|
||||
argCheck(self, externalFunc, 7, "function", "nil")
|
||||
if not deactivateFunc then
|
||||
if not donothing then
|
||||
donothing = function() end
|
||||
end
|
||||
deactivateFunc = donothing
|
||||
end
|
||||
local data = self.libs[major]
|
||||
if not data then
|
||||
-- This is new
|
||||
local instance = copyTable(newInstance)
|
||||
crawlReplace(instance, instance, newInstance)
|
||||
destroyTable(newInstance)
|
||||
if AceLibrary == newInstance then
|
||||
self = instance
|
||||
AceLibrary = instance
|
||||
end
|
||||
self.libs[major] = {
|
||||
instance = instance,
|
||||
minor = minor,
|
||||
deactivateFunc = deactivateFunc,
|
||||
externalFunc = externalFunc,
|
||||
}
|
||||
rawset(instance, 'GetLibraryVersion', function(self)
|
||||
return major, minor
|
||||
end)
|
||||
if not rawget(instance, 'error') then
|
||||
rawset(instance, 'error', error)
|
||||
end
|
||||
if not rawget(instance, 'assert') then
|
||||
rawset(instance, 'assert', assert)
|
||||
end
|
||||
if not rawget(instance, 'argCheck') then
|
||||
rawset(instance, 'argCheck', argCheck)
|
||||
end
|
||||
if not rawget(instance, 'pcall') then
|
||||
rawset(instance, 'pcall', pcall)
|
||||
end
|
||||
addToPositions(instance, major)
|
||||
if activateFunc then
|
||||
safecall(activateFunc, instance, nil, nil) -- no old version, so explicit nil
|
||||
end
|
||||
|
||||
if externalFunc then
|
||||
for k,data in pairs(self.libs) do
|
||||
if k ~= major then
|
||||
safecall(externalFunc, instance, k, data.instance)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for k,data in pairs(self.libs) do
|
||||
if k ~= major and data.externalFunc then
|
||||
safecall(data.externalFunc, data.instance, major, instance)
|
||||
end
|
||||
end
|
||||
if major == "AceEvent-2.0" then
|
||||
AceEvent = instance
|
||||
end
|
||||
if AceEvent then
|
||||
AceEvent.TriggerEvent(self, "AceLibrary_Register", major, instance)
|
||||
end
|
||||
|
||||
return instance
|
||||
end
|
||||
local instance = data.instance
|
||||
if minor <= data.minor then
|
||||
-- This one is already obsolete, raise an error.
|
||||
_G.error(string.format("Obsolete library registered. %s is already registered at version %d. You are trying to register version %d. Hint: if not AceLibrary:IsNewVersion(%q, %d) then return end", major, data.minor, minor, major, minor), 2)
|
||||
return
|
||||
end
|
||||
-- This is an update
|
||||
local oldInstance = new()
|
||||
|
||||
addToPositions(newInstance, major)
|
||||
local isAceLibrary = (AceLibrary == newInstance)
|
||||
local old_error, old_assert, old_argCheck, old_pcall
|
||||
if isAceLibrary then
|
||||
self = instance
|
||||
AceLibrary = instance
|
||||
|
||||
old_error = instance.error
|
||||
old_assert = instance.assert
|
||||
old_argCheck = instance.argCheck
|
||||
old_pcall = instance.pcall
|
||||
|
||||
self.error = error
|
||||
self.assert = assert
|
||||
self.argCheck = argCheck
|
||||
self.pcall = pcall
|
||||
end
|
||||
deepTransfer(instance, newInstance, oldInstance, major)
|
||||
crawlReplace(instance, instance, newInstance)
|
||||
local oldDeactivateFunc = data.deactivateFunc
|
||||
data.minor = minor
|
||||
data.deactivateFunc = deactivateFunc
|
||||
data.externalFunc = externalFunc
|
||||
rawset(instance, 'GetLibraryVersion', function(self)
|
||||
return major, minor
|
||||
end)
|
||||
if not rawget(instance, 'error') then
|
||||
rawset(instance, 'error', error)
|
||||
end
|
||||
if not rawget(instance, 'assert') then
|
||||
rawset(instance, 'assert', assert)
|
||||
end
|
||||
if not rawget(instance, 'argCheck') then
|
||||
rawset(instance, 'argCheck', argCheck)
|
||||
end
|
||||
if not rawget(instance, 'pcall') then
|
||||
rawset(instance, 'pcall', pcall)
|
||||
end
|
||||
if isAceLibrary then
|
||||
for _,v in pairs(self.libs) do
|
||||
local i = type(v) == "table" and v.instance
|
||||
if type(i) == "table" then
|
||||
if not rawget(i, 'error') or i.error == old_error then
|
||||
rawset(i, 'error', error)
|
||||
end
|
||||
if not rawget(i, 'assert') or i.assert == old_assert then
|
||||
rawset(i, 'assert', assert)
|
||||
end
|
||||
if not rawget(i, 'argCheck') or i.argCheck == old_argCheck then
|
||||
rawset(i, 'argCheck', argCheck)
|
||||
end
|
||||
if not rawget(i, 'pcall') or i.pcall == old_pcall then
|
||||
rawset(i, 'pcall', pcall)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if activateFunc then
|
||||
safecall(activateFunc, instance, oldInstance, oldDeactivateFunc)
|
||||
else
|
||||
safecall(oldDeactivateFunc, oldInstance)
|
||||
end
|
||||
del(oldInstance)
|
||||
|
||||
if externalFunc then
|
||||
for k,data in pairs(self.libs) do
|
||||
if k ~= major then
|
||||
safecall(externalFunc, instance, k, data.instance)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
local iter
|
||||
function AceLibrary:IterateLibraries()
|
||||
if not iter then
|
||||
local function iter(t, k)
|
||||
k = next(t, k)
|
||||
if not k then
|
||||
return nil
|
||||
else
|
||||
return k, t[k].instance
|
||||
end
|
||||
end
|
||||
end
|
||||
return iter, self.libs, nil
|
||||
end
|
||||
|
||||
-- @function Activate
|
||||
-- @brief The activateFunc for AceLibrary itself. Called when
|
||||
-- AceLibrary properly registers.
|
||||
-- @param self Reference to AceLibrary
|
||||
-- @param oldLib (optional) Reference to an old version of AceLibrary
|
||||
-- @param oldDeactivate (optional) Function to deactivate the old lib
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
if not self.libs then
|
||||
if oldLib then
|
||||
self.libs = oldLib.libs
|
||||
self.scannedlibs = oldLib.scannedlibs
|
||||
end
|
||||
if not self.libs then
|
||||
self.libs = {}
|
||||
end
|
||||
if not self.scannedlibs then
|
||||
self.scannedlibs = {}
|
||||
end
|
||||
end
|
||||
if not self.positions then
|
||||
if oldLib then
|
||||
self.positions = oldLib.positions
|
||||
end
|
||||
if not self.positions then
|
||||
self.positions = setmetatable({}, { __mode = "k" })
|
||||
end
|
||||
end
|
||||
|
||||
-- Expose the library in the global environment
|
||||
_G[ACELIBRARY_MAJOR] = self
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
if not previous then
|
||||
previous = AceLibrary
|
||||
end
|
||||
if not previous.libs then
|
||||
previous.libs = {}
|
||||
end
|
||||
AceLibrary.libs = previous.libs
|
||||
if not previous.positions then
|
||||
previous.positions = setmetatable({}, { __mode = "k" })
|
||||
end
|
||||
AceLibrary.positions = previous.positions
|
||||
AceLibrary:Register(AceLibrary, ACELIBRARY_MAJOR, ACELIBRARY_MINOR, activate)
|
||||
@@ -1,538 +0,0 @@
|
||||
--[[
|
||||
Name: AceLocale-2.2
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceLocale-2.2
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceLocale-2.2
|
||||
Description: Localization library for addons to use to handle proper
|
||||
localization and internationalization.
|
||||
Dependencies: AceLibrary
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceLocale-2.2"
|
||||
local MINOR_VERSION = "$Revision: 17639 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
local AceLocale = {}
|
||||
|
||||
local DEFAULT_LOCALE = "enUS"
|
||||
local _G = getfenv(0)
|
||||
|
||||
local BASE_TRANSLATIONS, DEBUGGING, TRANSLATIONS, BASE_LOCALE, TRANSLATION_TABLES, REVERSE_TRANSLATIONS, STRICTNESS, DYNAMIC_LOCALES, CURRENT_LOCALE, NAME
|
||||
|
||||
local rawget = rawget
|
||||
local rawset = rawset
|
||||
local type = type
|
||||
|
||||
local newRegistries = {}
|
||||
local scheduleClear
|
||||
|
||||
local lastSelf
|
||||
local __index = function(self, key)
|
||||
lastSelf = self
|
||||
local value = (rawget(self, TRANSLATIONS) or AceLocale.prototype)[key]
|
||||
rawset(self, key, value)
|
||||
return value
|
||||
end
|
||||
|
||||
local __newindex = function(self, k, v)
|
||||
if type(v) ~= "function" and type(k) ~= "table" then
|
||||
AceLocale.error(self, "Cannot change the values of an AceLocale instance.")
|
||||
end
|
||||
rawset(self, k, v)
|
||||
end
|
||||
|
||||
local __tostring = function(self)
|
||||
if type(rawget(self, 'GetLibraryVersion')) == "function" then
|
||||
return self:GetLibraryVersion()
|
||||
else
|
||||
return "AceLocale(" .. self[NAME] .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
local function clearCache(self)
|
||||
if not rawget(self, BASE_TRANSLATIONS) then
|
||||
return
|
||||
end
|
||||
|
||||
local cache = self[BASE_TRANSLATIONS]
|
||||
rawset(self, REVERSE_TRANSLATIONS, nil)
|
||||
|
||||
for k in pairs(self) do
|
||||
if rawget(cache, k) ~= nil then
|
||||
self[k] = nil
|
||||
end
|
||||
end
|
||||
rawset(self, 'tmp', true)
|
||||
self.tmp = nil
|
||||
end
|
||||
|
||||
local function refixInstance(instance)
|
||||
if getmetatable(instance) then
|
||||
setmetatable(instance, nil)
|
||||
end
|
||||
local translations = instance[TRANSLATIONS]
|
||||
if translations then
|
||||
if getmetatable(translations) then
|
||||
setmetatable(translations, nil)
|
||||
end
|
||||
local baseTranslations = instance[BASE_TRANSLATIONS]
|
||||
if getmetatable(baseTranslations) then
|
||||
setmetatable(baseTranslations, nil)
|
||||
end
|
||||
if translations == baseTranslations or instance[STRICTNESS] then
|
||||
setmetatable(instance, {
|
||||
__index = __index,
|
||||
__newindex = __newindex,
|
||||
__tostring = __tostring
|
||||
})
|
||||
|
||||
setmetatable(translations, {
|
||||
__index = AceLocale.prototype
|
||||
})
|
||||
else
|
||||
setmetatable(instance, {
|
||||
__index = __index,
|
||||
__newindex = __newindex,
|
||||
__tostring = __tostring
|
||||
})
|
||||
|
||||
setmetatable(translations, {
|
||||
__index = baseTranslations,
|
||||
})
|
||||
|
||||
setmetatable(baseTranslations, {
|
||||
__index = AceLocale.prototype,
|
||||
})
|
||||
end
|
||||
else
|
||||
setmetatable(instance, {
|
||||
__index = __index,
|
||||
__newindex = __newindex,
|
||||
__tostring = __tostring,
|
||||
})
|
||||
end
|
||||
clearCache(instance)
|
||||
newRegistries[instance] = true
|
||||
scheduleClear()
|
||||
return instance
|
||||
end
|
||||
|
||||
function AceLocale:new(name)
|
||||
self:argCheck(name, 2, "string")
|
||||
|
||||
if self.registry[name] and type(rawget(self.registry[name], 'GetLibraryVersion')) ~= "function" then
|
||||
return self.registry[name]
|
||||
end
|
||||
|
||||
AceLocale.registry[name] = refixInstance({
|
||||
[STRICTNESS] = false,
|
||||
[NAME] = name,
|
||||
})
|
||||
newRegistries[AceLocale.registry[name]] = true
|
||||
return AceLocale.registry[name]
|
||||
end
|
||||
|
||||
AceLocale.prototype = { class = AceLocale }
|
||||
|
||||
function AceLocale.prototype:EnableDebugging()
|
||||
if rawget(self, BASE_TRANSLATIONS) then
|
||||
AceLocale.error(self, "Cannot enable debugging after a translation has been registered.")
|
||||
end
|
||||
rawset(self, DEBUGGING, true)
|
||||
end
|
||||
|
||||
function AceLocale.prototype:EnableDynamicLocales(override)
|
||||
AceLocale.argCheck(self, override, 2, "boolean", "nil")
|
||||
if not override and rawget(self, BASE_TRANSLATIONS) then
|
||||
AceLocale.error(self, "Cannot enable dynamic locales after a translation has been registered.")
|
||||
end
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
rawset(self, DYNAMIC_LOCALES, true)
|
||||
if rawget(self, BASE_LOCALE) then
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
rawset(self, TRANSLATION_TABLES, {})
|
||||
end
|
||||
self[TRANSLATION_TABLES][self[BASE_LOCALE]] = self[BASE_TRANSLATIONS]
|
||||
self[TRANSLATION_TABLES][self[CURRENT_LOCALE]] = self[TRANSLATIONS]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceLocale.prototype:RegisterTranslations(locale, func)
|
||||
AceLocale.argCheck(self, locale, 2, "string")
|
||||
AceLocale.argCheck(self, func, 3, "function")
|
||||
|
||||
if locale == rawget(self, BASE_LOCALE) then
|
||||
AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale)
|
||||
end
|
||||
|
||||
if rawget(self, BASE_TRANSLATIONS) and GetLocale() ~= locale then
|
||||
if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) then
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
rawset(self, TRANSLATION_TABLES, {})
|
||||
end
|
||||
if self[TRANSLATION_TABLES][locale] then
|
||||
AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale)
|
||||
end
|
||||
local t = func()
|
||||
func = nil
|
||||
if type(t) ~= "table" then
|
||||
AceLocale.error(self, "Bad argument #3 to `RegisterTranslations'. function did not return a table. (expected table, got %s)", type(t))
|
||||
end
|
||||
self[TRANSLATION_TABLES][locale] = t
|
||||
t = nil
|
||||
end
|
||||
func = nil
|
||||
return
|
||||
end
|
||||
local t = func()
|
||||
func = nil
|
||||
if type(t) ~= "table" then
|
||||
AceLocale.error(self, "Bad argument #3 to `RegisterTranslations'. function did not return a table. (expected table, got %s)", type(t))
|
||||
end
|
||||
|
||||
rawset(self, TRANSLATIONS, t)
|
||||
if not rawget(self, BASE_TRANSLATIONS) then
|
||||
rawset(self, BASE_TRANSLATIONS, t)
|
||||
rawset(self, BASE_LOCALE, locale)
|
||||
for key,value in pairs(t) do
|
||||
if value == true then
|
||||
t[key] = key
|
||||
end
|
||||
end
|
||||
else
|
||||
for key, value in pairs(self[TRANSLATIONS]) do
|
||||
if not rawget(self[BASE_TRANSLATIONS], key) then
|
||||
AceLocale.error(self, "Improper translation exists. %q is likely misspelled for locale %s.", key, locale)
|
||||
end
|
||||
if value == true then
|
||||
AceLocale.error(self, "Can only accept true as a value on the base locale. %q is the base locale, %q is not.", rawget(self, BASE_LOCALE), locale)
|
||||
end
|
||||
end
|
||||
end
|
||||
rawset(self, CURRENT_LOCALE, locale)
|
||||
refixInstance(self)
|
||||
if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) then
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
rawset(self, TRANSLATION_TABLES, {})
|
||||
end
|
||||
self[TRANSLATION_TABLES][locale] = t
|
||||
end
|
||||
t = nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:SetLocale(locale)
|
||||
AceLocale.argCheck(self, locale, 2, "string", "boolean")
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
AceLocale.error(self, "Cannot call `SetLocale' without first calling `EnableDynamicLocales'.")
|
||||
end
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
AceLocale.error(self, "Cannot call `SetLocale' without first calling `RegisterTranslations'.")
|
||||
end
|
||||
if locale == true then
|
||||
locale = GetLocale()
|
||||
if not self[TRANSLATION_TABLES][locale] then
|
||||
locale = self[BASE_LOCALE]
|
||||
end
|
||||
end
|
||||
|
||||
if self[CURRENT_LOCALE] == locale then
|
||||
return
|
||||
end
|
||||
|
||||
if not self[TRANSLATION_TABLES][locale] then
|
||||
AceLocale.error(self, "Locale %q not registered.", locale)
|
||||
end
|
||||
|
||||
self[TRANSLATIONS] = self[TRANSLATION_TABLES][locale]
|
||||
self[CURRENT_LOCALE] = locale
|
||||
refixInstance(self)
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetLocale()
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
AceLocale.error(self, "Cannot call `GetLocale' without first calling `RegisterTranslations'.")
|
||||
end
|
||||
return self[CURRENT_LOCALE]
|
||||
end
|
||||
|
||||
local function iter(t, position)
|
||||
return (next(t, position))
|
||||
end
|
||||
|
||||
function AceLocale.prototype:IterateAvailableLocales()
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `EnableDynamicLocales'.")
|
||||
end
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `RegisterTranslations'.")
|
||||
end
|
||||
return iter, self[TRANSLATION_TABLES], nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:HasLocale(locale)
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
AceLocale.error(self, "Cannot call `HasLocale' without first calling `EnableDynamicLocales'.")
|
||||
end
|
||||
AceLocale.argCheck(self, locale, 2, "string")
|
||||
return rawget(self, TRANSLATION_TABLES) and self[TRANSLATION_TABLES][locale] ~= nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:SetStrictness(strict)
|
||||
AceLocale.argCheck(self, strict, 2, "boolean")
|
||||
local mt = getmetatable(self)
|
||||
if not mt then
|
||||
AceLocale.error(self, "Cannot call `SetStrictness' without a metatable.")
|
||||
end
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered.")
|
||||
end
|
||||
rawset(self, STRICTNESS, strict)
|
||||
refixInstance(self)
|
||||
end
|
||||
|
||||
local function initReverse(self)
|
||||
rawset(self, REVERSE_TRANSLATIONS, {})
|
||||
local alpha = self[TRANSLATIONS]
|
||||
local bravo = self[REVERSE_TRANSLATIONS]
|
||||
for base, localized in pairs(alpha) do
|
||||
bravo[localized] = base
|
||||
end
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetTranslation(text)
|
||||
AceLocale.argCheck(self, text, 1, "string", "number")
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
return self[text]
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetStrictTranslation(text)
|
||||
AceLocale.argCheck(self, text, 1, "string", "number")
|
||||
local x = rawget(self, TRANSLATIONS)
|
||||
if not x then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
local value = rawget(x, text)
|
||||
if value == nil then
|
||||
AceLocale.error(self, "Translation %q does not exist for locale %s", text, self[CURRENT_LOCALE])
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetReverseTranslation(text)
|
||||
local x = rawget(self, REVERSE_TRANSLATIONS)
|
||||
if not x then
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
initReverse(self)
|
||||
x = self[REVERSE_TRANSLATIONS]
|
||||
end
|
||||
local translation = x[text]
|
||||
if not translation then
|
||||
AceLocale.error(self, "Reverse translation for %q does not exist", text)
|
||||
end
|
||||
return translation
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetIterator()
|
||||
local x = rawget(self, TRANSLATIONS)
|
||||
if not x then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
return next, x, nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetReverseIterator()
|
||||
local x = rawget(self, REVERSE_TRANSLATIONS)
|
||||
if not x then
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
initReverse(self)
|
||||
x = self[REVERSE_TRANSLATIONS]
|
||||
end
|
||||
return next, x, nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:HasTranslation(text)
|
||||
AceLocale.argCheck(self, text, 1, "string", "number")
|
||||
local x = rawget(self, TRANSLATIONS)
|
||||
if not x then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
return rawget(x, text) and true
|
||||
end
|
||||
|
||||
function AceLocale.prototype:HasReverseTranslation(text)
|
||||
local x = rawget(self, REVERSE_TRANSLATIONS)
|
||||
if not x then
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
initReverse(self)
|
||||
x = self[REVERSE_TRANSLATIONS]
|
||||
end
|
||||
return x[text] and true
|
||||
end
|
||||
|
||||
function AceLocale.prototype:Debug()
|
||||
if not rawget(self, DEBUGGING) then
|
||||
return
|
||||
end
|
||||
local words = {}
|
||||
local locales = {"enUS", "ruRU", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"}
|
||||
local localizations = {}
|
||||
DEFAULT_CHAT_FRAME:AddMessage("--- AceLocale Debug ---")
|
||||
for _,locale in ipairs(locales) do
|
||||
if not self[TRANSLATION_TABLES][locale] then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q not found", locale))
|
||||
else
|
||||
localizations[locale] = self[TRANSLATION_TABLES][locale]
|
||||
end
|
||||
end
|
||||
local localeDebug = {}
|
||||
for locale, localization in pairs(localizations) do
|
||||
localeDebug[locale] = {}
|
||||
for word in pairs(localization) do
|
||||
if type(localization[word]) == "table" then
|
||||
if type(words[word]) ~= "table" then
|
||||
words[word] = {}
|
||||
end
|
||||
for bit in pairs(localization[word]) do
|
||||
if type(localization[word][bit]) == "string" then
|
||||
words[word][bit] = true
|
||||
end
|
||||
end
|
||||
elseif type(localization[word]) == "string" then
|
||||
words[word] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
for word in pairs(words) do
|
||||
if type(words[word]) == "table" then
|
||||
for bit in pairs(words[word]) do
|
||||
for locale, localization in pairs(localizations) do
|
||||
if not rawget(localization, word) or not localization[word][bit] then
|
||||
localeDebug[locale][word .. "::" .. bit] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for locale, localization in pairs(localizations) do
|
||||
if not rawget(localization, word) then
|
||||
localeDebug[locale][word] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for locale, t in pairs(localeDebug) do
|
||||
if not next(t) then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q complete", locale))
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q missing:", locale))
|
||||
for word in pairs(t) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format(" %q", word))
|
||||
end
|
||||
end
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage("--- End AceLocale Debug ---")
|
||||
end
|
||||
|
||||
setmetatable(AceLocale.prototype, {
|
||||
__index = function(self, k)
|
||||
if type(k) ~= "table" and k ~= 0 and k ~= "GetLibraryVersion" and k ~= "error" and k ~= "assert" and k ~= "argCheck" and k ~= "pcall" then -- HACK: remove "GetLibraryVersion" and such later.
|
||||
AceLocale.error(lastSelf or self, "Translation %q does not exist.", k)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
})
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
AceLocale = self
|
||||
|
||||
self.frame = oldLib and oldLib.frame or CreateFrame("Frame")
|
||||
self.registry = oldLib and oldLib.registry or {}
|
||||
self.BASE_TRANSLATIONS = oldLib and oldLib.BASE_TRANSLATIONS or {}
|
||||
self.DEBUGGING = oldLib and oldLib.DEBUGGING or {}
|
||||
self.TRANSLATIONS = oldLib and oldLib.TRANSLATIONS or {}
|
||||
self.BASE_LOCALE = oldLib and oldLib.BASE_LOCALE or {}
|
||||
self.TRANSLATION_TABLES = oldLib and oldLib.TRANSLATION_TABLES or {}
|
||||
self.REVERSE_TRANSLATIONS = oldLib and oldLib.REVERSE_TRANSLATIONS or {}
|
||||
self.STRICTNESS = oldLib and oldLib.STRICTNESS or {}
|
||||
self.NAME = oldLib and oldLib.NAME or {}
|
||||
self.DYNAMIC_LOCALES = oldLib and oldLib.DYNAMIC_LOCALES or {}
|
||||
self.CURRENT_LOCALE = oldLib and oldLib.CURRENT_LOCALE or {}
|
||||
|
||||
BASE_TRANSLATIONS = self.BASE_TRANSLATIONS
|
||||
DEBUGGING = self.DEBUGGING
|
||||
TRANSLATIONS = self.TRANSLATIONS
|
||||
BASE_LOCALE = self.BASE_LOCALE
|
||||
TRANSLATION_TABLES = self.TRANSLATION_TABLES
|
||||
REVERSE_TRANSLATIONS = self.REVERSE_TRANSLATIONS
|
||||
STRICTNESS = self.STRICTNESS
|
||||
NAME = self.NAME
|
||||
DYNAMIC_LOCALES = self.DYNAMIC_LOCALES
|
||||
CURRENT_LOCALE = self.CURRENT_LOCALE
|
||||
|
||||
|
||||
local GetTime = GetTime
|
||||
local timeUntilClear = GetTime() + 5
|
||||
scheduleClear = function()
|
||||
if next(newRegistries) then
|
||||
self.frame:Show()
|
||||
timeUntilClear = GetTime() + 5
|
||||
end
|
||||
end
|
||||
|
||||
if not self.registry then
|
||||
self.registry = {}
|
||||
else
|
||||
for name, instance in pairs(self.registry) do
|
||||
local name = name
|
||||
local mt = getmetatable(instance)
|
||||
setmetatable(instance, nil)
|
||||
instance[NAME] = name
|
||||
local strict
|
||||
if instance[STRICTNESS] ~= nil then
|
||||
strict = instance[STRICTNESS]
|
||||
elseif instance[TRANSLATIONS] ~= instance[BASE_TRANSLATIONS] then
|
||||
if getmetatable(instance[TRANSLATIONS]).__index == oldLib.prototype then
|
||||
strict = true
|
||||
end
|
||||
end
|
||||
instance[STRICTNESS] = strict and true or false
|
||||
refixInstance(instance)
|
||||
end
|
||||
end
|
||||
|
||||
self.frame:SetScript("OnEvent", scheduleClear)
|
||||
self.frame:SetScript("OnUpdate", function() -- (this, elapsed)
|
||||
if timeUntilClear - GetTime() <= 0 then
|
||||
self.frame:Hide()
|
||||
for k in pairs(newRegistries) do
|
||||
clearCache(k)
|
||||
newRegistries[k] = nil
|
||||
k = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
self.frame:UnregisterAllEvents()
|
||||
self.frame:RegisterEvent("ADDON_LOADED")
|
||||
self.frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
self.frame:Show()
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceLocale, MAJOR_VERSION, MINOR_VERSION, activate)
|
||||
@@ -1,462 +0,0 @@
|
||||
--[[
|
||||
Name: AceModuleCore-2.0
|
||||
Revision: $Rev: 17998 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceModuleCore-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceModuleCore-2.0
|
||||
Description: Mixin to provide a module system so that modules or plugins can
|
||||
use an addon as its core.
|
||||
Dependencies: AceLibrary, AceOO-2.0, AceAddon-2.0, AceEvent-2.0 (optional), Compost-2.0 (optional)
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceModuleCore-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17998 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
local function safecall(func,a,b,c,d,e,f,g)
|
||||
local success, err = pcall(func,a,b,c,d,e,f,g)
|
||||
if not success then geterrorhandler()(err) end
|
||||
end
|
||||
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local new, del
|
||||
do
|
||||
local list = setmetatable({}, {__mode = 'k'})
|
||||
function new()
|
||||
local t = next(list)
|
||||
if t then
|
||||
list[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
function del(t)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
table_setn(t, 0)
|
||||
list[t] = true
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local AceModuleCore = AceOO.Mixin {
|
||||
"NewModule",
|
||||
"HasModule",
|
||||
"GetModule",
|
||||
"IsModule",
|
||||
"IterateModules",
|
||||
"SetModuleMixins",
|
||||
"SetModuleClass",
|
||||
"IsModuleActive",
|
||||
"ToggleModuleActive"
|
||||
}
|
||||
local AceEvent
|
||||
|
||||
local Compost = AceLibrary:HasInstance("Compost-2.0") and AceLibrary("Compost-2.0")
|
||||
|
||||
local function getlibrary(lib)
|
||||
if type(lib) == "string" then
|
||||
return AceLibrary(lib)
|
||||
else
|
||||
return lib
|
||||
end
|
||||
end
|
||||
|
||||
local tmp
|
||||
function AceModuleCore:NewModule(name, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.modules then
|
||||
AceModuleCore:error("CreatePrototype() must be called before attempting to create a new module.", 2)
|
||||
end
|
||||
AceModuleCore:argCheck(name, 2, "string")
|
||||
if string.len(name) == 0 then
|
||||
AceModuleCore:error("Bad argument #2 to `NewModule`, string must not be empty")
|
||||
end
|
||||
if self.modules[name] then
|
||||
AceModuleCore:error("The module %q has already been registered", name)
|
||||
end
|
||||
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
end
|
||||
if a1 then table.insert(tmp, a1)
|
||||
if a2 then table.insert(tmp, a2)
|
||||
if a3 then table.insert(tmp, a3)
|
||||
if a4 then table.insert(tmp, a4)
|
||||
if a5 then table.insert(tmp, a5)
|
||||
if a6 then table.insert(tmp, a6)
|
||||
if a7 then table.insert(tmp, a7)
|
||||
if a8 then table.insert(tmp, a8)
|
||||
if a9 then table.insert(tmp, a9)
|
||||
if a10 then table.insert(tmp, a10)
|
||||
if a11 then table.insert(tmp, a11)
|
||||
if a12 then table.insert(tmp, a12)
|
||||
if a13 then table.insert(tmp, a13)
|
||||
if a14 then table.insert(tmp, a14)
|
||||
if a15 then table.insert(tmp, a15)
|
||||
if a16 then table.insert(tmp, a16)
|
||||
if a17 then table.insert(tmp, a17)
|
||||
if a18 then table.insert(tmp, a18)
|
||||
if a19 then table.insert(tmp, a19)
|
||||
if a20 then table.insert(tmp, a20)
|
||||
end end end end end end end end end end end end end end end end end end end end
|
||||
for k,v in ipairs(tmp) do
|
||||
tmp[k] = getlibrary(v)
|
||||
end
|
||||
|
||||
if self.moduleMixins then
|
||||
for _,mixin in ipairs(self.moduleMixins) do
|
||||
local exists = false
|
||||
for _,v in ipairs(tmp) do
|
||||
if mixin == v then
|
||||
exists = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not exists then
|
||||
table.insert(tmp, mixin)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local module = AceOO.Classpool(self.moduleClass, unpack(tmp)):new(name)
|
||||
self.modules[name] = module
|
||||
module.name = name
|
||||
module.title = name
|
||||
|
||||
AceModuleCore.totalModules[module] = self
|
||||
|
||||
if AceEvent then
|
||||
AceEvent:TriggerEvent("Ace2_ModuleCreated", module)
|
||||
end
|
||||
|
||||
for k in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
table_setn(tmp, 0)
|
||||
return module
|
||||
end
|
||||
|
||||
function AceModuleCore:HasModule(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if a1 then if not self.modules[a1] then return false end
|
||||
if a2 then if not self.modules[a2] then return false end
|
||||
if a3 then if not self.modules[a3] then return false end
|
||||
if a4 then if not self.modules[a4] then return false end
|
||||
if a5 then if not self.modules[a5] then return false end
|
||||
if a6 then if not self.modules[a6] then return false end
|
||||
if a7 then if not self.modules[a7] then return false end
|
||||
if a8 then if not self.modules[a8] then return false end
|
||||
if a9 then if not self.modules[a9] then return false end
|
||||
if a10 then if not self.modules[a10] then return false end
|
||||
if a11 then if not self.modules[a11] then return false end
|
||||
if a12 then if not self.modules[a12] then return false end
|
||||
if a13 then if not self.modules[a13] then return false end
|
||||
if a14 then if not self.modules[a14] then return false end
|
||||
if a15 then if not self.modules[a15] then return false end
|
||||
if a16 then if not self.modules[a16] then return false end
|
||||
if a17 then if not self.modules[a17] then return false end
|
||||
if a18 then if not self.modules[a18] then return false end
|
||||
if a19 then if not self.modules[a19] then return false end
|
||||
if a20 then if not self.modules[a20] then return false end
|
||||
end end end end end end end end end end end end end end end end end end end end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function AceModuleCore:GetModule(name)
|
||||
if not self.modules then
|
||||
AceModuleCore:error("Error initializing class. Please report error.")
|
||||
end
|
||||
if not self.modules[name] then
|
||||
AceModuleCore:error("Cannot find module %q.", name)
|
||||
end
|
||||
return self.modules[name]
|
||||
end
|
||||
|
||||
function AceModuleCore:IsModule(module)
|
||||
if self == AceModuleCore then
|
||||
return AceModuleCore.totalModules[module]
|
||||
else
|
||||
for k,v in pairs(self.modules) do
|
||||
if v == module then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function AceModuleCore:IterateModules()
|
||||
local t = new()
|
||||
for k in pairs(self.modules) do
|
||||
table.insert(t, k)
|
||||
end
|
||||
table.sort(t)
|
||||
local i = 0
|
||||
return function()
|
||||
i = i + 1
|
||||
local x = t[i]
|
||||
if x then
|
||||
return x, self.modules[x]
|
||||
else
|
||||
t = del(t)
|
||||
return nil
|
||||
end
|
||||
end, nil, nil
|
||||
end
|
||||
|
||||
function AceModuleCore:SetModuleMixins(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if self.moduleMixins then
|
||||
AceModuleCore:error('Cannot call "SetModuleMixins" twice')
|
||||
elseif not self.modules then
|
||||
AceModuleCore:error("Error initializing class. Please report error.")
|
||||
elseif next(self.modules) then
|
||||
AceModuleCore:error('Cannot call "SetModuleMixins" after "NewModule" has been called.')
|
||||
end
|
||||
|
||||
self.moduleMixins = Compost and Compost:Acquire(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) or {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20}
|
||||
for k,v in ipairs(self.moduleMixins) do
|
||||
self.moduleMixins[k] = getlibrary(v)
|
||||
end
|
||||
end
|
||||
|
||||
function AceModuleCore:SetModuleClass(class)
|
||||
class = getlibrary(class)
|
||||
AceModuleCore:assert(AceOO.inherits(class, AceOO.Class), "Bad argument #2 to `SetModuleClass' (Class expected)")
|
||||
if not self.modules then
|
||||
AceModuleCore:error("Error initializing class. Please report error.")
|
||||
end
|
||||
if self.customModuleClass then
|
||||
AceModuleCore:error("Cannot call `SetModuleClass' twice.")
|
||||
end
|
||||
self.customModuleClass = true
|
||||
self.moduleClass = class
|
||||
self.modulePrototype = class.prototype
|
||||
end
|
||||
|
||||
function AceModuleCore:ToggleModuleActive(module, state)
|
||||
AceModuleCore:argCheck(module, 2, "table", "string")
|
||||
AceModuleCore:argCheck(state, 3, "nil", "boolean")
|
||||
|
||||
if type(module) == "string" then
|
||||
if not self:HasModule(module) then
|
||||
AceModuleCore:error("Cannot find module %q", module)
|
||||
end
|
||||
module = self:GetModule(module)
|
||||
else
|
||||
if not self:IsModule(module) then
|
||||
AceModuleCore:error("%q is not a module", module)
|
||||
end
|
||||
end
|
||||
|
||||
local disable
|
||||
if state == nil then
|
||||
disable = self:IsModuleActive(module)
|
||||
else
|
||||
disable = not state
|
||||
if disable ~= self:IsModuleActive(module) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if type(module.ToggleActive) == "function" then
|
||||
return module:ToggleActive(not disable)
|
||||
elseif AceOO.inherits(self, "AceDB-2.0") then
|
||||
if not self.db or not self.db.raw then
|
||||
AceModuleCore:error("Cannot toggle a module until `RegisterDB' has been called and `ADDON_LOADED' has been fireed.")
|
||||
end
|
||||
if type(self.db.raw.disabledModules) ~= "table" then
|
||||
self.db.raw.disabledModules = Compost and Compost:Acquire() or {}
|
||||
end
|
||||
local _,profile = self:GetProfile()
|
||||
if type(self.db.raw.disabledModules[profile]) ~= "table" then
|
||||
self.db.raw.disabledModules[profile] = Compost and Compost:Acquire() or {}
|
||||
end
|
||||
if type(self.db.raw.disabledModules[profile][module.name]) ~= "table" then
|
||||
self.db.raw.disabledModules[profile][module.name] = disable or nil
|
||||
end
|
||||
if not disable then
|
||||
if not next(self.db.raw.disabledModules[profile]) then
|
||||
if Compost then
|
||||
Compost:Reclaim(self.db.raw.disabledModules[profile])
|
||||
end
|
||||
self.db.raw.disabledModules[profile] = nil
|
||||
end
|
||||
if not next(self.db.raw.disabledModules) then
|
||||
if Compost then
|
||||
Compost:Reclaim(self.db.raw.disabledModules)
|
||||
end
|
||||
self.db.raw.disabledModules = nil
|
||||
end
|
||||
end
|
||||
else
|
||||
if type(self.disabledModules) ~= "table" then
|
||||
self.disabledModules = Compost and Compost:Acquire() or {}
|
||||
end
|
||||
self.disabledModules[module.name] = disable or nil
|
||||
end
|
||||
if AceOO.inherits(module, "AceAddon-2.0") then
|
||||
local AceAddon = AceLibrary("AceAddon-2.0")
|
||||
if not AceAddon.addonsStarted[module] then
|
||||
return
|
||||
end
|
||||
end
|
||||
if not disable then
|
||||
local current = module.class
|
||||
while true do
|
||||
if current == AceOO.Class then
|
||||
break
|
||||
end
|
||||
if current.mixins then
|
||||
for mixin in pairs(current.mixins) do
|
||||
if type(mixin.OnEmbedEnable) == "function" then
|
||||
safecall(mixin.OnEmbedEnable, mixin, module)
|
||||
end
|
||||
end
|
||||
end
|
||||
current = current.super
|
||||
end
|
||||
if type(module.OnEnable) == "function" then
|
||||
safecall(module.OnEnable, module)
|
||||
end
|
||||
if AceEvent then
|
||||
AceEvent:TriggerEvent("Ace2_AddonEnabled", module)
|
||||
end
|
||||
else
|
||||
local current = module.class
|
||||
while true do
|
||||
if current == AceOO.Class then
|
||||
break
|
||||
end
|
||||
if current.mixins then
|
||||
for mixin in pairs(current.mixins) do
|
||||
if type(mixin.OnEmbedDisable) == "function" then
|
||||
safecall(mixin.OnEmbedDisable, mixin, module)
|
||||
end
|
||||
end
|
||||
end
|
||||
current = current.super
|
||||
end
|
||||
if type(module.OnDisable) == "function" then
|
||||
safecall(module.OnDisable, module)
|
||||
end
|
||||
if AceEvent then
|
||||
AceEvent:TriggerEvent("Ace2_AddonDisabled", module)
|
||||
end
|
||||
end
|
||||
return not disable
|
||||
end
|
||||
|
||||
function AceModuleCore:IsModuleActive(module)
|
||||
AceModuleCore:argCheck(module, 2, "table", "string")
|
||||
|
||||
if AceModuleCore == self then
|
||||
self:argCheck(module, 2, "table")
|
||||
|
||||
local core = AceModuleCore.totalModules[module]
|
||||
if not core then
|
||||
self:error("Bad argument #2 to `IsModuleActive'. Not a module")
|
||||
end
|
||||
return core:IsModuleActive(module)
|
||||
end
|
||||
|
||||
if type(module) == "string" then
|
||||
if not self:HasModule(module) then
|
||||
AceModuleCore:error("Cannot find module %q", module)
|
||||
end
|
||||
module = self:GetModule(module)
|
||||
else
|
||||
if not self:IsModule(module) then
|
||||
AceModuleCore:error("%q is not a module", module)
|
||||
end
|
||||
end
|
||||
|
||||
if type(module.IsActive) == "function" then
|
||||
return module:IsActive()
|
||||
elseif AceOO.inherits(self, "AceDB-2.0") then
|
||||
local _,profile = self:GetProfile()
|
||||
return not self.db or not self.db.raw or not self.db.raw.disabledModules or not self.db.raw.disabledModules[profile] or not self.db.raw.disabledModules[profile][module.name]
|
||||
else
|
||||
return not self.disabledModules or not self.disabledModules[module.name]
|
||||
end
|
||||
end
|
||||
|
||||
function AceModuleCore:OnInstanceInit(target)
|
||||
if target.modules then
|
||||
AceModuleCore:error("OnInstanceInit cannot be called twice")
|
||||
end
|
||||
target.modules = Compost and Compost:Acquire() or {}
|
||||
|
||||
target.moduleClass = AceOO.Class("AceAddon-2.0")
|
||||
target.modulePrototype = target.moduleClass.prototype
|
||||
end
|
||||
|
||||
AceModuleCore.OnManualEmbed = AceModuleCore.OnInstanceInit
|
||||
|
||||
function AceModuleCore.OnEmbedProfileDisable(AceModuleCore, self, newProfile)
|
||||
if not AceOO.inherits(self, "AceDB-2.0") then
|
||||
return
|
||||
end
|
||||
local _,currentProfile = self:GetProfile()
|
||||
for k, module in pairs(self.modules) do
|
||||
if type(module.IsActive) == "function" or type(module.ToggleActive) == "function" then
|
||||
-- continue
|
||||
else
|
||||
local currentActive = not self.db or not self.db.raw or not self.db.raw.disabledModules or not self.db.raw.disabledModules[currentProfile] or not self.db.raw.disabledModules[currentProfile][module.name]
|
||||
local newActive = not self.db or not self.db.raw or not self.db.raw.disabledModules or not self.db.raw.disabledModules[newProfile] or not self.db.raw.disabledModules[newProfile][module.name]
|
||||
if currentActive ~= newActive then
|
||||
self:ToggleModuleActive(module)
|
||||
if not self.db.raw.disabledModules then
|
||||
self.db.raw.disabledModules = {}
|
||||
end
|
||||
if not self.db.raw.disabledModules[currentProfile] then
|
||||
self.db.raw.disabledModules[currentProfile] = {}
|
||||
end
|
||||
self.db.raw.disabledModules[currentProfile][module.name] = not currentActive or nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
AceModuleCore = self
|
||||
|
||||
if oldLib then
|
||||
self.totalModules = oldLib.totalModules
|
||||
end
|
||||
if not self.totalModules then
|
||||
self.totalModules = {}
|
||||
end
|
||||
|
||||
self.super.activate(self, oldLib, oldDeactivate)
|
||||
end
|
||||
|
||||
local function external(self, major, instance)
|
||||
if major == "Compost-2.0" then
|
||||
Compost = instance
|
||||
elseif major == "AceEvent-2.0" then
|
||||
AceEvent = instance
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceModuleCore, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
|
||||
AceModuleCore = AceLibrary(MAJOR_VERSION)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,323 @@
|
||||
# 🛠️ WoW Modernization Tool
|
||||
|
||||
[](https://github.com/Dusk-92/Modernization-Tool/actions/workflows/build.yml)
|
||||
[](https://github.com/Dusk-92/Modernization-Tool/releases/latest)
|
||||
|
||||
A simple all-in-one setup tool for **Vanilla WoW 1.12 compatible clients**.
|
||||
|
||||
Modernization Tool installs and configures client fixes, performance plugins, Vanilla Tweaks, DXVK and optional visual/audio improvements without requiring users to manually manage DLLs or configuration files.
|
||||
|
||||
> 💡 Hover over any setting inside the tool to see an explanation of what it does.
|
||||
|
||||
---
|
||||
|
||||
## ⬇️ Download
|
||||
|
||||
Download the latest version from:
|
||||
|
||||
**[GitHub Releases](https://github.com/Dusk-92/Modernization-Tool/releases/latest)**
|
||||
|
||||
Current major release: **v2.2**
|
||||
|
||||
No installation is required. Download and run:
|
||||
|
||||
`WoW_Modernization_Tool.exe`
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
1. Launch **WoW_Modernization_Tool.exe**
|
||||
2. Select your Vanilla WoW game folder.
|
||||
3. Choose your renderer, plugins and optional tweaks.
|
||||
4. Click **Apply Setup & Tweaks**.
|
||||
5. Launch the game using **Play Modernized WoW**.
|
||||
|
||||
The launcher shortcut is automatically created:
|
||||
|
||||
- 📁 inside your WoW folder
|
||||
- 🖥️ on your Windows Desktop
|
||||
|
||||
> ⚠️ Use **Play Modernized WoW** to launch the modernized client.
|
||||
|
||||
---
|
||||
|
||||
# 🎮 Rendering
|
||||
|
||||
Two rendering modes are available:
|
||||
|
||||
### VanillaFixes — DirectX 9
|
||||
|
||||
The default option.
|
||||
|
||||
Uses WoW's native DirectX 9 renderer together with VanillaFixes.
|
||||
|
||||
### VanillaFixes + DXVK — Vulkan
|
||||
|
||||
Uses DXVK to translate DirectX 9 to Vulkan.
|
||||
|
||||
The bundled version is currently:
|
||||
|
||||
**DXVK 2.6.1 x86**
|
||||
|
||||
Existing custom DirectX wrapper files are backed up rather than blindly deleted when switching renderers.
|
||||
|
||||
---
|
||||
|
||||
# 🧩 Client Plugins
|
||||
|
||||
## Recommended Core
|
||||
|
||||
The tool can install and configure several recommended client extensions:
|
||||
|
||||
- **Nampower** — improves spell responsiveness and latency handling.
|
||||
- **UnitXP_SP3** — adds networking, targeting, Lua and client improvements.
|
||||
- **SuperWoW** — expands the Vanilla Lua API and improves addon compatibility.
|
||||
- **TransmogFix** — prevents performance drops caused by rapid appearance updates.
|
||||
- **PerfBoost** — provides additional unit rendering/performance controls.
|
||||
- **WeirdPerformance** — lightweight client optimizations aimed at improving FPS and reducing UI memory leaks for smoother gameplay.
|
||||
- **VanillaHelpers** — extends several Vanilla client limits.
|
||||
- **ClassicAPI** — adds newer WoW API functions for compatible addons.
|
||||
- **AuctionQueryThrottle** — removes the fixed delay between Auction House queries.
|
||||
|
||||
## Optional Plugins
|
||||
|
||||
Optional client-side improvements include:
|
||||
|
||||
- **VanillaMultiMonitorFix** — improved resolution, refresh-rate and monitor detection.
|
||||
- **Interact** — adds a modern Interact key for NPCs, objects, gathering nodes and loot.
|
||||
- **No1600x1200** — fixes the old Vanilla resolution limitation on some systems.
|
||||
- **BigCursor** — upscales the hardware cursor for better visibility on modern high-resolution displays without sacrificing sharpness.
|
||||
- **CustomAssets** — allows loose game files to be loaded directly from the `Data/` folder and supports custom multi-character patch names without repacking MPQ archives.
|
||||
- **LogSessions** — automatically organizes combat and chat logs into clean per-character, per-day files when you log in.
|
||||
- **MinimapIcons** — adds TBC/WotLK-style minimap tracking icons for NPCs and game objects, with a combined tracking menu and saved preferences.
|
||||
- **PNG Screenshots** — saves screenshots as compressed PNG files instead of the default uncompressed TGA format, using background processing to minimize frame-time impact.
|
||||
- **WorldMarkers** — lets party or raid leaders place up to five animated, Cataclysm-style colored world markers for positioning and tactical planning.
|
||||
- **Discord Rich Presence** — installs and keeps **WowPresence** up to date from [Dusk-92/WowPresence](https://github.com/Dusk-92/WowPresence). The Tool preconfigures the OctoWoW Discord Application ID and lets you choose which character details are shown on Discord, including **Name, Guild, Race, Faction, Class, Level and Zone**. Custom Discord Application IDs are preserved across updates.
|
||||
|
||||
---
|
||||
|
||||
# ⚙️ Vanilla Tweaks
|
||||
|
||||
Modernization Tool integrates the modern **tubtubs/vanilla-tweaks** patcher.
|
||||
|
||||
Available settings include:
|
||||
|
||||
- Field of View
|
||||
- Render Distance
|
||||
- Ground Clutter Distance
|
||||
- Nameplate Distance
|
||||
- Camera Distance
|
||||
- Sound Channels
|
||||
- Always Auto-Loot
|
||||
- Background Sounds
|
||||
- Large Address Aware
|
||||
- Camera Skip Fix
|
||||
- DEP compatibility
|
||||
- Unlimited AddOn Script Memory
|
||||
- Cross-Faction Resurrection Fix
|
||||
- Custom Glues Patch
|
||||
- Automatic WDB management
|
||||
|
||||
When **SuperWoW** already provides a feature, the equivalent vanilla-tweaks patch is automatically skipped to avoid duplicate modifications.
|
||||
|
||||
---
|
||||
|
||||
# 🌙 Visual Mods
|
||||
|
||||
Optional visual modifications are available directly from the tool:
|
||||
|
||||
- **Bluemoon Patch** — restores the rare blue moon effect.
|
||||
- **Darker Nights** — darker and more atmospheric nights.
|
||||
- **Pretty Night Sky** — improved starry night sky.
|
||||
- **Epoch Water** — alternative water textures.
|
||||
- **Fog Pushback** — moves environmental fog farther away.
|
||||
- **Pink Herbs** — makes herb nodes much easier to spot.
|
||||
|
||||
All visual mods are **disabled by default**.
|
||||
|
||||
---
|
||||
|
||||
# 🔊 Audio Mods
|
||||
|
||||
Optional sound replacements include:
|
||||
|
||||
- **NoErrorSounds** — removes repetitive error/fizzle and interface sounds.
|
||||
- **FishPing** — replaces the fishing bite sound with a clearer ping.
|
||||
- **Warlock Muted Demons** — mutes repetitive Warlock demon voice lines.
|
||||
|
||||
All audio mods are **disabled by default**.
|
||||
|
||||
---
|
||||
|
||||
# 🔄 Automatic Updates & Offline Fallbacks
|
||||
|
||||
Supported components are downloaded directly from their upstream projects when possible.
|
||||
|
||||
Modernization Tool is designed to avoid breaking an existing installation if an online source becomes unavailable.
|
||||
|
||||
Depending on the component, the tool can:
|
||||
|
||||
- keep an already installed valid version;
|
||||
- use a bundled known-good fallback where redistribution terms allow it;
|
||||
- avoid re-downloading files that are already current.
|
||||
|
||||
**SuperWoW and SuperAPI are upstream-only:** they are downloaded directly from
|
||||
their official upstream projects when enabled and are not bundled as offline
|
||||
fallbacks. A first-time SuperWoW installation therefore requires network access.
|
||||
|
||||
Downloaded DLLs are also validated before installation.
|
||||
|
||||
---
|
||||
|
||||
# 💾 Safe Configuration Management
|
||||
|
||||
Modernization Tool remembers settings separately for each WoW installation.
|
||||
|
||||
It also:
|
||||
|
||||
- preserves manually added `dlls.txt` entries;
|
||||
- preserves comments and unknown DLL entries;
|
||||
- detects incompatible plugin combinations;
|
||||
- validates the selected Vanilla client before modifying it;
|
||||
- performs important file replacements transactionally;
|
||||
- protects unknown/custom renderer files;
|
||||
- safely manages WDB ownership.
|
||||
|
||||
---
|
||||
|
||||
# 🔐 AutoLogin
|
||||
|
||||
AutoLogin can optionally save account and character shortcuts on the login screen.
|
||||
|
||||
When **AutoLogin + Nampower** are enabled together, Modernization Tool automatically creates or reuses the Windows user encryption key required by Nampower.
|
||||
|
||||
Password encryption is enabled by default when available.
|
||||
|
||||
Existing encryption keys are never replaced.
|
||||
|
||||
> 🔒 Your encryption key is stored in the Windows user environment and is not written to the WoW folder.
|
||||
|
||||
---
|
||||
|
||||
# 📦 Current Notable Versions
|
||||
|
||||
| Component | Version |
|
||||
|---|---|
|
||||
| VanillaFixes | 1.5.3 |
|
||||
| DXVK | 2.6.1 x86 |
|
||||
| Nampower | 4.6.1 |
|
||||
| ClassicAPI | 1.12.7 |
|
||||
| AuctionQueryThrottle | 1.2.0 |
|
||||
| UnitXP_SP3 | v90 |
|
||||
| SuperWoW | 2.2 |
|
||||
| VanillaHelpers | 1.1.2 |
|
||||
| WeirdPerformance | 0.7.3 |
|
||||
| WorldMarkers | 0.7.1 |
|
||||
| VanillaMultiMonitorFix | 0.2 |
|
||||
| Interact | 1.0.4 |
|
||||
|
||||
Where supported, the tool will attempt to obtain the latest compatible upstream version automatically.
|
||||
|
||||
---
|
||||
|
||||
# 📝 Updating Modernization Tool
|
||||
|
||||
Updating from an older version does **not** require reinstalling WoW.
|
||||
|
||||
Simply:
|
||||
|
||||
1. Download the latest Modernization Tool release.
|
||||
2. Select your existing WoW folder.
|
||||
3. Review your settings.
|
||||
4. Click **Apply Setup & Tweaks** again.
|
||||
|
||||
Your per-installation settings will be restored automatically.
|
||||
|
||||
---
|
||||
|
||||
# 🛡️ Antivirus Notice
|
||||
|
||||
Because Modernization Tool modifies a game executable and installs client-side DLL plugins, some antivirus products may flag the executable or some included components.
|
||||
|
||||
Always download Modernization Tool from the official GitHub Releases page.
|
||||
|
||||
---
|
||||
|
||||
# 🔗 Useful Links
|
||||
|
||||
- **[Latest Release](https://github.com/Dusk-92/Modernization-Tool/releases/latest)**
|
||||
- **[v2.2 Release Notes](https://github.com/Dusk-92/Modernization-Tool/releases/tag/v2.2)**
|
||||
- **[OctoWoW Installation & Modernization Guide](https://octowow.st/forum/viewtopic.php?t=831)**
|
||||
|
||||
---
|
||||
|
||||
# ❤️ Credits
|
||||
|
||||
Modernization Tool brings together work from several community projects and developers.
|
||||
|
||||
## Rendering & Client Patching
|
||||
|
||||
- [VanillaFixes](https://github.com/hannesmann/vanillafixes)
|
||||
- [DXVK](https://github.com/doitsujin/dxvk)
|
||||
- [vanilla-tweaks](https://github.com/tubtubs/vanilla-tweaks)
|
||||
|
||||
## Core Engine & API Plugins
|
||||
|
||||
- [VanillaHelpers](https://github.com/isfir/VanillaHelpers)
|
||||
- [PerfBoost Settings](https://gitea.com/avitasia/PerfBoostSettings)
|
||||
- [UnitXP_SP3](https://github.com/brues-code/UnitXP_SP3)
|
||||
- [SuperWoW](https://github.com/balakethelock/SuperWoW)
|
||||
- [SuperAPI](https://github.com/balakethelock/SuperAPI)
|
||||
- [ClassicAPI](https://github.com/brues-code/ClassicAPI)
|
||||
- [AuctionQueryThrottle](https://github.com/brues-code/AuctionQueryThrottle)
|
||||
- [Nampower](https://github.com/brues-code/nampower)
|
||||
- [NampowerSettings](https://github.com/brues-code/NampowerSettings)
|
||||
- [No1600x1200](https://github.com/RetroCro/TurtleWoW-Mods#no1600x1200)
|
||||
- [VanillaMultiMonitorFix](https://github.com/Mates1500/VanillaMultiMonitorFix)
|
||||
- [Interact](https://github.com/lookino/Interact)
|
||||
- [WowPresence](https://github.com/Dusk-92/WowPresence)
|
||||
|
||||
## Visual & Audio Mods
|
||||
|
||||
- [Bluemoon Patch via vanilla-tweaks](https://github.com/tubtubs/vanilla-tweaks)
|
||||
- [Darker Nights — Project Reforged](https://projectreforged.github.io/vanilla/downloads/turtle/)
|
||||
- [Pretty Night Sky / Epoch Water / Fog Pushback — RetroCro TurtleWoW Mods](https://github.com/RetroCro/TurtleWoW-Mods)
|
||||
- [Pink Herbs](https://github.com/seacrabsam/patch-herb)
|
||||
- [NoErrorSounds](https://github.com/Macumbafeh/NoErrorSounds)
|
||||
- [FishPing](https://github.com/notsureawake/FishPing)
|
||||
- [Warlock Muted Demons](https://github.com/spzilyk/Warlock-Muted-Demons)
|
||||
- [Automatic WDB management guide](https://github.com/RetroCro/TurtleWoW-Mods#automatically-clear-wdb-folder-every-time-you-launch-turtle-wow)
|
||||
|
||||
## Other Bundled Enhancements
|
||||
|
||||
- [Vanilla AutoLogin](https://github.com/MarcelineVQ/turtle-autologin)
|
||||
- [WeirdUtils](https://codeberg.org/Dusk92/WeirdUtils)
|
||||
|
||||
Additional attribution and source links are available directly in the **Credits** tab of Modernization Tool.
|
||||
|
||||
---
|
||||
|
||||
## 🧾 Licensing & Provenance
|
||||
|
||||
Modernization Tool is an independent community project. Third-party components
|
||||
retain their own licenses, permissions, and trademarks.
|
||||
|
||||
For detailed redistribution and provenance information, see:
|
||||
|
||||
- [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)
|
||||
- [PROJECT_IDENTITY.md](PROJECT_IDENTITY.md)
|
||||
- [Docs/BINARY_PROVENANCE.md](Docs/BINARY_PROVENANCE.md)
|
||||
- [Docs/ASSET_PROVENANCE.md](Docs/ASSET_PROVENANCE.md)
|
||||
- [LICENSES/](LICENSES/)
|
||||
|
||||
SuperWoW and SuperAPI are downloaded directly from their upstream projects and
|
||||
are not bundled as offline fallbacks.
|
||||
|
||||
---
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Modernization Tool is a community project and is not affiliated with or endorsed by Blizzard Entertainment.
|
||||
|
||||
World of Warcraft and Warcraft are trademarks of Blizzard Entertainment.
|
||||
+24
-99
@@ -1,109 +1,34 @@
|
||||
# 🛠️ WoW Modernization Tool v2.0
|
||||
# 🛠️ WoW Modernization Tool v2.2
|
||||
|
||||
This is a major update focused on **easier setup, safer updates, automatic component refreshes and new optional client improvements**.
|
||||
## 🎮 Discord Rich Presence
|
||||
|
||||
Existing users do **not** need to reinstall WoW. Select your current game folder, review your options and click **Apply Setup & Tweaks**.
|
||||
- Added detailed Discord Rich Presence privacy controls.
|
||||
- Choose individually whether Discord can display:
|
||||
- Character Name
|
||||
- Guild
|
||||
- Race
|
||||
- Faction
|
||||
- Class
|
||||
- Level
|
||||
- Zone
|
||||
- Added a `Show character details` option to quickly enable all Discord details.
|
||||
- Updated WowPresence integration for the new privacy system.
|
||||
|
||||
## 🔄 Automatic Updates & Offline Protection
|
||||
## 🔄 Updates & Downloads
|
||||
|
||||
Supported components can now be refreshed directly from their upstream releases when you apply the setup.
|
||||
- Added smart update checks for remote components.
|
||||
- Unchanged components are no longer downloaded again on every Apply.
|
||||
- Modified or missing managed files are automatically detected and repaired.
|
||||
- Release assets are detected even when an upstream project replaces a file under the same tag.
|
||||
- Improved vanilla-tweaks update detection to avoid unnecessary downloads and repatching.
|
||||
- Improved update checks for GitHub branch-based components.
|
||||
|
||||
If an online update is unavailable, the tool will keep a valid installed version or use a bundled known-good fallback when available. Existing working files are preserved whenever possible instead of being replaced unnecessarily.
|
||||
## 📚 Documentation
|
||||
|
||||
## 🎮 Rendering & DXVK
|
||||
- Updated Discord Rich Presence documentation.
|
||||
|
||||
Renderer selection is now simpler:
|
||||
## ✅ Updating from v2.1
|
||||
|
||||
- **VanillaFixes — DirectX 9** *(default)* — uses WoW's native DirectX 9 renderer.
|
||||
- **VanillaFixes + DXVK — Vulkan** — translates DirectX 9 to Vulkan and may provide smoother frame pacing on modern systems.
|
||||
|
||||
The bundled DXVK version is now **2.6.1 x86** with a configuration aligned with VanillaFixes.
|
||||
|
||||
Switching back to DirectX 9 now safely moves unknown existing D3D9 wrapper files out of the WoW root instead of deleting them.
|
||||
|
||||
## 🧩 New & Updated Plugins
|
||||
|
||||
- **ClassicAPI** — adds newer WoW API functions so compatible modern addons can work on the Vanilla client.
|
||||
- **AuctionQueryThrottle** — removes the fixed Auction House query delay for much faster searches.
|
||||
- **VanillaMultiMonitorFix** — improves resolution, refresh-rate and monitor detection on multi-monitor setups.
|
||||
- **Interact** — adds a modern interaction key for nearby NPCs, objects, gathering nodes and loot.
|
||||
- **WorldMarkers 0.7.1** — updated optional world-marker support.
|
||||
- **WeirdPerformance 0.7.3** — updated engine/runtime optimizations for client smoothness and reduced overhead.
|
||||
|
||||
## ⚙️ New Client Tweaks
|
||||
|
||||
- **Unlimited AddOn Script Memory** — removes WoW's AddOn memory limit.
|
||||
- **Cross-Faction Resurrection Fix** — improves resurrection handling for released cross-faction players.
|
||||
- **Custom Glues Patch** — enables custom login and character-selection interface modifications.
|
||||
- **Automatically Clear WDB** — clears stale WDB cache data and safely manages the WDB blocker.
|
||||
- **SuperWoW conflict prevention** — equivalent vanilla-tweaks patches are automatically skipped when SuperWoW already handles FoV, Sound Channels, Auto-Loot or Background Sound.
|
||||
|
||||
## 🌙 New Visual Mods
|
||||
|
||||
All visual mods are optional and disabled by default.
|
||||
|
||||
- **Bluemoon Patch** — restores the rare blue moon visual effect.
|
||||
- **Darker Nights** — makes nighttime environments darker and more atmospheric.
|
||||
- **Pretty Night Sky** — replaces the Vanilla night sky with a more detailed starry sky.
|
||||
- **Epoch Water** — replaces the original Vanilla water textures.
|
||||
- **Fog Pushback** — pushes environmental fog farther away for clearer long-distance visibility.
|
||||
- **Pink Herbs** — makes herb nodes bright pink/purple so they are easier to spot.
|
||||
|
||||
## 🔊 New Audio Mods
|
||||
|
||||
All audio mods are optional and disabled by default.
|
||||
|
||||
- **NoErrorSounds** — removes many repetitive spell fizzle/error and interface sounds.
|
||||
- **FishPing** — replaces the fishing bite sound with a much easier-to-hear ping.
|
||||
- **Warlock Muted Demons** — mutes many repetitive Warlock demon voice lines.
|
||||
|
||||
## 🔐 AutoLogin Security Improvements
|
||||
|
||||
When **AutoLogin + Nampower** are enabled together, Modernization Tool now automatically creates or reuses the Windows user encryption key required by Nampower.
|
||||
|
||||
AutoLogin also enables password encryption by default when encryption is available. Existing user encryption keys are never replaced, and an explicit user choice to disable AutoLogin encryption is preserved.
|
||||
|
||||
## 💾 Installer & Safety Improvements
|
||||
|
||||
- Settings are remembered separately for each WoW installation.
|
||||
- Manually added entries and comments in `dlls.txt` are preserved.
|
||||
- Downloaded/bundled DLLs are validated before installation.
|
||||
- Important replacements are performed transactionally to reduce the risk of partial installs.
|
||||
- Existing valid files are kept when an upstream download fails.
|
||||
- Large visual mods are not re-downloaded when the installed revision is already current.
|
||||
- Legacy Modernization Tool files are cleaned up safely.
|
||||
- The selected game folder is validated before changes are made.
|
||||
|
||||
## 🚀 Launcher Improvements
|
||||
|
||||
After installation, **Play Modernized WoW** is created both:
|
||||
|
||||
- in the WoW game folder;
|
||||
- on the Windows Desktop.
|
||||
|
||||
Use either shortcut to launch the modernized client.
|
||||
|
||||
## 📦 Notable Bundled / Known-Good Versions
|
||||
|
||||
- VanillaFixes **1.5.3**
|
||||
- DXVK **2.6.1 x86**
|
||||
- Nampower **4.6.1**
|
||||
- ClassicAPI **1.12.7**
|
||||
- AuctionQueryThrottle **1.2.0**
|
||||
- UnitXP_SP3 **v90**
|
||||
- SuperWoW **2.2**
|
||||
- VanillaHelpers **1.1.2**
|
||||
- WeirdPerformance **0.7.3**
|
||||
- WorldMarkers **0.7.1**
|
||||
- VanillaMultiMonitorFix **0.2**
|
||||
- Interact **1.0.4**
|
||||
|
||||
## ✅ Updating from v1.1
|
||||
|
||||
Download **WoW_Modernization_Tool.exe**, select your existing WoW installation and click **Apply Setup & Tweaks**.
|
||||
Download the new executable, select your existing WoW folder and click **Apply Setup & Tweaks**.
|
||||
|
||||
A complete WoW reinstall is not required.
|
||||
|
||||
---
|
||||
|
||||
The detailed change list since **v1.1** is generated automatically by GitHub below.
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
# Modernization Tool third-party notices
|
||||
|
||||
Audit date: 2026-08-31
|
||||
|
||||
Modernization Tool combines an original installer/configuration layer with
|
||||
third-party client fixes, patchers, addons, DLLs, visual/audio modifications,
|
||||
and external download sources.
|
||||
|
||||
This document records the currently known licensing and distribution boundary.
|
||||
It does not replace upstream licenses or grant rights that the upstream authors
|
||||
did not grant.
|
||||
|
||||
## Project-owned material
|
||||
|
||||
Original Modernization Tool code and documentation authored by Dusk-92 are
|
||||
covered by the project notice in `LICENSE`.
|
||||
|
||||
Third-party material is excluded from that project notice and remains under its
|
||||
own terms.
|
||||
|
||||
### WowPresence
|
||||
|
||||
- Source: https://github.com/Dusk-92/WowPresence
|
||||
- Maintained by Dusk-92
|
||||
- Installed and updated from its GitHub Releases when Discord Rich Presence is selected
|
||||
- `WowPresence.dll` and `WowPresence.exe` are not bundled in the Modernization Tool payload
|
||||
- User configuration under `.modernization_tool/WowPresence/` is preserved across binary updates
|
||||
- See the WowPresence repository and its `THIRD_PARTY_NOTICES.md` for component-specific provenance
|
||||
|
||||
## Bundled components with a verified redistribution license
|
||||
|
||||
The following bundled components have a license text that was located and
|
||||
preserved during this audit:
|
||||
|
||||
### VanillaFixes
|
||||
|
||||
- Source: https://github.com/hannesmann/vanillafixes
|
||||
- Bundled files include `Payload/VanillaFixes.exe` and
|
||||
`Payload/VfPatcher.dll`
|
||||
- License: MIT
|
||||
- Preserved as `LICENSES/VanillaFixes-MIT.txt`
|
||||
|
||||
### DXVK
|
||||
|
||||
- Source: https://github.com/doitsujin/dxvk
|
||||
- Bundled file: `Payload/DXVK_Standard/d3d9.dll`
|
||||
- License: zlib/libpng
|
||||
- Preserved as `LICENSES/DXVK-zlib.txt`
|
||||
|
||||
### vanilla-tweaks
|
||||
|
||||
- Source: https://github.com/tubtubs/vanilla-tweaks
|
||||
- Bundled fallback: `vanilla-tweaks.exe`
|
||||
- License: MIT
|
||||
- Preserved as `LICENSES/vanilla-tweaks-MIT.txt`
|
||||
|
||||
### Nampower
|
||||
|
||||
- Source: https://github.com/brues-code/nampower
|
||||
- Bundled fallback: `Payload/nampower.dll`
|
||||
- License: BSD-style two-clause redistribution terms
|
||||
- Preserved as `LICENSES/Nampower-BSD.txt`
|
||||
|
||||
### VanillaHelpers
|
||||
|
||||
- Source: https://github.com/isfir/VanillaHelpers
|
||||
- Bundled fallback: `Payload/VanillaHelpers.dll`
|
||||
- Upstream carries GNU GPL v3 and GNU LGPL v3 license documents
|
||||
- Preserved as `LICENSES/VanillaHelpers-GPL-3.0.txt` and
|
||||
`LICENSES/VanillaHelpers-LGPL-3.0.txt`
|
||||
|
||||
### VanillaMultiMonitorFix
|
||||
|
||||
- Source: https://github.com/Mates1500/VanillaMultiMonitorFix
|
||||
- Bundled offline fallback under `Payload/Fallback/VanillaMultiMonitorFix/`
|
||||
- License: MIT
|
||||
- Preserved as `LICENSES/VanillaMultiMonitorFix-MIT.txt`
|
||||
|
||||
## SuperWoW and SuperAPI: upstream-only distribution
|
||||
|
||||
SuperWoW's current upstream license states that distribution is prohibited
|
||||
without the copyright holder's express written permission.
|
||||
|
||||
Because no written redistribution authorization is documented in this
|
||||
repository, Modernization Tool no longer bundles `SuperWoWhook.dll` as an
|
||||
offline fallback. The tool already downloads SuperWoW directly from the
|
||||
official upstream release when the user enables it.
|
||||
|
||||
- SuperWoW source: https://github.com/balakethelock/SuperWoW
|
||||
- License copy: `LICENSES/SuperWoW-LICENSE.txt`
|
||||
- Distribution mode: downloaded from upstream at install time; not bundled
|
||||
|
||||
SuperAPI is likewise downloaded directly from its upstream repository as part
|
||||
of the SuperWoW installation path and is no longer kept as a bundled fallback.
|
||||
|
||||
- SuperAPI source: https://github.com/balakethelock/SuperAPI
|
||||
- Distribution mode: downloaded from upstream at install time; not bundled
|
||||
|
||||
If the upstream download is unavailable, an already complete installed
|
||||
SuperWoW/SuperAPI setup may be kept by the tool, but a new offline installation
|
||||
cannot use a bundled SuperWoW fallback.
|
||||
|
||||
## Components whose redistribution license was not independently located
|
||||
|
||||
The following source projects or fallback sources did not expose a project-wide
|
||||
license file that could be independently verified during this audit, or their
|
||||
license status still needs a dedicated provenance review:
|
||||
|
||||
- UnitXP_SP3 — https://github.com/brues-code/UnitXP_SP3
|
||||
- Interact — https://github.com/lookino/Interact
|
||||
- RetroCro/TurtleWoW-Mods sources used for No1600x1200 and PerfBoost
|
||||
- FishPing — https://github.com/notsureawake/FishPing
|
||||
- NoErrorSounds — https://github.com/Macumbafeh/NoErrorSounds
|
||||
- Warlock Muted Demons — https://github.com/spzilyk/Warlock-Muted-Demons
|
||||
- Vanilla AutoLogin — https://github.com/MarcelineVQ/turtle-autologin
|
||||
- WeirdUtils releases referenced by the payload provenance manifest
|
||||
|
||||
Their source locations and hashes remain documented in
|
||||
`Payload/Fallback/versions.json` and/or `Docs/BINARY_PROVENANCE.md`.
|
||||
|
||||
The absence of a verified license in this audit must not be interpreted as a
|
||||
grant of redistribution rights. If explicit permission or an upstream license
|
||||
is later confirmed, preserve that evidence in `LICENSES/` and update this
|
||||
notice.
|
||||
|
||||
## ClassicAPI and AuctionQueryThrottle
|
||||
|
||||
Modernization Tool downloads current releases of ClassicAPI and
|
||||
AuctionQueryThrottle from their official upstream repositories and also
|
||||
currently retains known-good fallback binaries.
|
||||
|
||||
Both upstream repositories carry GNU GPL v3 license documents. Their licensing
|
||||
and source locations should be preserved alongside any redistributed fallback
|
||||
binaries. A copy of the GPL v3 text is stored in
|
||||
`LICENSES/GPL-3.0.txt`.
|
||||
|
||||
- ClassicAPI: https://github.com/brues-code/ClassicAPI
|
||||
- AuctionQueryThrottle: https://github.com/brues-code/AuctionQueryThrottle
|
||||
|
||||
## AutoLogin provenance
|
||||
|
||||
`Payload/Data/Interface/GlueXML/AutoLogin.xml` and `GlueXML.toc` are
|
||||
byte-identical at Git blob level to the corresponding files in
|
||||
`MarcelineVQ/turtle-autologin` at the time of this audit.
|
||||
|
||||
`AutoLogin.lua` is a modified variant of that upstream file and includes
|
||||
Modernization Tool-specific secure-default behavior. This is documented as
|
||||
adapted third-party material rather than claimed as wholly original.
|
||||
|
||||
## Visual and audio material
|
||||
|
||||
Visual/audio replacements and game-facing assets may have copyright or
|
||||
trademark considerations separate from software licenses.
|
||||
|
||||
See `Docs/ASSET_PROVENANCE.md` for project branding and game-facing asset
|
||||
notes. Source paths for bundled audio fallbacks remain recorded in
|
||||
`Payload/Fallback/versions.json`.
|
||||
|
||||
## Blizzard / World of Warcraft
|
||||
|
||||
Modernization Tool is unofficial and independent.
|
||||
|
||||
World of Warcraft, Warcraft, Blizzard Entertainment, and associated names,
|
||||
marks, artwork, audio, client files, and game assets remain the property of
|
||||
their respective rights holders. Nothing in this repository grants additional
|
||||
rights in those materials.
|
||||
|
||||
## Preservation rule
|
||||
|
||||
When a bundled component is updated, replaced, or moved to upstream-only
|
||||
distribution:
|
||||
|
||||
1. keep its source URL and version;
|
||||
2. keep or update the applicable license/permission record;
|
||||
3. preserve hashes for redistributed binaries where practical;
|
||||
4. do not remove historical attribution simply because the file is no longer
|
||||
bundled.
|
||||
+916
-27
File diff suppressed because it is too large
Load Diff
+124
-24
@@ -107,6 +107,7 @@ class WowSetupTool:
|
||||
"minimapicons.dll": "Adds TBC/WotLK-style minimap tracking icons for NPCs and objects, combined into a new native tracking dropdown.",
|
||||
"pngscreenshots.dll": "Saves screenshots as compressed PNG files on a background thread to completely eliminate frame drops when taking pictures.",
|
||||
"worldmarkers.dll": "Place up to 5 animated colored markers (Cataclysm style) in the world for raid positioning. Syncs automatically with other users.",
|
||||
"WowPresence.dll": "Shows your WoW character activity on Discord using WowPresence by Dusk-92. Modernization Tool downloads and updates WowPresence from its GitHub releases, stores its configuration and status under .modernization_tool\\WowPresence, and preconfigures the OctoWoW Discord Application ID. Advanced users can change .modernization_tool\\WowPresence\\discord_application_id for another Discord application. If Discord runs as administrator, WoW must also run as administrator for Rich Presence to work.",
|
||||
|
||||
# Tweaks Tab
|
||||
"fov": "Calculates horizontal Field of View mathematically scaled to maintain vertical aspect space based on your screen ratio.",
|
||||
@@ -129,7 +130,7 @@ class WowSetupTool:
|
||||
"pretty_night_sky": "Replaces the Vanilla night sky with a more detailed starry sky. Installed file: Data\\patch-Z.mpq. The original hosted patch-9 name is deliberately changed so the official numeric patch-9.mpq is never overwritten.",
|
||||
"epoch_water": "Replaces Vanilla water textures with the Epoch Water visual pack. Installed file: Data\\patch-W.mpq.",
|
||||
"fog_pushback": "Pushes environmental fog farther back for a clearer long-distance view. Installed file: Data\\patch-Y.mpq. Works best together with an increased Farclip value.",
|
||||
"pink_herbs": "Turns most herb-node textures bright pink/purple to make gathering nodes easier to spot. Installed file: Data\\patch-H.mpq.",
|
||||
"pink_herbs": "Turns most herb-node textures bright pink/purple to make gathering nodes easier to spot. Installed file: Data\\patch-V.mpq. The patch-V name avoids conflicts with other visual packs that use patch-H.mpq.",
|
||||
"no_error_sounds": "Installs the complete NoErrorSounds pack: muted spell fizzle sounds plus its included muted interface sounds. Installed as loose WAV files under Sound\\Spells\\Fizzle and Sound\\interface (no MPQ).",
|
||||
"fish_ping": "Replaces the fishing bite sound with a much more noticeable ping. Installed file: Sound\\Spells\\Tradeskills\\FishBite.wav (no MPQ). Designed specifically for WoW Vanilla 1.12.1.",
|
||||
"warlock_muted_demons": "Mutes the repeated voice lines from Warlock demons using Vanilla-compatible loose sound replacements. Installed as loose WAV files under Data\\Sound\\Creature (no MPQ)."
|
||||
@@ -172,7 +173,8 @@ class WowSetupTool:
|
||||
"logsessions.dll": tk.BooleanVar(value=False),
|
||||
"minimapicons.dll": tk.BooleanVar(value=False),
|
||||
"pngscreenshots.dll": tk.BooleanVar(value=False),
|
||||
"worldmarkers.dll": tk.BooleanVar(value=False)
|
||||
"worldmarkers.dll": tk.BooleanVar(value=False),
|
||||
"WowPresence.dll": tk.BooleanVar(value=False)
|
||||
}
|
||||
|
||||
self.addon_dependencies = {
|
||||
@@ -525,6 +527,7 @@ class WowSetupTool:
|
||||
"Disable one of them before applying the setup.",
|
||||
)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def load_settings(self, target_dir):
|
||||
@@ -1082,6 +1085,10 @@ class WowSetupTool:
|
||||
"WOW_ENCRYPTION_KEY automatically; existing keys are never replaced)"
|
||||
)
|
||||
|
||||
text_area.insert("end", "\n• WowPresence: ", "bold")
|
||||
text_area.insert("end", "by Dusk-92 | ")
|
||||
insert_link("Source Repository", "https://github.com/Dusk-92/WowPresence")
|
||||
|
||||
# WeirdUtils
|
||||
text_area.insert("end", "\n\nWeirdUtils Suite\n", "header")
|
||||
text_area.insert(
|
||||
@@ -1302,10 +1309,45 @@ class WowSetupTool:
|
||||
# 3. Clean unselected Optional plugins.
|
||||
for dll_name, var in self.optional_plugins.items():
|
||||
if not var.get():
|
||||
remove_managed_file(
|
||||
os.path.join(target, dll_name),
|
||||
f"managed plugin {dll_name}",
|
||||
)
|
||||
if dll_name == "WowPresence.dll":
|
||||
# Only undo a WowPresence installation that this tool
|
||||
# actually owns. A standalone/manual WowPresence install
|
||||
# must survive an Apply with this option unchecked.
|
||||
if remote_packages.managed_mod_has_manifest(
|
||||
target,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
):
|
||||
preexisting_entry = remote_packages.managed_mod_manifest_value(
|
||||
target,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
"dlls_entry_preexisting",
|
||||
None,
|
||||
)
|
||||
if not isinstance(preexisting_entry, bool):
|
||||
# Conservative migration for early test manifests:
|
||||
# a saved DLL backup means WowPresence predated the
|
||||
# tool, so preserve its dlls.txt entry.
|
||||
preexisting_entry = remote_packages._managed_backup_exists(
|
||||
target,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
"WowPresence.dll",
|
||||
)
|
||||
|
||||
if not preexisting_entry:
|
||||
self._remove_dlls_entry(target, "WowPresence.dll")
|
||||
|
||||
# This restores any backed-up manual binaries, or
|
||||
# removes only the copies installed by the tool.
|
||||
remote_packages.remove_managed_mod(
|
||||
target,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
)
|
||||
# Keep .modernization_tool\WowPresence user configuration.
|
||||
else:
|
||||
remove_managed_file(
|
||||
os.path.join(target, dll_name),
|
||||
f"managed plugin {dll_name}",
|
||||
)
|
||||
|
||||
|
||||
@staticmethod
|
||||
@@ -1683,13 +1725,19 @@ class WowSetupTool:
|
||||
# is enough to trigger one fresh download when a source/version changes.
|
||||
for key, managed_id, display_name, installer in visual_defs:
|
||||
if self.visual_mods[key].get():
|
||||
revision = remote_packages.VISUAL_MOD_REVISIONS[managed_id]
|
||||
if remote_packages.managed_mpq_is_current(
|
||||
target,
|
||||
managed_id,
|
||||
revision,
|
||||
):
|
||||
continue
|
||||
# Hosted static mirrors use explicit revisions and can be
|
||||
# skipped without any network request. Pink Herbs follows a
|
||||
# GitHub branch, so its installer performs a lightweight
|
||||
# branch-SHA check before deciding whether a download is
|
||||
# needed.
|
||||
if key != "pink_herbs":
|
||||
revision = remote_packages.VISUAL_MOD_REVISIONS[managed_id]
|
||||
if remote_packages.managed_mpq_is_current(
|
||||
target,
|
||||
managed_id,
|
||||
revision,
|
||||
):
|
||||
continue
|
||||
|
||||
try:
|
||||
installer(target, progress=progress)
|
||||
@@ -1792,12 +1840,12 @@ class WowSetupTool:
|
||||
escaped_script = script_path.replace("'", "''")
|
||||
launcher = (
|
||||
"$ErrorActionPreference='Stop'; "
|
||||
f"$scriptPath = '{escaped_script}'; "
|
||||
"$argumentLine = '-NoProfile -NonInteractive -ExecutionPolicy Bypass -File \"' "
|
||||
"+ $scriptPath + '\"'; "
|
||||
"try { "
|
||||
"$p = Start-Process -FilePath 'powershell.exe' -Verb RunAs "
|
||||
"-Wait -PassThru -ArgumentList @("
|
||||
"'-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass',"
|
||||
f"'-File','{escaped_script}'"
|
||||
"); "
|
||||
"-Wait -PassThru -ArgumentList $argumentLine; "
|
||||
"exit $p.ExitCode "
|
||||
"} catch { Write-Error $_; exit 1 }"
|
||||
)
|
||||
@@ -2021,6 +2069,12 @@ class WowSetupTool:
|
||||
vanilla_fixes_exe = os.path.join(target_dir, "VanillaFixes.exe")
|
||||
modernized_exe = os.path.join(target_dir, "WoW_Modernized.exe")
|
||||
|
||||
# Keep the launcher path unchanged. When enabled, WowPresence.dll
|
||||
# starts WowPresence.exe from its worker thread after WoW is running.
|
||||
launcher_exe = vanilla_fixes_exe
|
||||
launcher_arguments = "WoW_Modernized.exe"
|
||||
launcher_description = "Launch Vanilla WoW with VanillaFixes and Tweaks"
|
||||
|
||||
if not os.path.isfile(vanilla_fixes_exe):
|
||||
raise RuntimeError(
|
||||
"VanillaFixes.exe is missing, so the launcher shortcuts cannot be created."
|
||||
@@ -2056,10 +2110,10 @@ class WowSetupTool:
|
||||
Set oWS = WScript.CreateObject("WScript.Shell")
|
||||
sLinkFile = "{vbs_escape(staged_shortcut)}"
|
||||
Set oLink = oWS.CreateShortcut(sLinkFile)
|
||||
oLink.TargetPath = "{vbs_escape(vanilla_fixes_exe)}"
|
||||
oLink.Arguments = "WoW_Modernized.exe"
|
||||
oLink.TargetPath = "{vbs_escape(launcher_exe)}"
|
||||
oLink.Arguments = "{vbs_escape(launcher_arguments)}"
|
||||
oLink.WorkingDirectory = "{vbs_escape(target_dir)}"
|
||||
oLink.Description = "Launch Vanilla WoW with VanillaFixes and Tweaks"
|
||||
oLink.Description = "{vbs_escape(launcher_description)}"
|
||||
{icon_vbs_line}
|
||||
oLink.Save
|
||||
WScript.Echo oWS.SpecialFolders("Desktop")
|
||||
@@ -2292,11 +2346,23 @@ WScript.Echo oWS.SpecialFolders("Desktop")
|
||||
self._park_external_renderer_file(target, filename)
|
||||
|
||||
|
||||
def _managed_dll_entries(self):
|
||||
"""Return every dlls.txt entry owned by this tool."""
|
||||
def _managed_dll_entries(self, target=None):
|
||||
"""Return dlls.txt entries this tool is allowed to rewrite."""
|
||||
managed = {"dxvk"}
|
||||
managed.update(name.casefold() for name in self.core_plugins)
|
||||
managed.update(name.casefold() for name in self.optional_plugins)
|
||||
|
||||
for name, var in self.optional_plugins.items():
|
||||
if name.casefold() == "wowpresence.dll" and target is not None:
|
||||
selected = bool(var.get())
|
||||
owned = remote_packages.managed_mod_has_manifest(
|
||||
target,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
)
|
||||
if not selected and not owned:
|
||||
# A standalone WowPresence.dll line is user-owned.
|
||||
continue
|
||||
managed.add(name.casefold())
|
||||
|
||||
managed.update(
|
||||
name.casefold()
|
||||
for name in (
|
||||
@@ -2304,14 +2370,48 @@ WScript.Echo oWS.SpecialFolders("Desktop")
|
||||
"AuctionQueryThrottle.dll",
|
||||
"VanillaMultiMonitorFix.dll",
|
||||
"Interact.dll",
|
||||
# Legacy test-branch name. Owning it here removes the stale
|
||||
# entry from dlls.txt when migrating to WowPresence.dll.
|
||||
"DiscordPresence.dll",
|
||||
)
|
||||
)
|
||||
return managed
|
||||
|
||||
@staticmethod
|
||||
def _remove_dlls_entry(target, entry):
|
||||
"""Remove one exact DLL entry while preserving all unrelated lines."""
|
||||
dlls_path = os.path.join(target, "dlls.txt")
|
||||
if not os.path.isfile(dlls_path):
|
||||
return
|
||||
wanted = str(entry).strip().casefold()
|
||||
try:
|
||||
with open(dlls_path, "r", encoding="utf-8", errors="ignore") as handle:
|
||||
lines = handle.read().splitlines()
|
||||
except OSError as exc:
|
||||
raise RuntimeError(f"Could not read existing dlls.txt: {exc}") from exc
|
||||
|
||||
kept = [
|
||||
line for line in lines
|
||||
if line.strip().casefold() != wanted
|
||||
]
|
||||
staged = dlls_path + ".modernization-new"
|
||||
try:
|
||||
with open(staged, "w", encoding="utf-8", newline="\n") as handle:
|
||||
if kept:
|
||||
handle.write("\n".join(kept) + "\n")
|
||||
os.replace(staged, dlls_path)
|
||||
except OSError as exc:
|
||||
try:
|
||||
if os.path.exists(staged):
|
||||
os.remove(staged)
|
||||
except OSError:
|
||||
pass
|
||||
raise RuntimeError(f"Could not update existing dlls.txt: {exc}") from exc
|
||||
|
||||
def _write_dlls_file(self, target, active_managed_lines):
|
||||
"""Rewrite only tool-owned dlls.txt entries and preserve user entries."""
|
||||
dlls_path = os.path.join(target, "dlls.txt")
|
||||
managed_names = self._managed_dll_entries()
|
||||
managed_names = self._managed_dll_entries(target)
|
||||
preserved = []
|
||||
seen_preserved = set()
|
||||
|
||||
|
||||
+370
-20
@@ -18,6 +18,23 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
self.auction_throttle_enabled = tk.BooleanVar(master=root, value=True)
|
||||
self.vmmfix_enabled = tk.BooleanVar(master=root, value=False)
|
||||
self.interact_enabled = tk.BooleanVar(master=root, value=False)
|
||||
|
||||
# Discord Rich Presence detail choices are kept independently from the
|
||||
# main WowPresence checkbox so hiding/disabling the integration never
|
||||
# destroys the user's selected disclosure preferences.
|
||||
self.discord_show_character_details = tk.BooleanVar(master=root, value=True)
|
||||
self.discord_detail_vars = {
|
||||
"name": tk.BooleanVar(master=root, value=True),
|
||||
"guild": tk.BooleanVar(master=root, value=True),
|
||||
"race": tk.BooleanVar(master=root, value=True),
|
||||
"faction": tk.BooleanVar(master=root, value=True),
|
||||
"class": tk.BooleanVar(master=root, value=True),
|
||||
"level": tk.BooleanVar(master=root, value=True),
|
||||
"zone": tk.BooleanVar(master=root, value=True),
|
||||
}
|
||||
self.discord_presence_details_frame = None
|
||||
self.discord_detail_checkbuttons = {}
|
||||
|
||||
self._download_window = None
|
||||
self._download_label = None
|
||||
self._download_detail = None
|
||||
@@ -26,6 +43,199 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
self._download_indeterminate = False
|
||||
super().__init__(root)
|
||||
|
||||
def _collect_settings(self):
|
||||
settings = super()._collect_settings()
|
||||
settings["discord_presence"] = {
|
||||
"show_character_details": bool(self.discord_show_character_details.get()),
|
||||
"details": {
|
||||
name: bool(var.get())
|
||||
for name, var in self.discord_detail_vars.items()
|
||||
},
|
||||
}
|
||||
return settings
|
||||
|
||||
def _apply_settings_dict(self, saved):
|
||||
super()._apply_settings_dict(saved)
|
||||
|
||||
discord = saved.get("discord_presence") if isinstance(saved, dict) else None
|
||||
if not isinstance(discord, dict):
|
||||
return
|
||||
|
||||
show_details = discord.get("show_character_details")
|
||||
if isinstance(show_details, bool):
|
||||
self.discord_show_character_details.set(show_details)
|
||||
|
||||
details = discord.get("details")
|
||||
if isinstance(details, dict):
|
||||
for name, value in details.items():
|
||||
var = self.discord_detail_vars.get(name)
|
||||
if var is not None and isinstance(value, bool):
|
||||
var.set(value)
|
||||
|
||||
def _load_wowpresence_broadcast_preferences(self, target_dir):
|
||||
"""Migrate the old six-bit mask into the new seven-choice UI."""
|
||||
mask = remote_packages.read_wowpresence_broadcast_flags(target_dir)
|
||||
if mask is None:
|
||||
return
|
||||
|
||||
bits = {
|
||||
"name": remote_packages.WOWPRESENCE_SHARE_NAME,
|
||||
"guild": remote_packages.WOWPRESENCE_SHARE_GUILD,
|
||||
"faction": remote_packages.WOWPRESENCE_SHARE_FACTION,
|
||||
"class": remote_packages.WOWPRESENCE_SHARE_CLASS,
|
||||
"level": remote_packages.WOWPRESENCE_SHARE_LEVEL,
|
||||
"zone": remote_packages.WOWPRESENCE_SHARE_ZONE,
|
||||
}
|
||||
for name, bit in bits.items():
|
||||
self.discord_detail_vars[name].set(bool(mask & bit))
|
||||
|
||||
# WowPresence versions before the dedicated Race flag always exposed
|
||||
# race information regardless of the six-bit mask. Treat masks <= 63
|
||||
# as legacy so the migration preserves exactly that visible behavior.
|
||||
if mask <= 63:
|
||||
self.discord_detail_vars["race"].set(True)
|
||||
else:
|
||||
self.discord_detail_vars["race"].set(
|
||||
bool(mask & remote_packages.WOWPRESENCE_SHARE_RACE)
|
||||
)
|
||||
|
||||
# "Show character details" now means "show everything". Only select it
|
||||
# automatically when the existing configuration already represents the
|
||||
# full legacy/default disclosure set. Any custom mask stays custom.
|
||||
legacy_all = (
|
||||
mask <= 63
|
||||
and (mask & 63) == 63
|
||||
)
|
||||
current_all = (
|
||||
mask > 63
|
||||
and (mask & remote_packages.WOWPRESENCE_SHARE_ALL)
|
||||
== remote_packages.WOWPRESENCE_SHARE_ALL
|
||||
)
|
||||
self.discord_show_character_details.set(legacy_all or current_all)
|
||||
if self.discord_show_character_details.get():
|
||||
for var in self.discord_detail_vars.values():
|
||||
var.set(True)
|
||||
|
||||
def _load_legacy_install_state(self, target_dir):
|
||||
super()._load_legacy_install_state(target_dir)
|
||||
self._load_wowpresence_broadcast_preferences(target_dir)
|
||||
|
||||
def load_settings(self, target_dir):
|
||||
settings_path = self._settings_path(target_dir)
|
||||
has_saved_discord_preferences = False
|
||||
try:
|
||||
with open(settings_path, "r", encoding="utf-8") as handle:
|
||||
saved = json.load(handle)
|
||||
has_saved_discord_preferences = isinstance(
|
||||
saved.get("discord_presence") if isinstance(saved, dict) else None,
|
||||
dict,
|
||||
)
|
||||
except (OSError, json.JSONDecodeError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
loaded = super().load_settings(target_dir)
|
||||
|
||||
# Existing v2.1 settings.json files predate the detailed controls. Read
|
||||
# their actual WowPresence mask once so manual choices are not lost.
|
||||
if os.path.isfile(settings_path) and not has_saved_discord_preferences:
|
||||
self._load_wowpresence_broadcast_preferences(target_dir)
|
||||
|
||||
self.update_discord_presence_controls()
|
||||
return loaded
|
||||
|
||||
def _discord_broadcast_mask(self):
|
||||
if self.discord_show_character_details.get():
|
||||
return remote_packages.WOWPRESENCE_SHARE_ALL
|
||||
|
||||
bits = {
|
||||
"name": remote_packages.WOWPRESENCE_SHARE_NAME,
|
||||
"guild": remote_packages.WOWPRESENCE_SHARE_GUILD,
|
||||
"race": remote_packages.WOWPRESENCE_SHARE_RACE,
|
||||
"faction": remote_packages.WOWPRESENCE_SHARE_FACTION,
|
||||
"class": remote_packages.WOWPRESENCE_SHARE_CLASS,
|
||||
"level": remote_packages.WOWPRESENCE_SHARE_LEVEL,
|
||||
"zone": remote_packages.WOWPRESENCE_SHARE_ZONE,
|
||||
}
|
||||
mask = 0
|
||||
for name, bit in bits.items():
|
||||
var = self.discord_detail_vars.get(name)
|
||||
if var is not None and var.get():
|
||||
mask |= bit
|
||||
return mask
|
||||
|
||||
def _toggle_discord_all_details(self):
|
||||
show_all = bool(self.discord_show_character_details.get())
|
||||
if show_all:
|
||||
for var in self.discord_detail_vars.values():
|
||||
var.set(True)
|
||||
self.update_discord_detail_states()
|
||||
|
||||
def update_discord_detail_states(self):
|
||||
state = "disabled" if self.discord_show_character_details.get() else "normal"
|
||||
for checkbox in getattr(self, "discord_detail_checkbuttons", {}).values():
|
||||
try:
|
||||
checkbox.configure(state=state)
|
||||
except tk.TclError:
|
||||
pass
|
||||
|
||||
def update_discord_presence_controls(self):
|
||||
frame = getattr(self, "discord_presence_details_frame", None)
|
||||
if frame is None:
|
||||
return
|
||||
|
||||
var = self.optional_plugins.get("WowPresence.dll")
|
||||
visible = bool(var is not None and var.get())
|
||||
manager = frame.winfo_manager()
|
||||
|
||||
if visible and not manager:
|
||||
frame.pack(fill="x", padx=(22, 8), pady=(0, 4))
|
||||
elif not visible and manager:
|
||||
frame.pack_forget()
|
||||
|
||||
if visible:
|
||||
self.update_discord_detail_states()
|
||||
|
||||
def _build_discord_presence_details(self, parent):
|
||||
frame = ttk.Frame(parent)
|
||||
self.discord_presence_details_frame = frame
|
||||
|
||||
show_cb = ttk.Checkbutton(
|
||||
frame,
|
||||
text="Show character details",
|
||||
variable=self.discord_show_character_details,
|
||||
command=self._toggle_discord_all_details,
|
||||
)
|
||||
show_cb.pack(anchor="w", padx=6, pady=(1, 2))
|
||||
ToolTip(
|
||||
show_cb,
|
||||
"When enabled, all character details are shown and the individual choices "
|
||||
"below are locked. Uncheck it to choose each detail separately.",
|
||||
)
|
||||
|
||||
labels = {
|
||||
"name": "Character Name",
|
||||
"guild": "Guild",
|
||||
"race": "Race",
|
||||
"faction": "Faction",
|
||||
"class": "Class",
|
||||
"level": "Level",
|
||||
"zone": "Zone",
|
||||
}
|
||||
for name, label in labels.items():
|
||||
cb = ttk.Checkbutton(
|
||||
frame,
|
||||
text=label,
|
||||
variable=self.discord_detail_vars[name],
|
||||
)
|
||||
cb.pack(anchor="w", padx=24, pady=1)
|
||||
self.discord_detail_checkbuttons[name] = cb
|
||||
ToolTip(
|
||||
cb,
|
||||
f"Choose whether WowPresence may publish your {label.lower()} on Discord.",
|
||||
)
|
||||
|
||||
self.update_discord_presence_controls()
|
||||
|
||||
def _show_download_progress(self):
|
||||
if self._download_window is not None and self._download_window.winfo_exists():
|
||||
return
|
||||
@@ -294,19 +504,33 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
"minimapicons.dll": "MinimapIcons",
|
||||
"pngscreenshots.dll": "PNG Screenshots",
|
||||
"worldmarkers.dll": "WorldMarkers",
|
||||
"WowPresence.dll": "Discord Rich Presence",
|
||||
}
|
||||
optional_attribution = {
|
||||
"WowPresence.dll": "by Dusk-92",
|
||||
}
|
||||
|
||||
for dll, var in self.optional_plugins.items():
|
||||
if dll == "no1600x1200.dll":
|
||||
continue
|
||||
|
||||
command = (
|
||||
self.update_discord_presence_controls
|
||||
if dll == "WowPresence.dll"
|
||||
else None
|
||||
)
|
||||
self._plugin_row(
|
||||
right_frame,
|
||||
optional_display.get(dll, os.path.splitext(dll)[0]),
|
||||
var,
|
||||
"by MarcelineVQ",
|
||||
optional_attribution.get(dll, "by MarcelineVQ"),
|
||||
self.descriptions.get(dll, ""),
|
||||
command=command,
|
||||
)
|
||||
|
||||
if dll == "WowPresence.dll":
|
||||
self._build_discord_presence_details(right_frame)
|
||||
|
||||
def clean_unselected_files(self, target):
|
||||
super().clean_unselected_files(target)
|
||||
|
||||
@@ -554,6 +778,7 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
patcher_source,
|
||||
patcher_version,
|
||||
patcher_path,
|
||||
patcher_revision=None,
|
||||
):
|
||||
wow_exe = os.path.join(target, "WoW.exe")
|
||||
output_exe = os.path.join(target, "WoW_Modernized.exe")
|
||||
@@ -566,9 +791,12 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
os.makedirs(os.path.dirname(marker_path), exist_ok=True)
|
||||
temp_path = marker_path + ".new"
|
||||
payload = {
|
||||
"schema": 1,
|
||||
"schema": 2,
|
||||
"patcher_source": patcher_source,
|
||||
"patcher_version": str(patcher_version),
|
||||
"patcher_revision": (
|
||||
str(patcher_revision) if patcher_revision is not None else None
|
||||
),
|
||||
"patcher_sha256": (
|
||||
self._file_sha256(patcher_path)
|
||||
if patcher_path and os.path.isfile(patcher_path)
|
||||
@@ -619,19 +847,23 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
return False, None
|
||||
|
||||
def run_vanilla_tweaks(self, target):
|
||||
# Prefer the latest stable tubtubs build on every Apply. If the network
|
||||
# is unavailable, preserve an already valid/current WoW_Modernized.exe
|
||||
# instead of unnecessarily repatching it with an older bundled build.
|
||||
# First compare the small GitHub release metadata with the patcher
|
||||
# revision already recorded for this exact WoW.exe/settings output.
|
||||
# The multi-megabyte Windows package is downloaded only when needed.
|
||||
existing_matches, marker = self._existing_vanilla_tweaks_output_matches(
|
||||
target
|
||||
)
|
||||
|
||||
try:
|
||||
tweaks_exe, extract_root, version = remote_packages.prepare_vanilla_tweaks(
|
||||
progress=self._report_download_progress,
|
||||
self._report_download_progress(
|
||||
"Checking vanilla-tweaks release...",
|
||||
None,
|
||||
None,
|
||||
)
|
||||
release_info = remote_packages.vanilla_tweaks_release_info()
|
||||
except Exception as exc:
|
||||
self._close_download_progress()
|
||||
|
||||
existing_matches, marker = self._existing_vanilla_tweaks_output_matches(
|
||||
target
|
||||
)
|
||||
if existing_matches:
|
||||
patcher_version = (
|
||||
marker.get("patcher_version", "previously installed")
|
||||
@@ -640,10 +872,9 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
)
|
||||
messagebox.showwarning(
|
||||
"Latest vanilla-tweaks unavailable",
|
||||
"Could not download the latest tubtubs/vanilla-tweaks build.\n\n"
|
||||
"Could not check the latest tubtubs/vanilla-tweaks build.\n\n"
|
||||
"Your existing WoW_Modernized.exe matches the current WoW.exe "
|
||||
"and all executable patch settings, so it was kept unchanged "
|
||||
f"instead of being repatched with the bundled fallback.\n\n"
|
||||
"and all executable patch settings, so it was kept unchanged.\n\n"
|
||||
f"Existing patcher version: {patcher_version}\n\n"
|
||||
f"Details: {exc}",
|
||||
)
|
||||
@@ -653,7 +884,81 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
bundled_exe = os.path.join(get_base_path(), "vanilla-tweaks.exe")
|
||||
messagebox.showwarning(
|
||||
"Latest vanilla-tweaks unavailable",
|
||||
"Could not download the latest tubtubs/vanilla-tweaks build.\n\n"
|
||||
"Could not check the latest tubtubs/vanilla-tweaks build.\n\n"
|
||||
"The current WoW.exe or executable patch settings need to be "
|
||||
"repatched, so the bundled known-good vanilla-tweaks build will "
|
||||
f"be used instead ({bundled['version']}).\n\n"
|
||||
f"Details: {exc}",
|
||||
)
|
||||
|
||||
result = super().run_vanilla_tweaks(
|
||||
target,
|
||||
tweaks_exe=bundled_exe,
|
||||
modern_cli=True,
|
||||
)
|
||||
self._write_vanilla_tweaks_marker(
|
||||
target,
|
||||
patcher_source="bundled",
|
||||
patcher_version=bundled["version"],
|
||||
patcher_path=bundled_exe,
|
||||
)
|
||||
return result
|
||||
|
||||
remote_revision = release_info["revision"]
|
||||
remote_version = release_info["version"]
|
||||
if existing_matches and isinstance(marker, dict):
|
||||
same_online_patcher = (
|
||||
marker.get("patcher_source") == "online"
|
||||
and (
|
||||
str(marker.get("patcher_revision")) == str(remote_revision)
|
||||
or (
|
||||
marker.get("patcher_revision") in (None, "")
|
||||
and str(marker.get("patcher_version")) == str(remote_version)
|
||||
)
|
||||
)
|
||||
)
|
||||
if same_online_patcher:
|
||||
self._report_download_progress(
|
||||
f"vanilla-tweaks {remote_version} is already current.",
|
||||
None,
|
||||
None,
|
||||
)
|
||||
self._close_download_progress()
|
||||
return os.path.join(target, "WoW_Modernized.exe")
|
||||
|
||||
try:
|
||||
tweaks_exe, extract_root, version, revision = (
|
||||
remote_packages.prepare_vanilla_tweaks(
|
||||
progress=self._report_download_progress,
|
||||
release_info=release_info,
|
||||
)
|
||||
)
|
||||
except Exception as exc:
|
||||
self._close_download_progress()
|
||||
|
||||
# A remote update may exist but be temporarily unavailable. Keep a
|
||||
# valid existing output rather than downgrading or repatching it.
|
||||
if existing_matches:
|
||||
patcher_version = (
|
||||
marker.get("patcher_version", "previously installed")
|
||||
if isinstance(marker, dict)
|
||||
else "previously installed"
|
||||
)
|
||||
messagebox.showwarning(
|
||||
"Latest vanilla-tweaks unavailable",
|
||||
"The latest vanilla-tweaks package could not be downloaded.\n\n"
|
||||
"Your existing WoW_Modernized.exe still matches the current "
|
||||
"WoW.exe and all executable patch settings, so it was kept unchanged.\n\n"
|
||||
f"Existing patcher version: {patcher_version}\n\n"
|
||||
f"Details: {exc}",
|
||||
)
|
||||
return os.path.join(target, "WoW_Modernized.exe")
|
||||
|
||||
bundled = self._bundled_vanilla_tweaks_info()
|
||||
bundled_exe = os.path.join(get_base_path(), "vanilla-tweaks.exe")
|
||||
messagebox.showwarning(
|
||||
"Latest vanilla-tweaks unavailable",
|
||||
"The latest vanilla-tweaks package could not be downloaded.\n\n"
|
||||
"The current WoW.exe or executable patch settings need to be "
|
||||
"repatched, so the bundled known-good vanilla-tweaks build will "
|
||||
f"be used instead ({bundled['version']}).\n\n"
|
||||
@@ -689,6 +994,7 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
patcher_source="online",
|
||||
patcher_version=version,
|
||||
patcher_path=tweaks_exe,
|
||||
patcher_revision=revision,
|
||||
)
|
||||
return result
|
||||
finally:
|
||||
@@ -704,9 +1010,9 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
dlls_text_lines.append("dxvk")
|
||||
|
||||
try:
|
||||
# Core plugins. UnitXP and SuperWoW are refreshed from their upstream
|
||||
# sources every time setup is applied. Their bundled copies remain an
|
||||
# offline fallback so this feature does not reduce current reliability.
|
||||
# Core plugins are refreshed from their upstream sources where supported.
|
||||
# Bundled fallbacks are used only for components whose redistribution
|
||||
# model allows it. SuperWoW/SuperAPI are upstream-only.
|
||||
for dll_name, var in self.core_plugins.items():
|
||||
if not var.get():
|
||||
continue
|
||||
@@ -821,15 +1127,59 @@ class ModernWowSetupTool(WowSetupTool):
|
||||
self._fallback_interact(target, exc)
|
||||
dlls_text_lines.append("Interact.dll")
|
||||
|
||||
# Optional WeirdUtils.
|
||||
# Optional WeirdUtils and WowPresence.
|
||||
for dll_name, var in self.optional_plugins.items():
|
||||
if dll_name == "no1600x1200.dll":
|
||||
continue
|
||||
if var.get():
|
||||
if not var.get():
|
||||
continue
|
||||
|
||||
if dll_name == "WowPresence.dll":
|
||||
try:
|
||||
remote_packages.install_wowpresence(
|
||||
target,
|
||||
progress=self._report_download_progress,
|
||||
)
|
||||
except Exception as exc:
|
||||
existing_dll = os.path.join(target, "WowPresence.dll")
|
||||
existing_exe = os.path.join(target, "WowPresence.exe")
|
||||
if (
|
||||
self._valid_x86_dll(existing_dll, "WowPresence.dll")
|
||||
and self._valid_x86_dll(existing_exe, "WowPresence.exe")
|
||||
):
|
||||
remote_packages.ensure_wowpresence_config(target)
|
||||
self._warn_offline(
|
||||
"WowPresence",
|
||||
"Keeping the currently installed WowPresence binaries.",
|
||||
exc,
|
||||
)
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"Could not install WowPresence from "
|
||||
"https://github.com/Dusk-92/WowPresence releases."
|
||||
) from exc
|
||||
|
||||
# Remove the old test-branch filenames after a successful
|
||||
# migration. The legacy config directory is intentionally
|
||||
# left untouched so the user can remove it manually.
|
||||
for legacy_name in ("DiscordPresence.dll", "DiscordPresence.exe"):
|
||||
legacy_path = os.path.join(target, legacy_name)
|
||||
if os.path.isfile(legacy_path):
|
||||
try:
|
||||
os.remove(legacy_path)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
remote_packages.write_wowpresence_broadcast_flags(
|
||||
target,
|
||||
self._discord_broadcast_mask(),
|
||||
)
|
||||
else:
|
||||
source_dll = os.path.join(payload_weirdu, dll_name)
|
||||
if os.path.exists(source_dll):
|
||||
shutil.copy2(source_dll, target)
|
||||
dlls_text_lines.append(dll_name)
|
||||
|
||||
dlls_text_lines.append(dll_name)
|
||||
|
||||
# Preserve user-added dlls.txt entries; replace only entries
|
||||
# managed by Modernization Tool.
|
||||
|
||||
@@ -7,7 +7,9 @@ from unittest import mock
|
||||
|
||||
import remote_packages
|
||||
import setup_tool
|
||||
import setup_tool_dynamic
|
||||
from setup_tool import WowSetupTool
|
||||
from setup_tool_dynamic import ModernWowSetupTool
|
||||
|
||||
|
||||
class FakeVar:
|
||||
@@ -279,6 +281,72 @@ class ManagedPackageTests(unittest.TestCase):
|
||||
)
|
||||
)
|
||||
|
||||
def test_pink_herbs_v2_migration_restores_original_patch_h(self):
|
||||
with tempfile.TemporaryDirectory() as root, tempfile.TemporaryDirectory() as src:
|
||||
mod_id = "visual_pink_herbs"
|
||||
legacy_rel = os.path.join("Data", "patch-H.mpq")
|
||||
new_rel = os.path.join("Data", "patch-V.mpq")
|
||||
legacy_target = os.path.join(root, legacy_rel)
|
||||
source = os.path.join(src, "pink-herbs.mpq")
|
||||
|
||||
os.makedirs(os.path.dirname(legacy_target))
|
||||
with open(source, "wb") as handle:
|
||||
handle.write(b"MPQ pink-herbs")
|
||||
with open(legacy_target, "wb") as handle:
|
||||
handle.write(b"MPQ pink-herbs")
|
||||
|
||||
_, _, backup_root = remote_packages._managed_locations(root, mod_id)
|
||||
backup_h = os.path.join(backup_root, legacy_rel)
|
||||
os.makedirs(os.path.dirname(backup_h))
|
||||
with open(backup_h, "wb") as handle:
|
||||
handle.write(b"MPQ faithful-upscale")
|
||||
|
||||
remote_packages._write_managed_manifest(
|
||||
root, mod_id, [legacy_rel], revision="1"
|
||||
)
|
||||
remote_packages._migrate_legacy_pink_herbs_patch(root, source)
|
||||
remote_packages._install_managed_files(
|
||||
root, mod_id, [(source, new_rel)], revision="2"
|
||||
)
|
||||
|
||||
with open(legacy_target, "rb") as handle:
|
||||
self.assertEqual(handle.read(), b"MPQ faithful-upscale")
|
||||
with open(os.path.join(root, new_rel), "rb") as handle:
|
||||
self.assertEqual(handle.read(), b"MPQ pink-herbs")
|
||||
|
||||
def test_pink_herbs_v2_migration_preserves_replaced_patch_h(self):
|
||||
with tempfile.TemporaryDirectory() as root, tempfile.TemporaryDirectory() as src:
|
||||
mod_id = "visual_pink_herbs"
|
||||
legacy_rel = os.path.join("Data", "patch-H.mpq")
|
||||
new_rel = os.path.join("Data", "patch-V.mpq")
|
||||
legacy_target = os.path.join(root, legacy_rel)
|
||||
source = os.path.join(src, "pink-herbs.mpq")
|
||||
|
||||
os.makedirs(os.path.dirname(legacy_target))
|
||||
with open(source, "wb") as handle:
|
||||
handle.write(b"MPQ pink-herbs")
|
||||
with open(legacy_target, "wb") as handle:
|
||||
handle.write(b"MPQ replacement-patch-h")
|
||||
|
||||
_, _, backup_root = remote_packages._managed_locations(root, mod_id)
|
||||
backup_h = os.path.join(backup_root, legacy_rel)
|
||||
os.makedirs(os.path.dirname(backup_h))
|
||||
with open(backup_h, "wb") as handle:
|
||||
handle.write(b"MPQ older-original-patch-h")
|
||||
|
||||
remote_packages._write_managed_manifest(
|
||||
root, mod_id, [legacy_rel], revision="1"
|
||||
)
|
||||
remote_packages._migrate_legacy_pink_herbs_patch(root, source)
|
||||
remote_packages._install_managed_files(
|
||||
root, mod_id, [(source, new_rel)], revision="2"
|
||||
)
|
||||
|
||||
with open(legacy_target, "rb") as handle:
|
||||
self.assertEqual(handle.read(), b"MPQ replacement-patch-h")
|
||||
with open(os.path.join(root, new_rel), "rb") as handle:
|
||||
self.assertEqual(handle.read(), b"MPQ pink-herbs")
|
||||
|
||||
def test_transactional_sound_pack_rolls_back_all_files_and_manifest(self):
|
||||
with tempfile.TemporaryDirectory() as root, tempfile.TemporaryDirectory() as src:
|
||||
mod_id = "audio_test"
|
||||
@@ -468,6 +536,59 @@ class AutoLoginEncryptionTests(unittest.TestCase):
|
||||
os.environ["WOW_ENCRYPTION_KEY"] = original
|
||||
|
||||
|
||||
class DepElevationTests(unittest.TestCase):
|
||||
def test_quotes_script_path_when_game_folder_contains_spaces(self):
|
||||
tool = WowSetupTool.__new__(WowSetupTool)
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="01 OctoWoW ") as root:
|
||||
captured = {}
|
||||
|
||||
def fake_run(args, **kwargs):
|
||||
captured["args"] = args
|
||||
script_path = os.path.join(
|
||||
root,
|
||||
".modernization_tool",
|
||||
"process_mitigation.ps1",
|
||||
)
|
||||
self.assertIn(" ", script_path)
|
||||
self.assertTrue(os.path.isfile(script_path))
|
||||
return mock.Mock(returncode=0, stdout="", stderr="")
|
||||
|
||||
with mock.patch("setup_tool.subprocess.run", side_effect=fake_run):
|
||||
tool._run_elevated_powershell(
|
||||
root,
|
||||
"Set-ProcessMitigation -Name 'WoW_Modernized.exe' "
|
||||
"-Disable DEP, EmulateAtlThunks",
|
||||
"Disabling DEP for WoW_Modernized.exe",
|
||||
)
|
||||
|
||||
launcher = captured["args"][-1]
|
||||
escaped_script = os.path.join(
|
||||
root,
|
||||
".modernization_tool",
|
||||
"process_mitigation.ps1",
|
||||
).replace("'", "''")
|
||||
|
||||
self.assertIn(
|
||||
f"$scriptPath = '{escaped_script}';",
|
||||
launcher,
|
||||
)
|
||||
self.assertIn(
|
||||
"'-NoProfile -NonInteractive -ExecutionPolicy Bypass -File \"' "
|
||||
"+ $scriptPath + '\"'",
|
||||
launcher,
|
||||
)
|
||||
self.assertFalse(
|
||||
os.path.exists(
|
||||
os.path.join(
|
||||
root,
|
||||
".modernization_tool",
|
||||
"process_mitigation.ps1",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class PeValidationTests(unittest.TestCase):
|
||||
def write_minimal_x86_pe(self, path):
|
||||
data = bytearray(2048)
|
||||
@@ -493,6 +614,534 @@ class PeValidationTests(unittest.TestCase):
|
||||
remote_packages._verify_x86_pe(bad, "bad.dll")
|
||||
|
||||
|
||||
class SmartUpdateTests(unittest.TestCase):
|
||||
def test_package_state_tracks_revision_and_local_integrity(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
dll = os.path.join(root, "Example.dll")
|
||||
addon = os.path.join(root, "Interface", "AddOns", "Example")
|
||||
os.makedirs(addon)
|
||||
with open(dll, "wb") as handle:
|
||||
handle.write(b"dll-v1")
|
||||
with open(os.path.join(addon, "Example.toc"), "wb") as handle:
|
||||
handle.write(b"addon-v1")
|
||||
|
||||
remote_packages._record_package_state(
|
||||
root,
|
||||
"example",
|
||||
"v1",
|
||||
["Example.dll", os.path.join("Interface", "AddOns", "Example")],
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
remote_packages._package_state_is_current(root, "example", "v1")
|
||||
)
|
||||
self.assertFalse(
|
||||
remote_packages._package_state_is_current(root, "example", "v2")
|
||||
)
|
||||
|
||||
with open(os.path.join(addon, "Example.toc"), "wb") as handle:
|
||||
handle.write(b"modified")
|
||||
self.assertFalse(
|
||||
remote_packages._package_state_is_current(root, "example", "v1")
|
||||
)
|
||||
|
||||
def test_release_asset_revision_detects_replaced_asset_under_same_tag(self):
|
||||
release_a = {
|
||||
"tag_name": "Release",
|
||||
"assets": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "package.zip",
|
||||
"updated_at": "2026-09-01T10:00:00Z",
|
||||
"size": 100,
|
||||
}
|
||||
],
|
||||
}
|
||||
release_b = {
|
||||
"tag_name": "Release",
|
||||
"assets": [
|
||||
{
|
||||
"id": 2,
|
||||
"name": "package.zip",
|
||||
"updated_at": "2026-09-02T10:00:00Z",
|
||||
"size": 120,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
self.assertNotEqual(
|
||||
remote_packages._release_asset_revision(
|
||||
release_a,
|
||||
release_a["assets"][0],
|
||||
),
|
||||
remote_packages._release_asset_revision(
|
||||
release_b,
|
||||
release_b["assets"][0],
|
||||
),
|
||||
)
|
||||
|
||||
def test_release_component_skips_download_when_revision_and_hashes_match(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
target = os.path.join(root, "ClassicAPI.dll")
|
||||
with open(target, "wb") as handle:
|
||||
handle.write(b"already-installed")
|
||||
|
||||
release = {
|
||||
"tag_name": "v-test",
|
||||
"assets": [
|
||||
{
|
||||
"name": "ClassicAPI.dll",
|
||||
"browser_download_url": "https://example.invalid/ClassicAPI.dll",
|
||||
}
|
||||
],
|
||||
}
|
||||
revision = remote_packages._release_asset_revision(
|
||||
release,
|
||||
release["assets"][0],
|
||||
)
|
||||
remote_packages._record_package_state(
|
||||
root,
|
||||
"classicapi",
|
||||
revision,
|
||||
["ClassicAPI.dll"],
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
"remote_packages._latest_release",
|
||||
return_value=release,
|
||||
), mock.patch(
|
||||
"remote_packages._download_asset",
|
||||
side_effect=AssertionError("unchanged component was downloaded"),
|
||||
) as download:
|
||||
self.assertEqual(
|
||||
remote_packages.install_classicapi(root),
|
||||
"v-test",
|
||||
)
|
||||
|
||||
download.assert_not_called()
|
||||
|
||||
def test_branch_component_skips_archive_when_commit_and_files_match(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
sound = os.path.join(root, "Sound", "example.wav")
|
||||
os.makedirs(os.path.dirname(sound))
|
||||
with open(sound, "wb") as handle:
|
||||
handle.write(b"sound")
|
||||
|
||||
remote_packages._record_package_state(
|
||||
root,
|
||||
"audio_example",
|
||||
"abcdef1234567890",
|
||||
[os.path.join("Sound", "example.wav")],
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
"remote_packages._branch_head_sha",
|
||||
return_value="abcdef1234567890",
|
||||
), mock.patch(
|
||||
"remote_packages._download_github_branch_archive",
|
||||
side_effect=AssertionError("unchanged branch archive was downloaded"),
|
||||
) as download:
|
||||
revision = remote_packages._install_github_sound_pack(
|
||||
root,
|
||||
"audio_example",
|
||||
"owner/repo",
|
||||
"main",
|
||||
"Sound",
|
||||
"Sound",
|
||||
)
|
||||
|
||||
self.assertEqual(revision, "abcdef1234567890")
|
||||
download.assert_not_called()
|
||||
|
||||
def test_vanilla_tweaks_skips_package_when_output_and_revision_match(self):
|
||||
tool = setup_tool_dynamic.ModernWowSetupTool.__new__(
|
||||
setup_tool_dynamic.ModernWowSetupTool
|
||||
)
|
||||
tool._existing_vanilla_tweaks_output_matches = mock.Mock(
|
||||
return_value=(
|
||||
True,
|
||||
{
|
||||
"patcher_source": "online",
|
||||
"patcher_version": "Vanilla Tweaks v1",
|
||||
"patcher_revision": "v1",
|
||||
},
|
||||
)
|
||||
)
|
||||
tool._report_download_progress = mock.Mock()
|
||||
tool._close_download_progress = mock.Mock()
|
||||
|
||||
release_info = {
|
||||
"release": {},
|
||||
"asset": {},
|
||||
"revision": "v1",
|
||||
"version": "Vanilla Tweaks v1",
|
||||
}
|
||||
|
||||
with tempfile.TemporaryDirectory() as root, mock.patch(
|
||||
"setup_tool_dynamic.remote_packages.vanilla_tweaks_release_info",
|
||||
return_value=release_info,
|
||||
), mock.patch(
|
||||
"setup_tool_dynamic.remote_packages.prepare_vanilla_tweaks",
|
||||
side_effect=AssertionError("unchanged vanilla-tweaks was downloaded"),
|
||||
) as prepare:
|
||||
result = tool.run_vanilla_tweaks(root)
|
||||
|
||||
self.assertEqual(result, os.path.join(root, "WoW_Modernized.exe"))
|
||||
prepare.assert_not_called()
|
||||
tool._close_download_progress.assert_called_once()
|
||||
|
||||
|
||||
class WowPresenceIntegrationTests(unittest.TestCase):
|
||||
def make_tool(self, selected=False):
|
||||
tool = WowSetupTool.__new__(WowSetupTool)
|
||||
tool.install_autologin = FakeVar(False)
|
||||
tool.core_plugins = {}
|
||||
tool.addon_dependencies = {}
|
||||
tool.optional_plugins = {
|
||||
"WowPresence.dll": FakeVar(selected),
|
||||
}
|
||||
return tool
|
||||
|
||||
def test_config_defaults_migrate_placeholder_and_preserve_custom_id(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
data_dir = remote_packages.ensure_wowpresence_config(root)
|
||||
app_id = os.path.join(data_dir, "discord_application_id")
|
||||
flags = os.path.join(data_dir, "discord_broadcast_flags")
|
||||
|
||||
with open(app_id, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(
|
||||
handle.read().strip(),
|
||||
remote_packages.WOWPRESENCE_DEFAULT_APPLICATION_ID,
|
||||
)
|
||||
with open(flags, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "127")
|
||||
|
||||
with open(app_id, "w", encoding="ascii") as handle:
|
||||
handle.write(
|
||||
remote_packages.WOWPRESENCE_APPLICATION_ID_PLACEHOLDER + "\n"
|
||||
)
|
||||
remote_packages.ensure_wowpresence_config(root)
|
||||
with open(app_id, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(
|
||||
handle.read().strip(),
|
||||
remote_packages.WOWPRESENCE_DEFAULT_APPLICATION_ID,
|
||||
)
|
||||
|
||||
with open(app_id, "w", encoding="ascii") as handle:
|
||||
handle.write("123456789012345678\n")
|
||||
with open(flags, "w", encoding="ascii") as handle:
|
||||
handle.write("31\n")
|
||||
remote_packages.ensure_wowpresence_config(root)
|
||||
with open(app_id, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "123456789012345678")
|
||||
with open(flags, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "31")
|
||||
|
||||
def test_install_wowpresence_from_zip_preserves_user_config(self):
|
||||
with tempfile.TemporaryDirectory() as root, tempfile.TemporaryDirectory() as package_root:
|
||||
data_dir = remote_packages.ensure_wowpresence_config(root)
|
||||
app_id = os.path.join(data_dir, "discord_application_id")
|
||||
flags = os.path.join(data_dir, "discord_broadcast_flags")
|
||||
with open(app_id, "w", encoding="ascii") as handle:
|
||||
handle.write("123456789012345678\n")
|
||||
with open(flags, "w", encoding="ascii") as handle:
|
||||
handle.write("31\n")
|
||||
|
||||
dll = os.path.join(package_root, "WowPresence.dll")
|
||||
exe = os.path.join(package_root, "WowPresence.exe")
|
||||
PeValidationTests().write_minimal_x86_pe(dll)
|
||||
PeValidationTests().write_minimal_x86_pe(exe)
|
||||
|
||||
zip_path = os.path.join(package_root, "WowPresence.zip")
|
||||
with remote_packages.zipfile.ZipFile(zip_path, "w") as archive:
|
||||
archive.write(dll, "WowPresence.dll")
|
||||
archive.write(exe, "WowPresence.exe")
|
||||
archive.writestr(
|
||||
"WowPresence/discord_application_id",
|
||||
"999999999999999999\n",
|
||||
)
|
||||
archive.writestr("WowPresence/discord_broadcast_flags", "0\n")
|
||||
|
||||
release = {
|
||||
"tag_name": "v-test",
|
||||
"assets": [
|
||||
{
|
||||
"name": "WowPresence.zip",
|
||||
"browser_download_url": "https://example.invalid/WowPresence.zip",
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
with mock.patch(
|
||||
"remote_packages._latest_release",
|
||||
return_value=release,
|
||||
) as latest_release, mock.patch(
|
||||
"remote_packages._download_asset",
|
||||
return_value=zip_path,
|
||||
) as download:
|
||||
self.assertEqual(
|
||||
remote_packages.install_wowpresence(root),
|
||||
"v-test",
|
||||
)
|
||||
|
||||
latest_release.assert_called_once_with(
|
||||
remote_packages.WOWPRESENCE_REPO,
|
||||
)
|
||||
download.assert_called_once()
|
||||
remote_packages._verify_x86_pe(
|
||||
os.path.join(root, "WowPresence.dll"),
|
||||
"WowPresence.dll",
|
||||
)
|
||||
remote_packages._verify_x86_pe(
|
||||
os.path.join(root, "WowPresence.exe"),
|
||||
"WowPresence.exe",
|
||||
)
|
||||
|
||||
with open(app_id, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "123456789012345678")
|
||||
with open(flags, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "31")
|
||||
|
||||
manifest = remote_packages._load_managed_manifest_data(
|
||||
root,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
)
|
||||
self.assertEqual(manifest.get("revision"), "v-test")
|
||||
self.assertEqual(
|
||||
set((manifest.get("file_sha256") or {}).keys()),
|
||||
{"WowPresence.dll", "WowPresence.exe"},
|
||||
)
|
||||
|
||||
def test_unchecked_manual_wowpresence_is_untouched(self):
|
||||
tool = self.make_tool(selected=False)
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
dll = os.path.join(root, "WowPresence.dll")
|
||||
exe = os.path.join(root, "WowPresence.exe")
|
||||
dlls = os.path.join(root, "dlls.txt")
|
||||
with open(dll, "wb") as handle:
|
||||
handle.write(b"manual-dll")
|
||||
with open(exe, "wb") as handle:
|
||||
handle.write(b"manual-exe")
|
||||
with open(dlls, "w", encoding="utf-8") as handle:
|
||||
handle.write("WowPresence.dll\nManual.dll\n")
|
||||
|
||||
tool.clean_unselected_files(root)
|
||||
tool._write_dlls_file(root, [])
|
||||
|
||||
self.assertTrue(os.path.isfile(dll))
|
||||
self.assertTrue(os.path.isfile(exe))
|
||||
with open(dlls, "r", encoding="utf-8") as handle:
|
||||
self.assertIn("WowPresence.dll", handle.read().splitlines())
|
||||
|
||||
def test_unchecked_tool_owned_wowpresence_is_removed_but_config_survives(self):
|
||||
tool = self.make_tool(selected=False)
|
||||
with tempfile.TemporaryDirectory() as root, tempfile.TemporaryDirectory() as src:
|
||||
source_dll = os.path.join(src, "WowPresence.dll")
|
||||
source_exe = os.path.join(src, "WowPresence.exe")
|
||||
with open(source_dll, "wb") as handle:
|
||||
handle.write(b"tool-dll")
|
||||
with open(source_exe, "wb") as handle:
|
||||
handle.write(b"tool-exe")
|
||||
|
||||
remote_packages._install_managed_files_transactional(
|
||||
root,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
[
|
||||
(source_dll, "WowPresence.dll"),
|
||||
(source_exe, "WowPresence.exe"),
|
||||
],
|
||||
revision="v-test",
|
||||
)
|
||||
remote_packages._set_managed_manifest_values(
|
||||
root,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
dlls_entry_preexisting=False,
|
||||
)
|
||||
data_dir = remote_packages.ensure_wowpresence_config(root)
|
||||
with open(os.path.join(root, "dlls.txt"), "w", encoding="utf-8") as handle:
|
||||
handle.write("WowPresence.dll\nManual.dll\n")
|
||||
|
||||
tool.clean_unselected_files(root)
|
||||
tool._write_dlls_file(root, [])
|
||||
|
||||
self.assertFalse(os.path.exists(os.path.join(root, "WowPresence.dll")))
|
||||
self.assertFalse(os.path.exists(os.path.join(root, "WowPresence.exe")))
|
||||
self.assertTrue(os.path.isdir(data_dir))
|
||||
with open(os.path.join(root, "dlls.txt"), "r", encoding="utf-8") as handle:
|
||||
lines = handle.read().splitlines()
|
||||
self.assertNotIn("WowPresence.dll", lines)
|
||||
self.assertIn("Manual.dll", lines)
|
||||
|
||||
def test_manual_wowpresence_is_restored_after_tool_ownership(self):
|
||||
tool = self.make_tool(selected=False)
|
||||
with tempfile.TemporaryDirectory() as root, tempfile.TemporaryDirectory() as src:
|
||||
live_dll = os.path.join(root, "WowPresence.dll")
|
||||
live_exe = os.path.join(root, "WowPresence.exe")
|
||||
with open(live_dll, "wb") as handle:
|
||||
handle.write(b"manual-dll")
|
||||
with open(live_exe, "wb") as handle:
|
||||
handle.write(b"manual-exe")
|
||||
with open(os.path.join(root, "dlls.txt"), "w", encoding="utf-8") as handle:
|
||||
handle.write("WowPresence.dll\n")
|
||||
|
||||
source_dll = os.path.join(src, "WowPresence.dll")
|
||||
source_exe = os.path.join(src, "WowPresence.exe")
|
||||
with open(source_dll, "wb") as handle:
|
||||
handle.write(b"managed-dll")
|
||||
with open(source_exe, "wb") as handle:
|
||||
handle.write(b"managed-exe")
|
||||
|
||||
remote_packages._install_managed_files_transactional(
|
||||
root,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
[
|
||||
(source_dll, "WowPresence.dll"),
|
||||
(source_exe, "WowPresence.exe"),
|
||||
],
|
||||
revision="v-test",
|
||||
)
|
||||
remote_packages._set_managed_manifest_values(
|
||||
root,
|
||||
remote_packages.WOWPRESENCE_MANAGED_ID,
|
||||
dlls_entry_preexisting=True,
|
||||
)
|
||||
|
||||
tool.clean_unselected_files(root)
|
||||
tool._write_dlls_file(root, [])
|
||||
|
||||
with open(live_dll, "rb") as handle:
|
||||
self.assertEqual(handle.read(), b"manual-dll")
|
||||
with open(live_exe, "rb") as handle:
|
||||
self.assertEqual(handle.read(), b"manual-exe")
|
||||
with open(os.path.join(root, "dlls.txt"), "r", encoding="utf-8") as handle:
|
||||
self.assertIn("WowPresence.dll", handle.read().splitlines())
|
||||
|
||||
def test_installed_asset_integrity_detects_corruption(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
path = os.path.join(root, "WowPresence.dll")
|
||||
payload = b"A" * 2048
|
||||
with open(path, "wb") as handle:
|
||||
handle.write(payload)
|
||||
digest = __import__("hashlib").sha256(payload).hexdigest()
|
||||
asset = {
|
||||
"size": len(payload),
|
||||
"digest": "sha256:" + digest,
|
||||
}
|
||||
self.assertTrue(
|
||||
remote_packages._installed_asset_is_current(
|
||||
path,
|
||||
asset,
|
||||
"WowPresence.dll",
|
||||
)
|
||||
)
|
||||
|
||||
with open(path, "r+b") as handle:
|
||||
handle.seek(100)
|
||||
handle.write(b"B")
|
||||
self.assertFalse(
|
||||
remote_packages._installed_asset_is_current(
|
||||
path,
|
||||
asset,
|
||||
"WowPresence.dll",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class WowPresenceDetailPreferenceTests(unittest.TestCase):
|
||||
def make_tool(self):
|
||||
tool = ModernWowSetupTool.__new__(ModernWowSetupTool)
|
||||
tool.discord_show_character_details = FakeVar(True)
|
||||
tool.discord_detail_vars = {
|
||||
"name": FakeVar(True),
|
||||
"guild": FakeVar(True),
|
||||
"race": FakeVar(True),
|
||||
"faction": FakeVar(True),
|
||||
"class": FakeVar(True),
|
||||
"level": FakeVar(True),
|
||||
"zone": FakeVar(True),
|
||||
}
|
||||
return tool
|
||||
|
||||
def test_detail_mask_supports_race_and_all_details_switch(self):
|
||||
tool = self.make_tool()
|
||||
self.assertEqual(
|
||||
tool._discord_broadcast_mask(),
|
||||
remote_packages.WOWPRESENCE_SHARE_ALL,
|
||||
)
|
||||
|
||||
# The master switch always means "show all" even if a variable is
|
||||
# changed programmatically while its checkbox would be disabled.
|
||||
tool.discord_detail_vars["race"].set(False)
|
||||
self.assertEqual(
|
||||
tool._discord_broadcast_mask(),
|
||||
remote_packages.WOWPRESENCE_SHARE_ALL,
|
||||
)
|
||||
|
||||
# Once the master is off, the individual choices become authoritative.
|
||||
tool.discord_show_character_details.set(False)
|
||||
self.assertEqual(tool._discord_broadcast_mask(), 63)
|
||||
self.assertFalse(tool.discord_detail_vars["race"].get())
|
||||
self.assertTrue(tool.discord_detail_vars["zone"].get())
|
||||
|
||||
def test_legacy_six_bit_mask_keeps_race_enabled(self):
|
||||
tool = self.make_tool()
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
data_dir = remote_packages.ensure_wowpresence_config(root)
|
||||
flags = os.path.join(data_dir, "discord_broadcast_flags")
|
||||
with open(flags, "w", encoding="ascii") as handle:
|
||||
handle.write("31\n")
|
||||
|
||||
tool._load_wowpresence_broadcast_preferences(root)
|
||||
|
||||
self.assertFalse(tool.discord_show_character_details.get())
|
||||
self.assertTrue(tool.discord_detail_vars["name"].get())
|
||||
self.assertTrue(tool.discord_detail_vars["guild"].get())
|
||||
self.assertTrue(tool.discord_detail_vars["faction"].get())
|
||||
self.assertTrue(tool.discord_detail_vars["class"].get())
|
||||
self.assertTrue(tool.discord_detail_vars["level"].get())
|
||||
self.assertFalse(tool.discord_detail_vars["zone"].get())
|
||||
self.assertTrue(tool.discord_detail_vars["race"].get())
|
||||
|
||||
def test_legacy_default_mask_selects_all_details(self):
|
||||
tool = self.make_tool()
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
data_dir = remote_packages.ensure_wowpresence_config(root)
|
||||
flags = os.path.join(data_dir, "discord_broadcast_flags")
|
||||
with open(flags, "w", encoding="ascii") as handle:
|
||||
handle.write("63\n")
|
||||
|
||||
tool._load_wowpresence_broadcast_preferences(root)
|
||||
|
||||
self.assertTrue(tool.discord_show_character_details.get())
|
||||
self.assertTrue(all(var.get() for var in tool.discord_detail_vars.values()))
|
||||
self.assertEqual(
|
||||
tool._discord_broadcast_mask(),
|
||||
remote_packages.WOWPRESENCE_SHARE_ALL,
|
||||
)
|
||||
|
||||
def test_broadcast_flag_writer_preserves_other_config(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
data_dir = remote_packages.ensure_wowpresence_config(root)
|
||||
app_id = os.path.join(data_dir, "discord_application_id")
|
||||
with open(app_id, "w", encoding="ascii") as handle:
|
||||
handle.write("123456789012345678\n")
|
||||
|
||||
path = remote_packages.write_wowpresence_broadcast_flags(
|
||||
root,
|
||||
remote_packages.WOWPRESENCE_SHARE_ALL,
|
||||
)
|
||||
self.assertEqual(
|
||||
remote_packages.read_wowpresence_broadcast_flags(root),
|
||||
127,
|
||||
)
|
||||
with open(path, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "127")
|
||||
with open(app_id, "r", encoding="ascii") as handle:
|
||||
self.assertEqual(handle.read().strip(), "123456789012345678")
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
remote_packages.write_wowpresence_broadcast_flags(root, 128)
|
||||
|
||||
class SettingsRecoveryTests(unittest.TestCase):
|
||||
def test_corrupt_settings_are_left_untouched_and_legacy_state_is_recovered(self):
|
||||
tool = WowSetupTool.__new__(WowSetupTool)
|
||||
|
||||
Reference in New Issue
Block a user