mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Pet.git
synced 2026-10-29 16:40:54 +00:00
Freewood-OctoWoW-Pet 0.1.136
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
+126
@@ -0,0 +1,126 @@
|
||||
-- Freewood-OctoWoW-Pet: Familienfaktoren (Leben, Ruestung, Schaden)
|
||||
-- Werte laut wow-petopia.com/forever (Gegenpruefung mit den Classic-Werten).
|
||||
-- nil = auf der Quelle nicht angegeben. Reihenfolge: hp, armor, dmg.
|
||||
|
||||
local ADDON, NS = ...
|
||||
|
||||
local Pet = NS.Pet
|
||||
if not Pet then
|
||||
return
|
||||
end
|
||||
|
||||
local FAMILIES = {
|
||||
bat = { 1.00, 1.00, 1.07, names = { "fledermaus", "bat" } },
|
||||
bear = { 1.08, 1.05, 0.91, names = { "bär", "bear" } },
|
||||
birdofprey = { 1.00, 1.00, 1.07, names = { "raubvogel", "bird of prey" } },
|
||||
boar = { 1.04, 1.09, 0.90, names = { "eber", "boar" } },
|
||||
carrionbird = { 1.00, 1.05, 1.00, names = { "aasvogel", "aasvoge", "carrion bird" } },
|
||||
cat = { 0.98, 1.00, 1.10, names = { "katze", "cat" } },
|
||||
corehound = { nil, nil, 1.00, names = { "kernhund", "core hound" } },
|
||||
crab = { 0.96, 1.13, 0.95, names = { "krebs", "crab" } },
|
||||
crocolisk = { 0.95, 1.10, 1.00, names = { "krokil", "krokilisk", "krokolisk", "crocolisk" } },
|
||||
fox = { nil, nil, 1.00, names = { "fuchs", "fox" } },
|
||||
gorilla = { 1.04, 1.00, 1.02, names = { "gorilla" } },
|
||||
hyena = { 1.00, 1.05, 1.00, names = { "hyäne", "hyaene", "hyena" } },
|
||||
owl = { nil, nil, nil, names = { "eule", "owl" } },
|
||||
raptor = { 0.95, 1.03, 1.10, names = { "raptor" } },
|
||||
scorpid = { 1.00, 1.10, 0.94, names = { "skorpid", "scorpid" } },
|
||||
spider = { 1.00, 1.00, 1.07, names = { "spinne", "spider" } },
|
||||
tallstrider = { 1.05, 1.00, 1.00, names = { "weitschreiter", "tallstrider" } },
|
||||
turtle = { 1.00, 1.13, 0.90, names = { "schildkröte", "turtle" } },
|
||||
windserpent = { 1.00, 1.00, 1.07, names = { "windnatter", "wind serpent" } },
|
||||
wolf = { 1.00, 1.05, 1.00, names = { "wolf" } },
|
||||
}
|
||||
|
||||
local BY_NAME = {}
|
||||
for id, data in pairs(FAMILIES) do
|
||||
for _, n in ipairs(data.names) do
|
||||
BY_NAME[n] = id
|
||||
end
|
||||
end
|
||||
|
||||
-- Liefert { hp = n|nil, armor = n|nil, dmg = n|nil, id = "bear" } oder nil
|
||||
function Pet.GetFamilyMods(familyName)
|
||||
if type(familyName) ~= "string" or familyName == "" then
|
||||
return nil
|
||||
end
|
||||
local key = string.lower(familyName)
|
||||
local id = BY_NAME[key]
|
||||
if not id and #key >= 4 then
|
||||
-- Abgekuerzte Namen (z. B. "Krokil"): Anfang eines bekannten Namens
|
||||
for name, fid in pairs(BY_NAME) do
|
||||
if string.sub(name, 1, #key) == key then
|
||||
id = fid
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not id then
|
||||
return nil
|
||||
end
|
||||
local d = FAMILIES[id]
|
||||
return { id = id, hp = d[1], armor = d[2], dmg = d[3] }
|
||||
end
|
||||
|
||||
-- Wie GetFamilyMods, aber mit der Familien-ID ("bear")
|
||||
function Pet.GetFamilyModsByID(id)
|
||||
local d = id and FAMILIES[id]
|
||||
if not d then
|
||||
return nil
|
||||
end
|
||||
return { id = id, hp = d[1], armor = d[2], dmg = d[3] }
|
||||
end
|
||||
|
||||
-- Anzeigenamen (so wie sie im Spiel erscheinen; das Spiel kuerzt manche deutsche Namen)
|
||||
local DISPLAY = {
|
||||
deDE = { bat = "Fledermaus", bear = "Bär", birdofprey = "Raubvogel", boar = "Eber", carrionbird = "Aasvoge",
|
||||
cat = "Katze", corehound = "Kernhund", crab = "Krebs", crocolisk = "Krokil", fox = "Fuchs",
|
||||
gorilla = "Gorilla", hyena = "Hyäne", owl = "Eule", raptor = "Raptor", scorpid = "Skorpid",
|
||||
spider = "Spinne", tallstrider = "Weitschreiter", turtle = "Schildkröte", windserpent = "Windnatter",
|
||||
wolf = "Wolf" },
|
||||
enUS = { bat = "Bat", bear = "Bear", birdofprey = "Bird of Prey", boar = "Boar", carrionbird = "Carrion Bird",
|
||||
cat = "Cat", corehound = "Core Hound", crab = "Crab", crocolisk = "Crocolisk", fox = "Fox",
|
||||
gorilla = "Gorilla", hyena = "Hyena", owl = "Owl", raptor = "Raptor", scorpid = "Scorpid",
|
||||
spider = "Spider", tallstrider = "Tallstrider", turtle = "Turtle", windserpent = "Wind Serpent",
|
||||
wolf = "Wolf" },
|
||||
}
|
||||
|
||||
-- Symbole der Familien (Spiel-Icons); fehlt eines, kommt das Zaehmen-Symbol
|
||||
local ICONS = {
|
||||
bat = "Ability_Hunter_Pet_Bat", bear = "Ability_Hunter_Pet_Bear", boar = "Ability_Hunter_Pet_Boar",
|
||||
carrionbird = "Ability_Hunter_Pet_Vulture", cat = "Ability_Hunter_Pet_Cat", crab = "Ability_Hunter_Pet_Crab",
|
||||
crocolisk = "Ability_Hunter_Pet_Crocolisk", gorilla = "Ability_Hunter_Pet_Gorilla",
|
||||
hyena = "Ability_Hunter_Pet_Hyena", owl = "Ability_Hunter_Pet_Owl", raptor = "Ability_Hunter_Pet_Raptor",
|
||||
scorpid = "Ability_Hunter_Pet_Scorpid", spider = "Ability_Hunter_Pet_Spider",
|
||||
tallstrider = "Ability_Hunter_Pet_TallStrider", turtle = "Ability_Hunter_Pet_Turtle",
|
||||
windserpent = "Ability_Hunter_Pet_WindSerpent", wolf = "Ability_Hunter_Pet_Wolf",
|
||||
}
|
||||
|
||||
-- Symbolpfad zu einem Familiennamen (wie im Spiel gelesen) oder einer Familien-ID
|
||||
function Pet.FamilyIcon(nameOrID)
|
||||
local id = nameOrID and (FAMILIES[nameOrID] and nameOrID or Pet.GetFamilyID(nameOrID))
|
||||
return "Interface\\Icons\\" .. ((id and ICONS[id]) or "Ability_Hunter_BeastTaming")
|
||||
end
|
||||
|
||||
-- Familien-ID zu einem im Spiel gelesenen Namen (oder nil)
|
||||
function Pet.GetFamilyID(familyName)
|
||||
local m = Pet.GetFamilyMods(familyName)
|
||||
return m and m.id or nil
|
||||
end
|
||||
|
||||
-- Liste aller Familien-IDs
|
||||
function Pet.GetFamilyIDs()
|
||||
local list = {}
|
||||
for id in pairs(FAMILIES) do
|
||||
list[#list + 1] = id
|
||||
end
|
||||
table.sort(list)
|
||||
return list
|
||||
end
|
||||
|
||||
-- Anzeigename einer Familie in der Spielsprache (Rueckfall: Englisch, dann ID)
|
||||
function Pet.FamilyDisplay(id)
|
||||
local loc = (GetLocale and GetLocale()) or "enUS"
|
||||
local set = DISPLAY[loc] or DISPLAY.enUS
|
||||
return set[id] or DISPLAY.enUS[id] or tostring(id)
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
## Interface: 11200
|
||||
## Title: Freewood |cffc89b3cPet|r
|
||||
## Notes: Records your hunter companions with stats and abilities, with export and import.
|
||||
## Notes-deDE: Erfasst deine Jäger-Begleiter mit Werten und Fähigkeiten, mit Export und Import.
|
||||
## Author: Lacustat
|
||||
## Version: 0.1.136
|
||||
## Dependencies: Freewood-OctoWoW-Core
|
||||
|
||||
Locales.lua
|
||||
Pet.lua
|
||||
Families.lua
|
||||
PetUI.lua
|
||||
@@ -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>.
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
-- Freewood-OctoWoW-Pet: Texte
|
||||
local ADDON, NS = ...
|
||||
|
||||
local FW = _G.Freewood
|
||||
if not FW then
|
||||
return
|
||||
end
|
||||
|
||||
FW:AddLocale("enUS", {
|
||||
PET_TITLE = "Hunter Companion",
|
||||
PET_DESC = "Records your hunter pets with stats and abilities.",
|
||||
PET_TAB = "Companion",
|
||||
|
||||
PET_LIST_HEADER = "My companions",
|
||||
PET_EMPTY = "No companion recorded yet. Summon your pet and it will appear here.",
|
||||
PET_ACTIVE = "active",
|
||||
PET_IMPORTED = "import",
|
||||
PET_LEVEL = "Level %d",
|
||||
PET_UPDATED = "Updated: %s",
|
||||
PET_NO_DETAIL = "Select a companion on the left.",
|
||||
|
||||
PET_HAPPINESS = "HAPPINESS",
|
||||
PET_HAPPY = "Happy",
|
||||
PET_CONTENT = "Content",
|
||||
PET_UNHAPPY = "Unhappy",
|
||||
PET_LOYALTY = "LOYALTY",
|
||||
PET_TRAINING = "TRAINING POINTS",
|
||||
PET_TRAINING_VALUE = "%d free of %d",
|
||||
PET_DAMAGE = "DAMAGE",
|
||||
PET_SPEED = "ATTACK SPEED",
|
||||
PET_ARMOR = "ARMOR",
|
||||
|
||||
PET_FOOD = "Diet",
|
||||
PET_FOOD_UNKNOWN = "not recorded",
|
||||
|
||||
PET_ABILITIES = "Abilities",
|
||||
PET_NO_ABILITIES = "No abilities recorded.",
|
||||
PET_RANK = "Rank %d",
|
||||
PET_PASSIVE = "passive",
|
||||
PET_OTHERS = "%d commands and stances",
|
||||
|
||||
PET_REFRESH = "Update now",
|
||||
PET_REFRESH_FAIL = "Summon your pet first and leave combat.",
|
||||
PET_REFRESH_NOPET = "No companion summoned.",
|
||||
PET_REFRESH_COMBAT = "Not possible in combat. Will be recorded afterwards.",
|
||||
PET_REFRESH_ERROR = "Could not read the companion.",
|
||||
PET_HEALTH = "HEALTH",
|
||||
PET_FACTOR_TIP = "Family factor",
|
||||
PET_AP = "ATTACK POWER",
|
||||
PET_CRIT = "CRITICAL STRIKE",
|
||||
PET_MOVE = "MOVEMENT",
|
||||
PET_RES_FIRE = "FIRE",
|
||||
PET_RES_NATURE = "NATURE",
|
||||
PET_RES_FROST = "FROST",
|
||||
PET_RES_SHADOW = "SHADOW",
|
||||
PET_RES_ARCANE = "ARCANE",
|
||||
PET_TIP_HEALTH = "Health",
|
||||
PET_TIP_HEALTH_1 = "Maximum health of the companion.",
|
||||
PET_TIP_HEALTH_2 = "Every point of stamina grants 2 health.",
|
||||
PET_TIP_ARMOR = "Armor",
|
||||
PET_TIP_ARMOR_1 = "Reduces physical damage taken: %.1f%% (against an attacker of the companion's level).",
|
||||
PET_TIP_ARMOR_2 = "Companions receive 30%% of their master's armor as a bonus.",
|
||||
PET_TIP_DAMAGE = "Main hand attack",
|
||||
PET_TIP_DAMAGE_1 = "Damage: %d - %d",
|
||||
PET_TIP_DAMAGE_2 = "Attack speed: %.2f s",
|
||||
PET_TIP_DAMAGE_3 = "Damage per second: %.1f",
|
||||
PET_TIP_AP = "Attack power",
|
||||
PET_TIP_AP_1 = "Base %d, bonus %d, total %d.",
|
||||
PET_TIP_AP_2 = "Companions receive 10%% of their master's attack power. Every 14 attack power adds 1 damage per second.",
|
||||
PET_TIP_CRIT = "Critical strike chance",
|
||||
PET_TIP_CRIT_1 = "Melee: %.2f%%",
|
||||
PET_TIP_CRIT_2 = "Spell: %.2f%%",
|
||||
PET_TIP_CRIT_3 = "Ranged: %.2f%%",
|
||||
PET_TIP_CRIT_4 = "The companion uses the critical strike chance of its master. The value shown is the master's at the time of recording.",
|
||||
PET_TIP_RES = "Resistance",
|
||||
PET_TIP_RES_1 = "Resistance: %d",
|
||||
PET_TIP_RES_2 = "Average damage reduction against attackers of the companion's level: %.1f%%.",
|
||||
PET_TIP_RES_3 = "Companions receive resistance from their master's resistance.",
|
||||
PET_TIP_MOVE = "Movement speed",
|
||||
PET_TIP_MOVE_1 = "Running: %.1f yards per second (%d%% of normal speed).",
|
||||
PET_TIP_NODATA = "Not recorded yet. Use \"Update now\" with the companion summoned.",
|
||||
PET_FACTOR_UNKNOWN = "Family factor unknown",
|
||||
PET_REFRESH_OK = "Companion updated.",
|
||||
PET_DELETE = "Remove entry",
|
||||
PET_DELETE_CONFIRM = "Really remove?",
|
||||
|
||||
PET_EXPORT_LABEL = "Companions",
|
||||
PET_IMPORT_STATS = "%d new, %d updated, %d skipped",
|
||||
PET_IMPORT_TOO_MANY = "too many entries",
|
||||
PET_IMPORT_EMPTY = "no valid entries",
|
||||
})
|
||||
|
||||
FW:AddLocale("deDE", {
|
||||
PET_TITLE = "Jäger-Begleiter",
|
||||
PET_DESC = "Erfasst deine Jäger-Begleiter mit Werten und Fähigkeiten.",
|
||||
PET_TAB = "Begleiter",
|
||||
|
||||
PET_LIST_HEADER = "Meine Begleiter",
|
||||
PET_EMPTY = "Noch kein Begleiter erfasst. Rufe deinen Begleiter, dann erscheint er hier.",
|
||||
PET_ACTIVE = "aktiv",
|
||||
PET_IMPORTED = "Import",
|
||||
PET_LEVEL = "Stufe %d",
|
||||
PET_UPDATED = "Stand: %s",
|
||||
PET_NO_DETAIL = "Wähle links einen Begleiter aus.",
|
||||
|
||||
PET_HAPPINESS = "ZUFRIEDENHEIT",
|
||||
PET_HAPPY = "Glücklich",
|
||||
PET_CONTENT = "Zufrieden",
|
||||
PET_UNHAPPY = "Unzufrieden",
|
||||
PET_LOYALTY = "TREUE",
|
||||
PET_TRAINING = "TRAININGSPUNKTE",
|
||||
PET_TRAINING_VALUE = "%d frei von %d",
|
||||
PET_DAMAGE = "SCHADEN",
|
||||
PET_SPEED = "ANGRIFFSTEMPO",
|
||||
PET_ARMOR = "RÜSTUNG",
|
||||
|
||||
PET_FOOD = "Nahrung",
|
||||
PET_FOOD_UNKNOWN = "nicht erfasst",
|
||||
|
||||
PET_ABILITIES = "Fähigkeiten",
|
||||
PET_NO_ABILITIES = "Keine Fähigkeiten erfasst.",
|
||||
PET_RANK = "Rang %d",
|
||||
PET_PASSIVE = "passiv",
|
||||
PET_OTHERS = "%d Befehle und Haltungen",
|
||||
|
||||
PET_REFRESH = "Jetzt aktualisieren",
|
||||
PET_REFRESH_FAIL = "Rufe zuerst deinen Begleiter und verlasse den Kampf.",
|
||||
PET_REFRESH_NOPET = "Kein Begleiter gerufen.",
|
||||
PET_REFRESH_COMBAT = "Im Kampf nicht möglich. Wird danach automatisch erfasst.",
|
||||
PET_REFRESH_ERROR = "Begleiter konnte nicht gelesen werden.",
|
||||
PET_HEALTH = "LEBEN",
|
||||
PET_FACTOR_TIP = "Familienfaktor",
|
||||
PET_AP = "ANGRIFFSKRAFT",
|
||||
PET_CRIT = "KRITISCHER TREFFER",
|
||||
PET_MOVE = "BEWEGUNG",
|
||||
PET_RES_FIRE = "FEUER",
|
||||
PET_RES_NATURE = "NATUR",
|
||||
PET_RES_FROST = "FROST",
|
||||
PET_RES_SHADOW = "SCHATTEN",
|
||||
PET_RES_ARCANE = "ARKAN",
|
||||
PET_TIP_HEALTH = "Gesundheit",
|
||||
PET_TIP_HEALTH_1 = "Maximale Gesundheit des Begleiters.",
|
||||
PET_TIP_HEALTH_2 = "Jeder Punkt Ausdauer gewährt 2 Gesundheit.",
|
||||
PET_TIP_ARMOR = "Rüstung",
|
||||
PET_TIP_ARMOR_1 = "Verringert erlittenen körperlichen Schaden um %.1f%% (gegen einen Angreifer der Stufe des Begleiters).",
|
||||
PET_TIP_ARMOR_2 = "Begleiter erhalten 30%% der Rüstung ihres Herrn als Bonus.",
|
||||
PET_TIP_DAMAGE = "Hauptangriff",
|
||||
PET_TIP_DAMAGE_1 = "Schaden: %d - %d",
|
||||
PET_TIP_DAMAGE_2 = "Angriffstempo: %.2f s",
|
||||
PET_TIP_DAMAGE_3 = "Schaden pro Sekunde: %.1f",
|
||||
PET_TIP_AP = "Angriffskraft",
|
||||
PET_TIP_AP_1 = "Basis %d, Bonus %d, gesamt %d.",
|
||||
PET_TIP_AP_2 = "Begleiter erhalten 10%% der Angriffskraft ihres Herrn. Je 14 Angriffskraft erhöhen den Schaden um 1 pro Sekunde.",
|
||||
PET_TIP_CRIT = "Chance auf kritische Treffer",
|
||||
PET_TIP_CRIT_1 = "Nahkampf: %.2f%%",
|
||||
PET_TIP_CRIT_2 = "Zauber: %.2f%%",
|
||||
PET_TIP_CRIT_3 = "Fernkampf: %.2f%%",
|
||||
PET_TIP_CRIT_4 = "Der Begleiter nutzt die Chance auf kritische Treffer seines Herrn. Angezeigt wird der Wert des Herrn zum Zeitpunkt der Erfassung.",
|
||||
PET_TIP_RES = "Widerstand",
|
||||
PET_TIP_RES_1 = "Widerstand: %d",
|
||||
PET_TIP_RES_2 = "Durchschnittlich verringerter Schaden gegen Angreifer der Stufe des Begleiters: %.1f%%.",
|
||||
PET_TIP_RES_3 = "Begleiter erhalten Widerstand aus dem Widerstand ihres Herrn.",
|
||||
PET_TIP_MOVE = "Bewegungstempo",
|
||||
PET_TIP_MOVE_1 = "Laufen: %.1f Meter pro Sekunde (%d%% der normalen Geschwindigkeit).",
|
||||
PET_TIP_NODATA = "Noch nicht erfasst. Nutze \"Jetzt aktualisieren\" bei gerufenem Begleiter.",
|
||||
PET_FACTOR_UNKNOWN = "Familienfaktor unbekannt",
|
||||
PET_REFRESH_OK = "Begleiter aktualisiert.",
|
||||
PET_DELETE = "Eintrag entfernen",
|
||||
PET_DELETE_CONFIRM = "Wirklich entfernen?",
|
||||
|
||||
PET_EXPORT_LABEL = "Begleiter",
|
||||
PET_IMPORT_STATS = "%d neu, %d aktualisiert, %d übersprungen",
|
||||
PET_IMPORT_TOO_MANY = "zu viele Einträge",
|
||||
PET_IMPORT_EMPTY = "keine gültigen Einträge",
|
||||
})
|
||||
@@ -0,0 +1,564 @@
|
||||
-- Freewood-OctoWoW-Pet: erfasst den aktiven Jaeger-Begleiter und speichert ihn.
|
||||
--
|
||||
-- Gespeichert wird im Core-Datenspeicher (Account-weit): Pet.db.pets[<Besitzer>:<Name>].
|
||||
-- Alle Abfragen laufen geschuetzt (pcall) und nur ausserhalb des Kampfes, damit
|
||||
-- ein veraenderter oder gesperrter Rueckgabewert nie einen Fehler auslost.
|
||||
--
|
||||
-- Eintrag (Felder, alle optional ausser name/level):
|
||||
-- name, family, creatureType, level, npcID,
|
||||
-- happiness (1..3), damagePct, loyaltyRate, loyaltyText, loyaltyLevel,
|
||||
-- trainingTotal, trainingSpent, speed, dmgMin, dmgMax, armor, armorBase, hpMax,
|
||||
-- foods = { "..." }, abilities = { { name, rank, spellID, passive } }, others = { "..." },
|
||||
-- updated, firstSeen, owner (nur eigene), src ("own" | "import")
|
||||
|
||||
local ADDON, NS = ...
|
||||
|
||||
local FW = _G.Freewood
|
||||
if not FW or not FW:RequireAPI(1, ADDON) then
|
||||
return
|
||||
end
|
||||
|
||||
local Util = FW.Util
|
||||
local L = FW.L
|
||||
|
||||
local MAX_ABILITIES = 60
|
||||
local MAX_OTHERS = 30
|
||||
local MAX_FOODS = 12
|
||||
local MAX_IMPORT = 300
|
||||
|
||||
local function GetMeta(field)
|
||||
local fn = (C_AddOns and C_AddOns.GetAddOnMetadata) or GetAddOnMetadata
|
||||
if fn then
|
||||
local ok, value = pcall(fn, ADDON, field)
|
||||
if ok then
|
||||
return value
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local Pet = FW:NewModule("Pet", {
|
||||
version = GetMeta("Version") or "dev",
|
||||
title = L.PET_TITLE,
|
||||
description = L.PET_DESC,
|
||||
defaults = { pets = {} },
|
||||
})
|
||||
NS.Pet = Pet
|
||||
FW.Pet = Pet -- fuer andere Freewood-Addons
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Kleine Pruefer
|
||||
------------------------------------------------------------------------
|
||||
|
||||
local function Num(v)
|
||||
if Util.IsSecret(v) then
|
||||
return nil
|
||||
end
|
||||
if type(v) == "number" and v == v and v ~= math.huge and v ~= -math.huge then
|
||||
return v
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function NumIn(v, lo, hi)
|
||||
v = Num(v)
|
||||
if v and v >= lo and v <= hi then
|
||||
return v
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function Str(v, max)
|
||||
if Util.IsSecret(v) then
|
||||
return nil
|
||||
end
|
||||
if type(v) == "string" and v ~= "" then
|
||||
return v:sub(1, max or 64)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function Round(v, decimals)
|
||||
v = Num(v)
|
||||
if not v then
|
||||
return nil
|
||||
end
|
||||
return Util.Round(v, decimals or 0)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Auslesen
|
||||
------------------------------------------------------------------------
|
||||
|
||||
local function ReadAbilities()
|
||||
local abilities, others = {}, {}
|
||||
|
||||
if not (C_SpellBook and C_SpellBook.HasPetSpells and C_SpellBook.GetSpellBookItemName
|
||||
and Enum and Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Pet) then
|
||||
return abilities, others
|
||||
end
|
||||
|
||||
local bank = Enum.SpellBookSpellBank.Pet
|
||||
local count = C_SpellBook.HasPetSpells()
|
||||
if type(count) ~= "number" then
|
||||
return abilities, others
|
||||
end
|
||||
|
||||
for i = 1, count do
|
||||
local ok, spellName, subName = pcall(C_SpellBook.GetSpellBookItemName, i, bank)
|
||||
if ok and type(spellName) == "string" and spellName ~= "" then
|
||||
local rank
|
||||
if type(subName) == "string" then
|
||||
rank = tonumber(subName:match("(%d+)"))
|
||||
end
|
||||
|
||||
local spellID, passive
|
||||
if C_SpellBook.GetSpellBookItemInfo then
|
||||
local okInfo, info = pcall(C_SpellBook.GetSpellBookItemInfo, i, bank)
|
||||
if okInfo and type(info) == "table" then
|
||||
spellID = Num(info.spellID) or Num(info.actionID)
|
||||
if info.isPassive == true then
|
||||
passive = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if rank then
|
||||
if #abilities < MAX_ABILITIES then
|
||||
abilities[#abilities + 1] = {
|
||||
name = spellName:sub(1, 48),
|
||||
rank = rank,
|
||||
spellID = spellID,
|
||||
passive = passive,
|
||||
}
|
||||
end
|
||||
elseif #others < MAX_OTHERS then
|
||||
others[#others + 1] = spellName:sub(1, 48)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return abilities, others
|
||||
end
|
||||
|
||||
local function ReadFoods()
|
||||
if not (C_PetInfo and C_PetInfo.GetPetFoodTypes) then
|
||||
return nil
|
||||
end
|
||||
local ok, a, b, c, d, e, f, g, h = pcall(C_PetInfo.GetPetFoodTypes)
|
||||
if not ok then
|
||||
return nil
|
||||
end
|
||||
local raw = { a, b, c, d, e, f, g, h }
|
||||
if type(a) == "table" then
|
||||
raw = a
|
||||
end
|
||||
local foods = {}
|
||||
for _, value in ipairs(raw) do
|
||||
if type(value) == "string" and #foods < MAX_FOODS then
|
||||
foods[#foods + 1] = value:sub(1, 32)
|
||||
end
|
||||
end
|
||||
if #foods == 0 then
|
||||
return nil
|
||||
end
|
||||
return foods
|
||||
end
|
||||
|
||||
local function ReadNpcID()
|
||||
local guid = Util.Clean(UnitGUID("pet"))
|
||||
if type(guid) ~= "string" then
|
||||
return nil
|
||||
end
|
||||
local hk, hid = Util.ParseHexGUID(guid)
|
||||
if hk then
|
||||
if hk == "Pet" or hk == "Creature" then return hid end
|
||||
return nil
|
||||
end
|
||||
local kind, _, _, _, _, id = strsplit("-", guid)
|
||||
if kind == "Pet" or kind == "Creature" then
|
||||
return tonumber(id)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function Pet:BuildRecord()
|
||||
local name = Util.Clean(UnitName("pet"))
|
||||
if type(name) ~= "string" or name == "" or (UNKNOWN and name == UNKNOWN) then
|
||||
return nil
|
||||
end
|
||||
|
||||
local r = {
|
||||
name = name,
|
||||
family = Str(UnitCreatureFamily("pet")),
|
||||
creatureType = Str(UnitCreatureType("pet")),
|
||||
level = NumIn(UnitLevel("pet"), 1, 100),
|
||||
npcID = ReadNpcID(),
|
||||
updated = time(),
|
||||
owner = Util.GetPlayerKey(),
|
||||
src = "own",
|
||||
}
|
||||
if not r.level then
|
||||
return nil
|
||||
end
|
||||
|
||||
if C_PetInfo then
|
||||
if C_PetInfo.GetPetHappiness then
|
||||
local happiness, damagePct, loyaltyRate = C_PetInfo.GetPetHappiness()
|
||||
r.happiness = NumIn(happiness, 1, 3)
|
||||
r.damagePct = Round(damagePct)
|
||||
r.loyaltyRate = Round(loyaltyRate)
|
||||
end
|
||||
if C_PetInfo.GetPetLoyalty then
|
||||
local text = C_PetInfo.GetPetLoyalty()
|
||||
if type(text) == "string" then
|
||||
r.loyaltyText = text:sub(1, 80)
|
||||
r.loyaltyLevel = NumIn(tonumber(text:match("(%d+)")), 1, 20)
|
||||
end
|
||||
end
|
||||
if C_PetInfo.GetPetTrainingPoints then
|
||||
local total, spent = C_PetInfo.GetPetTrainingPoints()
|
||||
r.trainingTotal = Round(total)
|
||||
r.trainingSpent = Round(spent)
|
||||
end
|
||||
end
|
||||
|
||||
r.speed = Round((UnitAttackSpeed("pet")), 2)
|
||||
|
||||
local dmgMin, dmgMax = UnitDamage("pet")
|
||||
r.dmgMin = Round(dmgMin)
|
||||
r.dmgMax = Round(dmgMax)
|
||||
|
||||
local armorBase, armorEffective = UnitArmor("pet")
|
||||
r.armorBase = Round(armorBase)
|
||||
r.armor = Round(armorEffective) or r.armorBase
|
||||
|
||||
r.hpMax = Round((UnitHealthMax("pet")))
|
||||
|
||||
-- Zusatzwerte (alle optional, jeweils geschuetzt gelesen)
|
||||
local function Try(fn, ...)
|
||||
if type(fn) ~= "function" then
|
||||
return nil
|
||||
end
|
||||
local ok, a, b, c, d = pcall(fn, ...)
|
||||
if ok then
|
||||
return a, b, c, d
|
||||
end
|
||||
return nil
|
||||
end
|
||||
local apBase, apPos, apNeg = Try(UnitAttackPower, "pet")
|
||||
if type(apBase) == "number" then
|
||||
r.apBase = Round(apBase)
|
||||
r.apBonus = Round((tonumber(apPos) or 0) + (tonumber(apNeg) or 0))
|
||||
end
|
||||
local _, runSpeed = Try(GetUnitSpeed, "pet")
|
||||
if type(runSpeed) == "number" then
|
||||
r.runSpeed = Round(runSpeed, 2)
|
||||
end
|
||||
r.resist = {}
|
||||
for school = 1, 6 do
|
||||
local _, total = Try(UnitResistance, "pet", school)
|
||||
r.resist[school] = type(total) == "number" and Round(total) or nil
|
||||
end
|
||||
if next(r.resist) == nil then
|
||||
r.resist = nil
|
||||
end
|
||||
local crit = Try(GetCritChance)
|
||||
if type(crit) == "number" then
|
||||
r.critMelee = Round(crit, 2)
|
||||
end
|
||||
local sCrit = Try(GetSpellCritChance, 2)
|
||||
if type(sCrit) == "number" then
|
||||
r.critSpell = Round(sCrit, 2)
|
||||
end
|
||||
local rCrit = Try(GetRangedCritChance)
|
||||
if type(rCrit) == "number" then
|
||||
r.critRanged = Round(rCrit, 2)
|
||||
end
|
||||
|
||||
r.foods = ReadFoods()
|
||||
r.abilities, r.others = ReadAbilities()
|
||||
|
||||
return r
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Speichern
|
||||
------------------------------------------------------------------------
|
||||
|
||||
function Pet:Store(record)
|
||||
local key = record.owner .. ":" .. record.name
|
||||
local old = self.db.pets[key]
|
||||
record.firstSeen = (old and old.firstSeen) or record.updated
|
||||
self.db.pets[key] = record
|
||||
self.activeKey = key
|
||||
if not self.selectedKey then
|
||||
self.selectedKey = key
|
||||
end
|
||||
FW:Fire("PET_UPDATED", key, record)
|
||||
return key
|
||||
end
|
||||
|
||||
-- Liest den aktiven Begleiter. Rueckgabe: true bei Erfolg, sonst false, Grund
|
||||
function Pet:Scan()
|
||||
if not UnitExists("pet") then
|
||||
-- Begleiter entlassen oder noch nicht da: "aktiv" zuruecknehmen
|
||||
if self.activeKey then
|
||||
self.activeKey = nil
|
||||
FW:Fire("PET_UPDATED", nil, nil)
|
||||
end
|
||||
return false, "nopet"
|
||||
end
|
||||
if InCombatLockdown and InCombatLockdown() then
|
||||
self.pending = true
|
||||
return false, "combat"
|
||||
end
|
||||
local ok, record = pcall(self.BuildRecord, self)
|
||||
if not ok then
|
||||
FW:Debug("Freewood-OctoWoW-Pet: Auslesen fehlgeschlagen:", record)
|
||||
return false, "error"
|
||||
end
|
||||
if not record then
|
||||
return false, "nodata"
|
||||
end
|
||||
self:Store(record)
|
||||
return true
|
||||
end
|
||||
|
||||
function Pet:RequestScan(delay)
|
||||
if self.scanQueued then
|
||||
return
|
||||
end
|
||||
self.scanQueued = true
|
||||
C_Timer.After(delay or 0.6, function()
|
||||
self.scanQueued = false
|
||||
self:Scan()
|
||||
end)
|
||||
end
|
||||
|
||||
function Pet:Delete(key)
|
||||
if self.db.pets[key] then
|
||||
self.db.pets[key] = nil
|
||||
if self.selectedKey == key then
|
||||
self.selectedKey = nil
|
||||
end
|
||||
if self.activeKey == key then
|
||||
self.activeKey = nil
|
||||
end
|
||||
FW:Fire("PET_UPDATED", key, nil)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Ereignisse
|
||||
------------------------------------------------------------------------
|
||||
|
||||
function Pet:OnUnitPet(unit)
|
||||
if unit == "player" then
|
||||
self:RequestScan(1.0)
|
||||
end
|
||||
end
|
||||
|
||||
function Pet:OnRegenEnabled()
|
||||
if self.pending then
|
||||
self.pending = false
|
||||
self:RequestScan(0.5)
|
||||
end
|
||||
end
|
||||
|
||||
function Pet:OnStatsChanged()
|
||||
self:RequestScan(1.5)
|
||||
end
|
||||
|
||||
function Pet:OnEnable()
|
||||
FW:RegisterEvent("UNIT_PET", self.OnUnitPet, self)
|
||||
FW:RegisterEvent("PET_STATS_UPDATE", self.OnStatsChanged, self)
|
||||
FW:RegisterEvent("PET_BAR_UPDATE", self.OnStatsChanged, self)
|
||||
FW:RegisterEvent("SPELLS_CHANGED", self.OnStatsChanged, self)
|
||||
FW:RegisterEvent("PLAYER_REGEN_ENABLED", self.OnRegenEnabled, self)
|
||||
FW:RegisterEvent("PLAYER_ENTERING_WORLD", self.OnStatsChanged, self)
|
||||
self:RequestScan(2.0)
|
||||
end
|
||||
|
||||
function Pet:OnDisable()
|
||||
for _, event in ipairs({ "UNIT_PET", "PET_STATS_UPDATE", "PET_BAR_UPDATE", "SPELLS_CHANGED",
|
||||
"PLAYER_REGEN_ENABLED", "PLAYER_ENTERING_WORLD" }) do
|
||||
FW:UnregisterEvent(event, self)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Export / Import
|
||||
-- Geteilt wird nur, was kein Persoenliches enthaelt: kein Besitzer, keine Notizen.
|
||||
------------------------------------------------------------------------
|
||||
|
||||
local function SanitizeList(src, max, itemFn)
|
||||
local list = {}
|
||||
if type(src) ~= "table" then
|
||||
return list
|
||||
end
|
||||
for i, item in ipairs(src) do
|
||||
if i > max then
|
||||
break
|
||||
end
|
||||
local clean = itemFn(item)
|
||||
if clean then
|
||||
list[#list + 1] = clean
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
-- Uebernimmt nur bekannte Felder mit gepruefter Form. Liefert nil, wenn der Eintrag unbrauchbar ist.
|
||||
local function Sanitize(src)
|
||||
if type(src) ~= "table" then
|
||||
return nil
|
||||
end
|
||||
local name = Str(src.name, 48)
|
||||
local level = NumIn(src.level, 1, 100)
|
||||
if not name or not level then
|
||||
return nil
|
||||
end
|
||||
|
||||
local r = {
|
||||
name = name,
|
||||
level = level,
|
||||
family = Str(src.family, 48),
|
||||
creatureType = Str(src.creatureType, 48),
|
||||
npcID = NumIn(src.npcID, 1, 10000000),
|
||||
happiness = NumIn(src.happiness, 1, 3),
|
||||
damagePct = NumIn(src.damagePct, 0, 1000),
|
||||
loyaltyRate = NumIn(src.loyaltyRate, -1000, 1000),
|
||||
loyaltyText = Str(src.loyaltyText, 80),
|
||||
loyaltyLevel = NumIn(src.loyaltyLevel, 1, 20),
|
||||
trainingTotal = NumIn(src.trainingTotal, 0, 100000),
|
||||
trainingSpent = NumIn(src.trainingSpent, 0, 100000),
|
||||
speed = NumIn(src.speed, 0, 100),
|
||||
dmgMin = NumIn(src.dmgMin, 0, 10000000),
|
||||
dmgMax = NumIn(src.dmgMax, 0, 10000000),
|
||||
armor = NumIn(src.armor, 0, 10000000),
|
||||
armorBase = NumIn(src.armorBase, 0, 10000000),
|
||||
hpMax = NumIn(src.hpMax, 0, 100000000),
|
||||
apBase = NumIn(src.apBase, 0, 10000000),
|
||||
apBonus = NumIn(src.apBonus, -10000000, 10000000),
|
||||
runSpeed = NumIn(src.runSpeed, 0, 100),
|
||||
critMelee = NumIn(src.critMelee, 0, 100),
|
||||
critSpell = NumIn(src.critSpell, 0, 100),
|
||||
critRanged = NumIn(src.critRanged, 0, 100),
|
||||
updated = NumIn(src.updated, 0, 4102444800) or 0,
|
||||
}
|
||||
|
||||
if type(src.resist) == "table" then
|
||||
local res = {}
|
||||
for school = 1, 6 do
|
||||
res[school] = NumIn(src.resist[school], 0, 100000)
|
||||
end
|
||||
if next(res) ~= nil then
|
||||
r.resist = res
|
||||
end
|
||||
end
|
||||
|
||||
r.foods = SanitizeList(src.foods, MAX_FOODS, function(v)
|
||||
return Str(v, 32)
|
||||
end)
|
||||
if #r.foods == 0 then
|
||||
r.foods = nil
|
||||
end
|
||||
|
||||
r.abilities = SanitizeList(src.abilities, MAX_ABILITIES, function(a)
|
||||
if type(a) ~= "table" then
|
||||
return nil
|
||||
end
|
||||
local abilityName = Str(a.name, 48)
|
||||
if not abilityName then
|
||||
return nil
|
||||
end
|
||||
return {
|
||||
name = abilityName,
|
||||
rank = NumIn(a.rank, 0, 20),
|
||||
spellID = NumIn(a.spellID, 1, 10000000),
|
||||
passive = (a.passive == true) or nil,
|
||||
}
|
||||
end)
|
||||
|
||||
r.others = SanitizeList(src.others, MAX_OTHERS, function(v)
|
||||
return Str(v, 48)
|
||||
end)
|
||||
|
||||
return r
|
||||
end
|
||||
|
||||
function Pet:ExportData()
|
||||
local list = {}
|
||||
for _, record in pairs(self.db.pets) do
|
||||
if record.src ~= "import" then
|
||||
local clean = Sanitize(record)
|
||||
if clean then
|
||||
list[#list + 1] = clean
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(list, function(a, b)
|
||||
return (a.updated or 0) > (b.updated or 0)
|
||||
end)
|
||||
if #list == 0 then
|
||||
return {}
|
||||
end
|
||||
return { list = list }
|
||||
end
|
||||
|
||||
function Pet:ValidateImport(data)
|
||||
if type(data) ~= "table" or type(data.list) ~= "table" then
|
||||
return false, L.PET_IMPORT_EMPTY
|
||||
end
|
||||
if #data.list > MAX_IMPORT then
|
||||
return false, L.PET_IMPORT_TOO_MANY
|
||||
end
|
||||
if #data.list == 0 then
|
||||
return false, L.PET_IMPORT_EMPTY
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function Pet:ImportData(data)
|
||||
local added, updated, skipped = 0, 0, 0
|
||||
for _, item in ipairs(data.list) do
|
||||
local clean = Sanitize(item)
|
||||
if not clean then
|
||||
skipped = skipped + 1
|
||||
else
|
||||
local key = "import:" .. clean.name .. ":" .. (clean.family or "?") .. ":" .. clean.level
|
||||
local existing = self.db.pets[key]
|
||||
if existing and (existing.updated or 0) >= clean.updated then
|
||||
skipped = skipped + 1
|
||||
else
|
||||
clean.src = "import"
|
||||
clean.importedAt = time()
|
||||
clean.firstSeen = (existing and existing.firstSeen) or clean.importedAt
|
||||
self.db.pets[key] = clean
|
||||
if existing then
|
||||
updated = updated + 1
|
||||
else
|
||||
added = added + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
FW:Fire("PET_UPDATED", nil, nil)
|
||||
return string.format(FW.L.PET_IMPORT_STATS, added, updated, skipped)
|
||||
end
|
||||
|
||||
FW.Export.RegisterHandler("pets", {
|
||||
label = function()
|
||||
return FW.L.PET_EXPORT_LABEL
|
||||
end,
|
||||
export = function()
|
||||
return Pet:ExportData()
|
||||
end,
|
||||
validate = function(data)
|
||||
return Pet:ValidateImport(data)
|
||||
end,
|
||||
import = function(data)
|
||||
return Pet:ImportData(data)
|
||||
end,
|
||||
})
|
||||
@@ -0,0 +1,662 @@
|
||||
-- Freewood-OctoWoW-Pet: Tab "Begleiter" im Freewood-Fenster
|
||||
-- Links die Liste der erfassten Begleiter, rechts Kennzahlen, Nahrung und Faehigkeiten.
|
||||
-- Aufbau angelehnt an das Stitch-Design "Jaeger Begleiter" (Filter/Liste links, Details rechts).
|
||||
|
||||
local ADDON, NS = ...
|
||||
|
||||
local FW = _G.Freewood
|
||||
local Pet = NS.Pet
|
||||
if not FW or not Pet then
|
||||
return
|
||||
end
|
||||
|
||||
local UI = FW.UI
|
||||
|
||||
local LIST_W = 252
|
||||
local ROW_H, ROW_GAP = 54, 6
|
||||
local CARD_W, CARD_H, CARD_GAP = 176, 48, 10
|
||||
local ABILITY_H = 30
|
||||
|
||||
local function FormatTime(t)
|
||||
if type(t) ~= "number" or t <= 0 then
|
||||
return "-"
|
||||
end
|
||||
return date("%d.%m.%Y %H:%M", t)
|
||||
end
|
||||
|
||||
local function SortedKeys()
|
||||
local keys = {}
|
||||
for key in pairs(Pet.db.pets) do
|
||||
keys[#keys + 1] = key
|
||||
end
|
||||
table.sort(keys, function(a, b)
|
||||
if a == b then
|
||||
return false
|
||||
end
|
||||
if a == Pet.activeKey then
|
||||
return true
|
||||
end
|
||||
if b == Pet.activeKey then
|
||||
return false
|
||||
end
|
||||
local ra, rb = Pet.db.pets[a], Pet.db.pets[b]
|
||||
local ia, ib = ra.src == "import", rb.src == "import"
|
||||
if ia ~= ib then
|
||||
return not ia
|
||||
end
|
||||
local ua, ub = ra.updated or 0, rb.updated or 0
|
||||
if ua ~= ub then
|
||||
return ua > ub
|
||||
end
|
||||
return a < b
|
||||
end)
|
||||
return keys
|
||||
end
|
||||
|
||||
local function Subtitle(rec)
|
||||
return string.format("%s - %s", rec.family or "?", string.format(FW.L.PET_LEVEL, rec.level or 0))
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Zeile der Liste
|
||||
------------------------------------------------------------------------
|
||||
|
||||
local function CreateListRow(parent, onSelect)
|
||||
local row = CreateFrame("Button", nil, parent)
|
||||
row:SetHeight(ROW_H)
|
||||
|
||||
row.bg = row:CreateTexture(nil, "BACKGROUND")
|
||||
row.bg:SetAllPoints()
|
||||
UI.AddBorder(row, "bronze", 0.6)
|
||||
|
||||
row.icon = row:CreateTexture(nil, "ARTWORK")
|
||||
row.icon:SetSize(34, 34)
|
||||
row.icon:SetPoint("LEFT", row, "LEFT", 8, 0)
|
||||
row.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
|
||||
|
||||
row.name = UI.CreateLabel(row, "", { font = "heading", size = 13, color = "goldLight" })
|
||||
row.name:SetPoint("TOPLEFT", row, "TOPLEFT", 52, -10)
|
||||
row.name:SetWidth(LIST_W - 130)
|
||||
row.name:SetWordWrap(false)
|
||||
|
||||
row.sub = UI.CreateLabel(row, "", { size = 11, color = "textDim" })
|
||||
row.sub:SetPoint("TOPLEFT", row.name, "BOTTOMLEFT", 0, -6)
|
||||
row.sub:SetWidth(LIST_W - 70)
|
||||
row.sub:SetWordWrap(false)
|
||||
|
||||
row.chip = UI.CreateChip(row, "", "success")
|
||||
row.chip:SetPoint("TOPRIGHT", row, "TOPRIGHT", -10, -9)
|
||||
|
||||
local function Refresh()
|
||||
if row.selected then
|
||||
row.bg:SetColorTexture(UI.Color("hover"))
|
||||
UI.SetBorderColor(row, "gold")
|
||||
elseif row.hover then
|
||||
row.bg:SetColorTexture(UI.Color("hover", 0.7))
|
||||
UI.SetBorderColor(row, "bronze")
|
||||
else
|
||||
row.bg:SetColorTexture(UI.Color("card"))
|
||||
UI.SetBorderColor(row, "bronze", 0.6)
|
||||
end
|
||||
end
|
||||
|
||||
function row:SetSelected(selected)
|
||||
self.selected = selected
|
||||
Refresh()
|
||||
end
|
||||
|
||||
row:SetScript("OnEnter", function()
|
||||
row.hover = true
|
||||
Refresh()
|
||||
end)
|
||||
row:SetScript("OnLeave", function()
|
||||
row.hover = false
|
||||
Refresh()
|
||||
end)
|
||||
row:SetScript("OnClick", function()
|
||||
onSelect(row.key)
|
||||
end)
|
||||
|
||||
Refresh()
|
||||
return row
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Tab
|
||||
------------------------------------------------------------------------
|
||||
|
||||
local function Build(content)
|
||||
local L = FW.L
|
||||
local f = CreateFrame("Frame", nil, content)
|
||||
|
||||
local rows, abilityRows, foodChips = {}, {}, {}
|
||||
|
||||
---------------- linke Spalte ----------------
|
||||
local listTitle = UI.CreateLabel(f, L.PET_LIST_HEADER, { font = "heading", size = 14, color = "goldLight" })
|
||||
listTitle:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0)
|
||||
|
||||
local listDivider = UI.CreateDivider(f)
|
||||
listDivider:SetPoint("TOPLEFT", f, "TOPLEFT", 0, -26)
|
||||
listDivider:SetWidth(LIST_W)
|
||||
|
||||
local listScroll = UI.CreateScrollFrame(f)
|
||||
listScroll:SetPoint("TOPLEFT", f, "TOPLEFT", 0, -36)
|
||||
listScroll:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", 0, 0)
|
||||
listScroll:SetWidth(LIST_W)
|
||||
|
||||
local separator = f:CreateTexture(nil, "ARTWORK")
|
||||
separator:SetColorTexture(UI.Color("bronze", 0.4))
|
||||
separator:SetWidth(1)
|
||||
separator:SetPoint("TOPLEFT", f, "TOPLEFT", LIST_W + 10, 0)
|
||||
separator:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", LIST_W + 10, 0)
|
||||
|
||||
---------------- rechte Spalte ----------------
|
||||
local detail = CreateFrame("Frame", nil, f)
|
||||
detail:SetPoint("TOPLEFT", f, "TOPLEFT", LIST_W + 22, 0)
|
||||
detail:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 0, 0)
|
||||
|
||||
local empty = UI.CreateLabel(f, L.PET_EMPTY, { size = 12, color = "textDim", justifyV = "TOP", justify = "LEFT" })
|
||||
empty:SetPoint("TOPLEFT", f, "TOPLEFT", LIST_W + 22, -4)
|
||||
empty:SetPoint("TOPRIGHT", f, "TOPRIGHT", 0, -4)
|
||||
empty:SetWordWrap(true)
|
||||
|
||||
local headIcon = CreateFrame("Frame", nil, detail)
|
||||
headIcon:SetSize(48, 48)
|
||||
headIcon:SetPoint("TOPLEFT", detail, "TOPLEFT", 0, 0)
|
||||
headIcon.tex = headIcon:CreateTexture(nil, "ARTWORK")
|
||||
headIcon.tex:SetPoint("TOPLEFT", headIcon, "TOPLEFT", 2, -2)
|
||||
headIcon.tex:SetPoint("BOTTOMRIGHT", headIcon, "BOTTOMRIGHT", -2, 2)
|
||||
headIcon.tex:SetTexCoord(0.08, 0.92, 0.08, 0.92)
|
||||
UI.AddBorder(headIcon, "gold", 1)
|
||||
|
||||
local nameLabel = UI.CreateLabel(detail, "", { font = "heading", size = 20, color = "goldLight" })
|
||||
nameLabel:SetPoint("TOPLEFT", detail, "TOPLEFT", 60, 0)
|
||||
nameLabel:SetWidth(380)
|
||||
nameLabel:SetWordWrap(false)
|
||||
|
||||
local subLabel = UI.CreateLabel(detail, "", { size = 12, color = "textDim" })
|
||||
subLabel:SetPoint("TOPLEFT", detail, "TOPLEFT", 60, -28)
|
||||
|
||||
local stateChip = UI.CreateChip(detail, "", "success")
|
||||
stateChip:SetPoint("TOPRIGHT", detail, "TOPRIGHT", 0, -4)
|
||||
|
||||
local updatedLabel = UI.CreateLabel(detail, "", { size = 11, color = "textDim", justify = "RIGHT" })
|
||||
updatedLabel:SetPoint("TOPRIGHT", detail, "TOPRIGHT", 0, -32)
|
||||
updatedLabel:SetWidth(240)
|
||||
|
||||
local headDivider = UI.CreateDivider(detail)
|
||||
headDivider:SetPoint("TOPLEFT", detail, "TOPLEFT", 0, -58)
|
||||
headDivider:SetPoint("TOPRIGHT", detail, "TOPRIGHT", 0, -58)
|
||||
|
||||
-- Kennzahlen
|
||||
local cards = {}
|
||||
local defs = {
|
||||
{ key = "happiness", label = L.PET_HAPPINESS },
|
||||
{ key = "loyalty", label = L.PET_LOYALTY },
|
||||
{ key = "training", label = L.PET_TRAINING },
|
||||
{ key = "health", label = L.PET_HEALTH },
|
||||
{ key = "damage", label = L.PET_DAMAGE },
|
||||
{ key = "armor", label = L.PET_ARMOR },
|
||||
{ key = "ap", label = L.PET_AP },
|
||||
{ key = "crit", label = L.PET_CRIT },
|
||||
{ key = "move", label = L.PET_MOVE },
|
||||
}
|
||||
for i, def in ipairs(defs) do
|
||||
local card = UI.CreateStatCard(detail, def.label, CARD_W, CARD_H)
|
||||
UI.SetFont(card.value, "heading", 13)
|
||||
local col = (i - 1) % 3
|
||||
local rowIndex = math.floor((i - 1) / 3)
|
||||
card:SetPoint("TOPLEFT", detail, "TOPLEFT", col * (CARD_W + CARD_GAP), -(68 + rowIndex * (CARD_H + CARD_GAP)))
|
||||
-- Familienfaktor oben rechts auf der Karte
|
||||
card.factor = UI.CreateLabel(card, "", { size = 10, color = "textDim", justify = "RIGHT", flags = "" })
|
||||
card.factor:SetPoint("TOPRIGHT", card, "TOPRIGHT", -10, -8)
|
||||
cards[def.key] = card
|
||||
end
|
||||
|
||||
-- Widerstaende (Schulen 2 bis 6)
|
||||
local RES_W, RES_GAP = 100, 12
|
||||
local resDefs = {
|
||||
{ school = 2, label = L.PET_RES_FIRE },
|
||||
{ school = 3, label = L.PET_RES_NATURE },
|
||||
{ school = 4, label = L.PET_RES_FROST },
|
||||
{ school = 5, label = L.PET_RES_SHADOW },
|
||||
{ school = 6, label = L.PET_RES_ARCANE },
|
||||
}
|
||||
local resCards = {}
|
||||
for i, def in ipairs(resDefs) do
|
||||
local card = UI.CreateStatCard(detail, def.label, RES_W, CARD_H)
|
||||
UI.SetFont(card.value, "heading", 13)
|
||||
card:SetPoint("TOPLEFT", detail, "TOPLEFT", (i - 1) * (RES_W + RES_GAP), -(68 + 3 * (CARD_H + CARD_GAP)))
|
||||
resCards[def.school] = card
|
||||
end
|
||||
|
||||
-- Tooltips: lesen den aktuell angezeigten Eintrag (current) beim Darueberfahren
|
||||
local current
|
||||
local function NoData()
|
||||
return { L.PET_TIP_NODATA }
|
||||
end
|
||||
local function ArmorReduction(armor, level)
|
||||
if type(PaperDollFrame_GetArmorReduction) == "function" then
|
||||
local ok, v = pcall(PaperDollFrame_GetArmorReduction, armor, level)
|
||||
if ok and type(v) == "number" then
|
||||
return v
|
||||
end
|
||||
end
|
||||
local r = armor / (armor + 400 + 85 * level) * 100
|
||||
return math.min(75, r)
|
||||
end
|
||||
local function TipLines(key)
|
||||
local rec = current
|
||||
local lines = {}
|
||||
if not rec then
|
||||
return NoData()
|
||||
end
|
||||
if key == "health" then
|
||||
lines = { L.PET_TIP_HEALTH_1, L.PET_TIP_HEALTH_2 }
|
||||
elseif key == "armor" then
|
||||
if not rec.armor then return NoData() end
|
||||
lines = { string.format(L.PET_TIP_ARMOR_1, ArmorReduction(rec.armor, rec.level or 1)), L.PET_TIP_ARMOR_2 }
|
||||
elseif key == "damage" then
|
||||
if not (rec.dmgMin and rec.dmgMax) then return NoData() end
|
||||
lines = { string.format(L.PET_TIP_DAMAGE_1, rec.dmgMin, rec.dmgMax) }
|
||||
if rec.speed and rec.speed > 0 then
|
||||
lines[#lines + 1] = string.format(L.PET_TIP_DAMAGE_2, rec.speed)
|
||||
lines[#lines + 1] = string.format(L.PET_TIP_DAMAGE_3, (rec.dmgMin + rec.dmgMax) / 2 / rec.speed)
|
||||
end
|
||||
elseif key == "ap" then
|
||||
if not rec.apBase then return NoData() end
|
||||
local bonus = rec.apBonus or 0
|
||||
lines = { string.format(L.PET_TIP_AP_1, rec.apBase, bonus, rec.apBase + bonus), L.PET_TIP_AP_2 }
|
||||
elseif key == "crit" then
|
||||
if not (rec.critMelee or rec.critSpell or rec.critRanged) then return NoData() end
|
||||
if rec.critMelee then lines[#lines + 1] = string.format(L.PET_TIP_CRIT_1, rec.critMelee) end
|
||||
if rec.critSpell then lines[#lines + 1] = string.format(L.PET_TIP_CRIT_2, rec.critSpell) end
|
||||
if rec.critRanged then lines[#lines + 1] = string.format(L.PET_TIP_CRIT_3, rec.critRanged) end
|
||||
lines[#lines + 1] = L.PET_TIP_CRIT_4
|
||||
elseif key == "move" then
|
||||
if not rec.runSpeed then return NoData() end
|
||||
lines = { string.format(L.PET_TIP_MOVE_1, rec.runSpeed, math.floor(rec.runSpeed / 7 * 100 + 0.5)) }
|
||||
end
|
||||
return lines
|
||||
end
|
||||
local tipTitles = {
|
||||
health = L.PET_TIP_HEALTH, armor = L.PET_TIP_ARMOR, damage = L.PET_TIP_DAMAGE,
|
||||
ap = L.PET_TIP_AP, crit = L.PET_TIP_CRIT, move = L.PET_TIP_MOVE,
|
||||
}
|
||||
for key, title in pairs(tipTitles) do local key = key
|
||||
UI.AttachTooltip(cards[key], title, function() return TipLines(key) end)
|
||||
end
|
||||
for school, card in pairs(resCards) do local school = school
|
||||
UI.AttachTooltip(card, L.PET_TIP_RES, function()
|
||||
local v = current and current.resist and current.resist[school]
|
||||
if not v then return NoData() end
|
||||
local pct = math.min(75, v / (math.max(1, current.level or 1) * 5) * 75)
|
||||
return { string.format(L.PET_TIP_RES_1, v), string.format(L.PET_TIP_RES_2, pct), L.PET_TIP_RES_3 }
|
||||
end)
|
||||
end
|
||||
|
||||
-- Faktor als Text und Farbe: ueber 1 gold, unter 1 gedaempft, 1,00 neutral
|
||||
local function SetFactor(card, factor)
|
||||
if not factor then
|
||||
card.factor:SetText("")
|
||||
return
|
||||
end
|
||||
local color = "textDim"
|
||||
if factor > 1.0001 then
|
||||
color = "goldLight"
|
||||
elseif factor < 0.9999 then
|
||||
color = "danger"
|
||||
end
|
||||
card.factor:SetText(string.format("x%.2f", factor))
|
||||
card.factor:SetTextColor(UI.Color(color))
|
||||
end
|
||||
|
||||
-- Nahrung
|
||||
local foodLabel = UI.CreateLabel(detail, L.PET_FOOD, { font = "heading", size = 13, color = "goldLight" })
|
||||
foodLabel:SetPoint("TOPLEFT", detail, "TOPLEFT", 0, -300)
|
||||
local foodNone = UI.CreateLabel(detail, L.PET_FOOD_UNKNOWN, { size = 12, color = "textDim" })
|
||||
foodNone:SetPoint("LEFT", foodLabel, "RIGHT", 14, 0)
|
||||
|
||||
-- Faehigkeiten
|
||||
local abilityTitle = UI.CreateLabel(detail, L.PET_ABILITIES, { font = "heading", size = 14, color = "goldLight" })
|
||||
abilityTitle:SetPoint("TOPLEFT", detail, "TOPLEFT", 0, -336)
|
||||
local abilityDivider = UI.CreateDivider(detail)
|
||||
abilityDivider:SetPoint("TOPLEFT", detail, "TOPLEFT", 0, -360)
|
||||
abilityDivider:SetPoint("TOPRIGHT", detail, "TOPRIGHT", 0, -360)
|
||||
|
||||
local abilityScroll = UI.CreateScrollFrame(detail)
|
||||
abilityScroll:SetPoint("TOPLEFT", detail, "TOPLEFT", 0, -368)
|
||||
abilityScroll:SetPoint("BOTTOMRIGHT", detail, "BOTTOMRIGHT", 0, 42)
|
||||
|
||||
local abilityNote = UI.CreateLabel(abilityScroll.child, "", { size = 11, color = "textDim" })
|
||||
|
||||
-- Knoepfe
|
||||
local status = UI.CreateLabel(detail, "", { size = 12 })
|
||||
status:SetWidth(360)
|
||||
|
||||
local refreshButton = UI.CreateButton(detail, L.PET_REFRESH, 170, 28, function()
|
||||
local ok, reason = Pet:Scan()
|
||||
if ok then
|
||||
status:SetText("|cff" .. UI.Hex("success") .. FW.L.PET_REFRESH_OK .. "|r")
|
||||
else
|
||||
local msg = FW.L.PET_REFRESH_FAIL
|
||||
if reason == "nopet" then
|
||||
msg = FW.L.PET_REFRESH_NOPET
|
||||
elseif reason == "combat" then
|
||||
msg = FW.L.PET_REFRESH_COMBAT
|
||||
elseif reason == "error" or reason == "nodata" then
|
||||
msg = FW.L.PET_REFRESH_ERROR
|
||||
end
|
||||
status:SetText("|cff" .. UI.Hex("danger") .. msg .. "|r")
|
||||
end
|
||||
end, "primary")
|
||||
refreshButton:SetPoint("BOTTOMLEFT", detail, "BOTTOMLEFT", 0, 0)
|
||||
|
||||
local confirming = false
|
||||
local deleteButton
|
||||
deleteButton = UI.CreateButton(detail, L.PET_DELETE, 160, 28, function()
|
||||
if confirming then
|
||||
confirming = false
|
||||
deleteButton:SetLabel(FW.L.PET_DELETE)
|
||||
deleteButton:SetStyle("danger")
|
||||
if Pet.selectedKey then
|
||||
Pet:Delete(Pet.selectedKey)
|
||||
end
|
||||
else
|
||||
confirming = true
|
||||
deleteButton:SetLabel(FW.L.PET_DELETE_CONFIRM)
|
||||
deleteButton:SetStyle("dangerActive")
|
||||
C_Timer.After(3, function()
|
||||
confirming = false
|
||||
deleteButton:SetLabel(FW.L.PET_DELETE)
|
||||
deleteButton:SetStyle("danger")
|
||||
end)
|
||||
end
|
||||
end, "danger")
|
||||
deleteButton:SetPoint("LEFT", refreshButton, "RIGHT", 8, 0)
|
||||
|
||||
status:SetPoint("LEFT", deleteButton, "RIGHT", 16, 0)
|
||||
|
||||
---------------- Inhalt fuellen ----------------
|
||||
local HAPPINESS = {
|
||||
[3] = { text = function() return FW.L.PET_HAPPY end, color = "success" },
|
||||
[2] = { text = function() return FW.L.PET_CONTENT end, color = "goldLight" },
|
||||
[1] = { text = function() return FW.L.PET_UNHAPPY end, color = "danger" },
|
||||
}
|
||||
|
||||
local function ShowFoods(foods)
|
||||
for _, chip in ipairs(foodChips) do
|
||||
chip:Hide()
|
||||
end
|
||||
if type(foods) ~= "table" or #foods == 0 then
|
||||
foodNone:Show()
|
||||
return
|
||||
end
|
||||
foodNone:Hide()
|
||||
local previous
|
||||
for i, food in ipairs(foods) do
|
||||
local chip = foodChips[i]
|
||||
if not chip then
|
||||
chip = UI.CreateChip(detail, food, "bronze")
|
||||
foodChips[i] = chip
|
||||
end
|
||||
chip:SetText(food, "goldAntique")
|
||||
chip:ClearAllPoints()
|
||||
if previous then
|
||||
chip:SetPoint("LEFT", previous, "RIGHT", 6, 0)
|
||||
else
|
||||
chip:SetPoint("LEFT", foodLabel, "RIGHT", 14, 0)
|
||||
end
|
||||
chip:Show()
|
||||
previous = chip
|
||||
end
|
||||
end
|
||||
|
||||
local function ShowAbilities(rec)
|
||||
local list = rec.abilities or {}
|
||||
local others = rec.others or {}
|
||||
|
||||
for i, ability in ipairs(list) do
|
||||
local row = abilityRows[i]
|
||||
if not row then
|
||||
row = UI.CreatePanel(abilityScroll.child, "card", "bronze")
|
||||
row:SetHeight(ABILITY_H)
|
||||
row.icon = row:CreateTexture(nil, "ARTWORK")
|
||||
row.icon:SetSize(ABILITY_H - 8, ABILITY_H - 8)
|
||||
row.icon:SetPoint("LEFT", row, "LEFT", 5, 0)
|
||||
row.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
|
||||
row.name = UI.CreateLabel(row, "", { size = 12 })
|
||||
row.name:SetPoint("LEFT", row.icon, "RIGHT", 8, 0)
|
||||
row.passive = UI.CreateLabel(row, "", { size = 10, color = "textDim", justify = "RIGHT" })
|
||||
row.chip = UI.CreateChip(row, "", "goldLight")
|
||||
row.chip:SetPoint("RIGHT", row, "RIGHT", -6, 0)
|
||||
row.passive:SetPoint("RIGHT", row.chip, "LEFT", -8, 0)
|
||||
abilityRows[i] = row
|
||||
end
|
||||
local y = (i - 1) * (ABILITY_H + 4)
|
||||
row:ClearAllPoints()
|
||||
row:SetPoint("TOPLEFT", abilityScroll.child, "TOPLEFT", 0, -y)
|
||||
row:SetPoint("TOPRIGHT", abilityScroll.child, "TOPRIGHT", 0, -y)
|
||||
row.name:SetText(ability.name or "?")
|
||||
local tex
|
||||
if ability.spellID then
|
||||
if C_Spell and C_Spell.GetSpellTexture then
|
||||
local ok, t = pcall(C_Spell.GetSpellTexture, ability.spellID)
|
||||
tex = ok and t or nil
|
||||
elseif GetSpellTexture then
|
||||
local ok, t = pcall(GetSpellTexture, ability.spellID)
|
||||
tex = ok and t or nil
|
||||
end
|
||||
end
|
||||
row.icon:SetTexture(tex or "Interface\\Icons\\INV_Misc_QuestionMark")
|
||||
row.passive:SetText(ability.passive and FW.L.PET_PASSIVE or "")
|
||||
if ability.rank then
|
||||
row.chip:SetText(string.format(FW.L.PET_RANK, ability.rank), "goldLight")
|
||||
row.chip:Show()
|
||||
else
|
||||
row.chip:Hide()
|
||||
end
|
||||
row:Show()
|
||||
end
|
||||
for i = #list + 1, #abilityRows do
|
||||
abilityRows[i]:Hide()
|
||||
end
|
||||
|
||||
local y = #list * (ABILITY_H + 4)
|
||||
local noteText
|
||||
if #list == 0 then
|
||||
noteText = FW.L.PET_NO_ABILITIES
|
||||
elseif #others > 0 then
|
||||
noteText = string.format(FW.L.PET_OTHERS, #others)
|
||||
end
|
||||
abilityNote:ClearAllPoints()
|
||||
abilityNote:SetPoint("TOPLEFT", abilityScroll.child, "TOPLEFT", 4, -(y + 6))
|
||||
abilityNote:SetText(noteText or "")
|
||||
abilityScroll:SetContentHeight(y + 30)
|
||||
end
|
||||
|
||||
local function ShowRecord(key, rec)
|
||||
current = rec
|
||||
local L2 = FW.L
|
||||
nameLabel:SetText(rec.name or "?")
|
||||
headIcon.tex:SetTexture(Pet.FamilyIcon and Pet.FamilyIcon(rec.family) or "Interface\\Icons\\Ability_Hunter_BeastTaming")
|
||||
subLabel:SetText(Subtitle(rec))
|
||||
updatedLabel:SetText(string.format(L2.PET_UPDATED, FormatTime(rec.updated or rec.importedAt)))
|
||||
|
||||
if key == Pet.activeKey then
|
||||
stateChip:SetText(L2.PET_ACTIVE, "success")
|
||||
stateChip:Show()
|
||||
elseif rec.src == "import" then
|
||||
stateChip:SetText(L2.PET_IMPORTED, "textDim")
|
||||
stateChip:Show()
|
||||
else
|
||||
stateChip:Hide()
|
||||
end
|
||||
|
||||
-- Zufriedenheit
|
||||
local happy = HAPPINESS[rec.happiness or 0]
|
||||
if happy then
|
||||
local text = happy.text()
|
||||
if rec.damagePct then
|
||||
text = string.format("%s (%d%%)", text, rec.damagePct)
|
||||
end
|
||||
cards.happiness:SetValue(text, happy.color)
|
||||
else
|
||||
cards.happiness:SetValue("-", "textDim")
|
||||
end
|
||||
|
||||
-- Treue
|
||||
if rec.loyaltyText then
|
||||
local plain = rec.loyaltyText:gsub("^%b()%s*", "")
|
||||
local text = plain ~= "" and plain or rec.loyaltyText
|
||||
if rec.loyaltyLevel then
|
||||
text = rec.loyaltyLevel .. " - " .. text
|
||||
end
|
||||
cards.loyalty:SetValue(text)
|
||||
else
|
||||
cards.loyalty:SetValue("-", "textDim")
|
||||
end
|
||||
|
||||
-- Trainingspunkte
|
||||
if rec.trainingTotal then
|
||||
local free = math.max(0, rec.trainingTotal - (rec.trainingSpent or 0))
|
||||
cards.training:SetValue(string.format(L2.PET_TRAINING_VALUE, free, rec.trainingTotal))
|
||||
else
|
||||
cards.training:SetValue("-", "textDim")
|
||||
end
|
||||
|
||||
-- Leben, Schaden (mit Tempo im Titel), Ruestung, dazu die Familienfaktoren
|
||||
local mods = Pet.GetFamilyMods and Pet.GetFamilyMods(rec.family)
|
||||
if rec.hpMax then
|
||||
cards.health:SetValue(string.format("%d", rec.hpMax))
|
||||
else
|
||||
cards.health:SetValue("-", "textDim")
|
||||
end
|
||||
SetFactor(cards.health, mods and mods.hp)
|
||||
if rec.dmgMin and rec.dmgMax then
|
||||
cards.damage:SetValue(string.format("%d - %d", rec.dmgMin, rec.dmgMax))
|
||||
else
|
||||
cards.damage:SetValue("-", "textDim")
|
||||
end
|
||||
if rec.speed then
|
||||
cards.damage:SetLabel(string.format("%s | %.1f s", L2.PET_DAMAGE, rec.speed))
|
||||
else
|
||||
cards.damage:SetLabel(L2.PET_DAMAGE)
|
||||
end
|
||||
SetFactor(cards.damage, mods and mods.dmg)
|
||||
SetFactor(cards.armor, mods and mods.armor)
|
||||
if rec.armor then
|
||||
cards.armor:SetValue(string.format("%d", rec.armor))
|
||||
else
|
||||
cards.armor:SetValue("-", "textDim")
|
||||
end
|
||||
|
||||
-- Zusatzwerte
|
||||
if rec.apBase then
|
||||
cards.ap:SetValue(string.format("%d", rec.apBase + (rec.apBonus or 0)))
|
||||
else
|
||||
cards.ap:SetValue("-", "textDim")
|
||||
end
|
||||
local crit = rec.critRanged or rec.critMelee
|
||||
if crit then
|
||||
cards.crit:SetValue(string.format("%.2f%%", crit))
|
||||
else
|
||||
cards.crit:SetValue("-", "textDim")
|
||||
end
|
||||
if rec.runSpeed then
|
||||
cards.move:SetValue(string.format("%d%%", math.floor(rec.runSpeed / 7 * 100 + 0.5)))
|
||||
else
|
||||
cards.move:SetValue("-", "textDim")
|
||||
end
|
||||
for school, card in pairs(resCards) do
|
||||
local v = rec.resist and rec.resist[school]
|
||||
if v then
|
||||
card:SetValue(string.format("%d", v))
|
||||
else
|
||||
card:SetValue("-", "textDim")
|
||||
end
|
||||
end
|
||||
|
||||
ShowFoods(rec.foods)
|
||||
ShowAbilities(rec)
|
||||
end
|
||||
|
||||
function f.Refresh()
|
||||
local keys = SortedKeys()
|
||||
|
||||
if not Pet.selectedKey or not Pet.db.pets[Pet.selectedKey] then
|
||||
Pet.selectedKey = (Pet.activeKey and Pet.db.pets[Pet.activeKey]) and Pet.activeKey or keys[1]
|
||||
end
|
||||
|
||||
for i, key in ipairs(keys) do
|
||||
local rec = Pet.db.pets[key]
|
||||
local row = rows[i]
|
||||
if not row then
|
||||
row = CreateListRow(listScroll.child, function(selectedKey)
|
||||
Pet.selectedKey = selectedKey
|
||||
f.Refresh()
|
||||
end)
|
||||
rows[i] = row
|
||||
end
|
||||
row.key = key
|
||||
local y = (i - 1) * (ROW_H + ROW_GAP)
|
||||
row:ClearAllPoints()
|
||||
row:SetPoint("TOPLEFT", listScroll.child, "TOPLEFT", 0, -y)
|
||||
row:SetPoint("TOPRIGHT", listScroll.child, "TOPRIGHT", 0, -y)
|
||||
row.name:SetText(rec.name or "?")
|
||||
row.icon:SetTexture(Pet.FamilyIcon and Pet.FamilyIcon(rec.family) or "Interface\\Icons\\Ability_Hunter_BeastTaming")
|
||||
row.sub:SetText(Subtitle(rec))
|
||||
if key == Pet.activeKey then
|
||||
row.chip:SetText(FW.L.PET_ACTIVE, "success")
|
||||
row.chip:Show()
|
||||
elseif rec.src == "import" then
|
||||
row.chip:SetText(FW.L.PET_IMPORTED, "textDim")
|
||||
row.chip:Show()
|
||||
else
|
||||
row.chip:Hide()
|
||||
end
|
||||
row:SetSelected(key == Pet.selectedKey)
|
||||
row:Show()
|
||||
end
|
||||
for i = #keys + 1, #rows do
|
||||
rows[i]:Hide()
|
||||
end
|
||||
listScroll:SetContentHeight(#keys * (ROW_H + ROW_GAP))
|
||||
|
||||
local rec = Pet.selectedKey and Pet.db.pets[Pet.selectedKey]
|
||||
if rec then
|
||||
empty:Hide()
|
||||
detail:Show()
|
||||
ShowRecord(Pet.selectedKey, rec)
|
||||
refreshButton:SetButtonEnabled(UnitExists("pet") and true or false)
|
||||
else
|
||||
detail:Hide()
|
||||
empty:Show()
|
||||
end
|
||||
end
|
||||
|
||||
FW:On("PET_UPDATED", function()
|
||||
if f:IsVisible() then
|
||||
f.Refresh()
|
||||
end
|
||||
end)
|
||||
|
||||
f.Refresh()
|
||||
return f
|
||||
end
|
||||
|
||||
UI:RegisterTab("pet", {
|
||||
label = function()
|
||||
return FW.L.PET_TAB
|
||||
end,
|
||||
order = 60,
|
||||
build = Build,
|
||||
onShow = function(f)
|
||||
f.Refresh()
|
||||
end,
|
||||
})
|
||||
|
||||
SLASH_FREEWOODPET1 = "/fwpet"
|
||||
SlashCmdList["FREEWOODPET"] = function()
|
||||
UI:Toggle("pet")
|
||||
end
|
||||
Reference in New Issue
Block a user