mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Codex.git
synced 2026-11-03 00:36:56 +00:00
0.1.186: Rechenspitzen im Hintergrund (Lernplan, Ziele, Datenzählung, Berufs-Hinweis)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
f3ad39df3e
commit
f6061b92f2
+23
-1
@@ -68,9 +68,15 @@ function Hints.ClassEntries(level)
|
||||
end
|
||||
|
||||
-- Berufslehrer-Fähigkeiten, deren Fertigkeitswert in (von, bis] liegt
|
||||
function Hints.ProfEntries(skill, from, to)
|
||||
function Hints.ProfEntries(skill, from, to, yield)
|
||||
local list, seen = {}, {}
|
||||
local n = 0
|
||||
for _, u in pairs(Codex.V().units) do
|
||||
n = n + 1
|
||||
if yield and n % 250 == 0 then
|
||||
local Q = FW.Quest
|
||||
if Q and Q.Yield then Q.Yield() end
|
||||
end
|
||||
if u.tr and u.ro and (u.ro.proftrainer or 0) > 0 then
|
||||
for key, r in pairs(u.tr) do
|
||||
if r.sn == skill and r.sr and r.sr > from and r.sr <= to then
|
||||
@@ -284,6 +290,22 @@ function Hints.OnSkill(skill, value)
|
||||
local from = prevSkill[skill] or (value - 1)
|
||||
prevSkill[skill] = value
|
||||
if not Hints.ProfOn() or not Codex.db.settings.enabled then return false end
|
||||
-- Die Suche ueber alle Lehrer dauerte bis 450 ms am Stueck: wenn das Quest-Modul laeuft, in kleinen Stuecken im Hintergrund
|
||||
local Q = FW.Quest
|
||||
if Q and Q.Slice and Q.Slice.Run and Q.Yield then
|
||||
local title = string.format(FW.L.CODEX_HINT_PROF_TITLE, skill, value)
|
||||
local started = Q.Slice.Run("skillhint:" .. skill .. ":" .. value, function()
|
||||
return Hints.ProfEntries(skill, from, value, true)
|
||||
end, {
|
||||
silent = true,
|
||||
done = function(ok, entries)
|
||||
if ok and type(entries) == "table" then
|
||||
Hints.Push({ title = title, entries = entries, onClick = function() UI:Show("codex") end })
|
||||
end
|
||||
end,
|
||||
})
|
||||
if started then return true end
|
||||
end
|
||||
local entries = Hints.ProfEntries(skill, from, value)
|
||||
return Hints.Push({ title = string.format(FW.L.CODEX_HINT_PROF_TITLE, skill, value), entries = entries, onClick = function() UI:Show("codex") end })
|
||||
end
|
||||
|
||||
@@ -997,8 +997,19 @@ Codex.CLASS_TOKENS = {}
|
||||
for token in pairs(CLASS_WORDS) do Codex.CLASS_TOKENS[token] = true end
|
||||
|
||||
-- Klasse eines Lehrers aus der Titelzeile ("Hexenmeisterlehrer" -> WARLOCK)
|
||||
-- Ergebnis je Titel merken: der Lernplan fragt fuer jeden Lehrer mehrfach, und die Wortsuche ueber alle Klassennamen
|
||||
-- war der groesste Teil der Rechenzeit (Dev-Log: ca. 540 ms fuer den Lernplan).
|
||||
local titleClass = {}
|
||||
function Codex.ClassOfTitle(title)
|
||||
if type(title) ~= "string" or title == "" then return nil end
|
||||
local c = titleClass[title]
|
||||
if c ~= nil then return c or nil end
|
||||
c = Codex.ClassOfTitleCompute(title)
|
||||
titleClass[title] = c or false
|
||||
return c
|
||||
end
|
||||
|
||||
function Codex.ClassOfTitleCompute(title)
|
||||
local low = title:lower()
|
||||
local best, bestLen
|
||||
for token, words in pairs(CLASS_WORDS) do
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Notes: Learns quests, creatures and drops while you play: who gives and takes a quest, rewards, objectives, drop chances.
|
||||
## Notes-deDE: Lernt beim Spielen Quests, Kreaturen und Beute: wer eine Quest vergibt und annimmt, Belohnungen, Ziele, Drop-Chancen.
|
||||
## Author: Lacustat
|
||||
## Version: 0.1.185
|
||||
## Version: 0.1.186
|
||||
## Dependencies: Freewood-OctoWoW-Core
|
||||
## OptionalDeps: Freewood-OctoWoW-CodexData, Freewood-OctoWoW-ForeverData
|
||||
|
||||
|
||||
Reference in New Issue
Block a user