Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
06a1f1177a | |||
475b2b3e1f | |||
e53900d2b1 | |||
45099a9a3b |
3
.retail.toc
Normal file
3
.retail.toc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## Interface: 90005
|
||||||
|
|
||||||
|
## X-Build: Retail
|
34
CHANGELOG.md
34
CHANGELOG.md
@@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Version 1.1.1 - 2021-04-22
|
||||||
|
### Changed
|
||||||
|
- bumped versions for WoW Classic and Shadowlands
|
||||||
|
|
||||||
|
## Version 1.1.0 - 2020-12-08
|
||||||
|
### Added
|
||||||
|
- split of messages preserves item links, textures, substitutions and raid target markers
|
||||||
|
- added safety measures to prevent endless replacement loops
|
||||||
|
### Changed
|
||||||
|
- bumped version for Shadowlands
|
||||||
|
- bumped version for Naxxramas
|
||||||
|
### Fixed
|
||||||
|
- split of messages with excessive length no longer causes errors or broken texts
|
||||||
|
- proper handling of umlauts
|
||||||
|
|
||||||
|
## Version 1.0.1 - 2020-10-17
|
||||||
|
### Changed
|
||||||
|
- bumped version for Shadowlands Pre-Patch
|
||||||
|
|
||||||
|
## Version 1.0.0 - 2020-09-01 [First Release]
|
||||||
|
### Added
|
||||||
|
- info section with contact and thanks
|
||||||
|
### Fixed
|
||||||
|
- minor clarifications and spellings errors on help texts
|
||||||
|
|
||||||
|
## Version 0.9.1-rc - 2020-08-01 [Release Candidate]
|
||||||
|
### Fixed
|
||||||
|
- emote detection mixed in other channels
|
||||||
|
- minimap button and dialog no longer resets active state after profile change
|
||||||
|
- default entries are no longer shown after example import
|
||||||
|
- better handling of capture groups and character sets
|
||||||
|
|
||||||
## Version 0.9.0-rc - 2020-07-25 [Release Candidate]
|
## Version 0.9.0-rc - 2020-07-25 [Release Candidate]
|
||||||
### Added
|
### Added
|
||||||
- enable/disable from slash command
|
- enable/disable from slash command
|
||||||
@@ -20,7 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- stop replacements per mapping
|
- stop replacements per mapping
|
||||||
- more ooc recognition patterns
|
- more ooc recognition patterns
|
||||||
### Fixed
|
### Fixed
|
||||||
- keep cases of over-long replacements
|
- keep cases of replacements with excessive length
|
||||||
|
|
||||||
## Version 0.8.0-beta - 2020-06-14 [Feature Complete]
|
## Version 0.8.0-beta - 2020-06-14 [Feature Complete]
|
||||||
### Added
|
### Added
|
||||||
|
@@ -42,9 +42,9 @@ function Grichelde:OnEnable()
|
|||||||
self:RawHook("SendChatMessage", true)
|
self:RawHook("SendChatMessage", true)
|
||||||
|
|
||||||
self.options, self.dialog = self:SetupOptions()
|
self.options, self.dialog = self:SetupOptions()
|
||||||
self:RefreshOptions("OnProfileChanged")
|
|
||||||
|
|
||||||
self.ldb, self.icon = self:MinimapButton()
|
self.ldb, self.icon = self:MinimapButton()
|
||||||
|
|
||||||
|
self:RefreshProfiles("OnEnable")
|
||||||
self:SetupSlashCommands()
|
self:SetupSlashCommands()
|
||||||
|
|
||||||
-- tell the world we are listening
|
-- tell the world we are listening
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
## Interface: 11305
|
## Interface: 11307
|
||||||
|
|
||||||
## Title: Grichelde
|
## Title: Grichelde
|
||||||
## Notes: Replaces characters from the chat box
|
## Notes: Replaces characters of your chat input line before sending.
|
||||||
## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile
|
## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
|
||||||
## Version: 0.9.0-rc
|
## Version: 1.1.1
|
||||||
## Author: Teilzeit-Jedi
|
## Author: Teilzeit-Jedi
|
||||||
## eMail: tj@teilzeit-jedi.de
|
## eMail: tj@teilzeit-jedi.de
|
||||||
|
|
||||||
|
@@ -2,44 +2,139 @@
|
|||||||
local _G = _G
|
local _G = _G
|
||||||
local Grichelde = _G.Grichelde or {}
|
local Grichelde = _G.Grichelde or {}
|
||||||
|
|
||||||
local IsAddOnLoaded, assert, nilOrEmpty, pairs, ipairs, spairs, tContains, tFilter, tInsert, tConcat, tSize, tIsEmpty, find, sub, gsub, gmatch, getNextCharUtf8, isUpper, isLower, toUpper, toLower, capitalize, trim, length, lengthUtf8
|
local IsAddOnLoaded, assert, nilOrEmpty, pairs, ipairs, spairs, tContains, tFilter, tInsert, tConcat, tSize, tIsEmpty, find, sub, gsub, gmatch, getNextCharUtf8, isLetter, isUpper, isLower, toUpper, toLower, capitalize, bytes2Char, trim, length, lengthUtf8
|
||||||
= Grichelde.F.IsAddOnLoaded, Grichelde.F.assert, Grichelde.F.nilOrEmpty, Grichelde.F.pairs, Grichelde.F.ipairs, Grichelde.F.spairs, Grichelde.F.tContains, Grichelde.F.tFilter, Grichelde.F.tInsert, Grichelde.F.tConcat, Grichelde.F.tSize, Grichelde.F.tIsEmpty,
|
= Grichelde.F.IsAddOnLoaded, Grichelde.F.assert, Grichelde.F.nilOrEmpty, Grichelde.F.pairs, Grichelde.F.ipairs, Grichelde.F.spairs, Grichelde.F.tContains, Grichelde.F.tFilter, Grichelde.F.tInsert, Grichelde.F.tConcat, Grichelde.F.tSize, Grichelde.F.tIsEmpty,
|
||||||
Grichelde.F.find, Grichelde.F.sub, Grichelde.F.gsub, Grichelde.F.gmatch, Grichelde.F.getNextCharUtf8, Grichelde.F.isUpper, Grichelde.F.isLower, Grichelde.F.toUpper, Grichelde.F.toLower, Grichelde.F.capitalize, Grichelde.F.trim, Grichelde.F.length, Grichelde.F.lengthUtf8
|
Grichelde.F.find, Grichelde.F.sub, Grichelde.F.gsub, Grichelde.F.gmatch, Grichelde.F.getNextCharUtf8, Grichelde.F.isLetter, Grichelde.F.isUpper, Grichelde.F.isLower, Grichelde.F.toUpper, Grichelde.F.toLower, Grichelde.F.capitalize, Grichelde.F.bytes2Char, Grichelde.F.trim, Grichelde.F.length, Grichelde.F.lengthUtf8
|
||||||
|
|
||||||
--- Splits a long text in longest possible chunks of <= 255 length, split at last available space
|
--- Splits a long text in longest possible chunks of <= 255 length, split at last available space
|
||||||
-- @param text string
|
-- @param text string
|
||||||
-- @return table
|
-- @return array of chunks
|
||||||
function Grichelde:SplitText(text)
|
function Grichelde:SplitText(text)
|
||||||
local chunks = {}
|
local chunks = {}
|
||||||
local splitText = text
|
local leftGuillemet = bytes2Char(194, 171) .. " "
|
||||||
local textSize = length(splitText or "")
|
local rightGuillemet = " " .. bytes2Char(194, 187)
|
||||||
|
local chunkSize = Grichelde.INPUT_LIMIT - length(leftGuillemet) - length(rightGuillemet)
|
||||||
|
|
||||||
while (textSize > 255) do
|
local function preserveText(newText, chunk, blockText, posEnd)
|
||||||
local chunk = sub(splitText, 1, 255)
|
-- link found, block completed
|
||||||
local remaining = ""
|
self:TracePrint("SplitText : Found preservable text up to %s", posEnd)
|
||||||
|
local preserved = sub(newText, 1, posEnd)
|
||||||
|
|
||||||
-- special case: if space is the start of the next chunk, don't split this chunk
|
if ((length(chunk) > 0) and (length(chunk .. blockText) > chunkSize)) then
|
||||||
if (sub(splitText, 256, 256) ~= ' ') then
|
-- block exceeds chunk, chunkify previous blocks
|
||||||
-- split at last space, don't assign directly as nil might be returned
|
self:DebugPrint("SplitText : add chunk:", chunk)
|
||||||
local left, right = self:SplitOnLastMatch(chunk)
|
tInsert(chunks, chunk .. rightGuillemet)
|
||||||
if (left ~= nil) then
|
chunk = leftGuillemet .. trim(blockText)
|
||||||
chunk = left
|
else
|
||||||
|
chunk = chunk .. blockText
|
||||||
end
|
end
|
||||||
if (right ~= nil) then
|
|
||||||
remaining = right
|
if ((length(chunk) > 0) and (length(chunk .. preserved) > chunkSize)) then
|
||||||
|
-- block exceeds chunk, chunkify previous blocks
|
||||||
|
self:DebugPrint("SplitText : add chunk:", chunk)
|
||||||
|
tInsert(chunks, chunk .. rightGuillemet)
|
||||||
|
chunk = leftGuillemet .. trim(preserved)
|
||||||
|
else
|
||||||
|
chunk = chunk .. preserved
|
||||||
|
end
|
||||||
|
|
||||||
|
blockText = ""
|
||||||
|
newText = sub(newText, posEnd + 1)
|
||||||
|
|
||||||
|
return newText, chunk, blockText, posEnd
|
||||||
|
end
|
||||||
|
|
||||||
|
if (length(text or "") <= Grichelde.INPUT_LIMIT) then
|
||||||
|
self:DebugPrint("SplitText : no chunk:", text)
|
||||||
|
tInsert(chunks, text)
|
||||||
|
else
|
||||||
|
local lookAheads = { '|', '*', '<', '%', '{', '(', 'o' }
|
||||||
|
|
||||||
|
local newText = text or ""
|
||||||
|
local chunk, blockText = "", ""
|
||||||
|
local currentChar
|
||||||
|
local escape = 0
|
||||||
|
|
||||||
|
-- must not enforce UTF-8 support here, as the positions are used
|
||||||
|
while ((length(newText) > 0) and (escape < Grichelde.ENDLESS_LOOP_LIMIT)) do
|
||||||
|
escape = escape + 1
|
||||||
|
local previousChar = currentChar
|
||||||
|
local first, textAhead = getNextCharUtf8(newText)
|
||||||
|
currentChar = first
|
||||||
|
self:DebugPrint("SplitText : currentChar, escape: %s, %s", currentChar, escape)
|
||||||
|
self:TracePrint("SplitText : chunk:", chunk)
|
||||||
|
self:TracePrint("SplitText : newText:", newText)
|
||||||
|
|
||||||
|
-- as there is not OR in Luas pattern matching, search for all of the exclude patterns after another is
|
||||||
|
-- cumbersome and inefficient -> look for each char consecutively if it matches the starting pattern only
|
||||||
|
-- and if if matches do full pattern matching
|
||||||
|
if (currentChar == ' ') then
|
||||||
|
self:TracePrint("SplitText : block completed")
|
||||||
|
|
||||||
|
if ((length(chunk) > 0) and (length(chunk .. blockText) > chunkSize)) then
|
||||||
|
-- block exceeds chunk, chunkify previous blocks
|
||||||
|
self:DebugPrint("SplitText : add chunk:", chunk)
|
||||||
|
tInsert(chunks, chunk .. rightGuillemet)
|
||||||
|
chunk = leftGuillemet .. trim(blockText)
|
||||||
|
else
|
||||||
|
chunk = chunk .. blockText
|
||||||
|
end
|
||||||
|
|
||||||
|
blockText = currentChar
|
||||||
|
newText = textAhead
|
||||||
|
elseif (tContains(lookAheads, currentChar)) then
|
||||||
|
-- lookahead-check for all preservable patterns (itemLinks, textures, emotes, ooc, etc.)
|
||||||
|
|
||||||
|
-- link detection
|
||||||
|
local linkPosEnd = self:CheckForLink(newText, currentChar)
|
||||||
|
if (linkPosEnd ~= nil) then
|
||||||
|
-- link found, block completed
|
||||||
|
newText, chunk, blockText = preserveText(newText, chunk, blockText, linkPosEnd)
|
||||||
|
else
|
||||||
|
-- substitution detection
|
||||||
|
local substPosEnd = self:CheckForSubstitutions(newText, currentChar)
|
||||||
|
if (substPosEnd ~= nil) then
|
||||||
|
-- substitution found, block completed
|
||||||
|
newText, chunk, blockText = preserveText(newText, chunk, blockText, substPosEnd)
|
||||||
|
else
|
||||||
|
-- raid target marker detection
|
||||||
|
local rtmPosEnd = self:CheckForRaidTargetMarkers(newText, currentChar)
|
||||||
|
if (rtmPosEnd ~= nil) then
|
||||||
|
-- raid target marker found, block completed
|
||||||
|
newText, chunk, blockText = preserveText(newText, chunk, blockText, rtmPosEnd)
|
||||||
|
else
|
||||||
|
blockText = blockText .. currentChar
|
||||||
|
newText = textAhead
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
blockText = blockText .. currentChar
|
||||||
|
newText = textAhead
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:DebugPrint("SplitText : chunk:", chunk)
|
self:TracePrint("SplitText : main loop completed")
|
||||||
|
if (length(chunk .. blockText) > 0) then
|
||||||
|
-- catchup remaining text at the end
|
||||||
|
if (length(chunk .. blockText) > chunkSize) then
|
||||||
|
-- block exceeds chunk, chunkify previous blocks
|
||||||
|
if (length(chunk) > 0) then
|
||||||
|
self:DebugPrint("SplitText : add chunk:", chunk)
|
||||||
|
tInsert(chunks, chunk .. rightGuillemet)
|
||||||
|
chunk = leftGuillemet .. trim(blockText)
|
||||||
|
else
|
||||||
|
chunk = chunk .. blockText
|
||||||
|
end
|
||||||
|
else
|
||||||
|
chunk = chunk .. blockText
|
||||||
|
end
|
||||||
|
|
||||||
|
self:DebugPrint("SplitText : last chunk:", chunk)
|
||||||
|
-- sub(chunk, 1, 255) can result in broken UTF8 chars and error message
|
||||||
tInsert(chunks, chunk)
|
tInsert(chunks, chunk)
|
||||||
splitText = remaining .. sub(splitText, 256)
|
|
||||||
textSize = length(splitText)
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- pickup remaining text < 255
|
|
||||||
self:DebugPrint("SplitText : last chunk:", splitText)
|
|
||||||
tInsert(chunks, splitText)
|
|
||||||
|
|
||||||
return chunks
|
return chunks
|
||||||
end
|
end
|
||||||
@@ -63,10 +158,11 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
|
|||||||
local ciPattern = ""
|
local ciPattern = ""
|
||||||
local ignored = {'^', '$', '(', ')', '.'}
|
local ignored = {'^', '$', '(', ')', '.'}
|
||||||
local quantifiers = {'*', '+', '-', '?'}
|
local quantifiers = {'*', '+', '-', '?'}
|
||||||
local pos = 1
|
|
||||||
local p, patRest = getNextCharUtf8(pattern)
|
local p, patRest = getNextCharUtf8(pattern)
|
||||||
|
local escape = 0
|
||||||
|
|
||||||
while (p ~= nil) do
|
while ((p ~= nil) and (escape < Grichelde.ENDLESS_LOOP_LIMIT)) do
|
||||||
|
escape = escape + 1
|
||||||
if (tContains(ignored, p) or tContains(quantifiers, p)) then
|
if (tContains(ignored, p) or tContains(quantifiers, p)) then
|
||||||
-- ignore
|
-- ignore
|
||||||
ciPattern = ciPattern .. p
|
ciPattern = ciPattern .. p
|
||||||
@@ -81,7 +177,20 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
|
|||||||
ciPattern = ciPattern .. "["
|
ciPattern = ciPattern .. "["
|
||||||
p, patRest = getNextCharUtf8(patRest)
|
p, patRest = getNextCharUtf8(patRest)
|
||||||
while ((p ~= nil) and (p ~= "]")) do
|
while ((p ~= nil) and (p ~= "]")) do
|
||||||
ciPattern = ciPattern .. Grichelde.F.toUpper(p) .. Grichelde.F.toLower(p)
|
if (p == "%") then
|
||||||
|
-- ignore capture references
|
||||||
|
p, patRest = getNextCharUtf8(patRest)
|
||||||
|
if (p ~= nil) then
|
||||||
|
ciPattern = ciPattern .. "%" .. p
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local upperP, lowerP = toUpper(p), toLower(p)
|
||||||
|
if (upperP ~= lowerP) then
|
||||||
|
ciPattern = ciPattern .. upperP .. lowerP
|
||||||
|
else
|
||||||
|
ciPattern = ciPattern .. p
|
||||||
|
end
|
||||||
|
end
|
||||||
p, patRest = getNextCharUtf8(patRest)
|
p, patRest = getNextCharUtf8(patRest)
|
||||||
end
|
end
|
||||||
ciPattern = ciPattern .. "]"
|
ciPattern = ciPattern .. "]"
|
||||||
@@ -313,6 +422,8 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
|
|||||||
findText = result
|
findText = result
|
||||||
-- update values for next iteration
|
-- update values for next iteration
|
||||||
pos1, pos2, cap1, cap2, cap3, cap4, cap5, cap6, cap7, cap8, cap9 = find(findText, searchText, pos)
|
pos1, pos2, cap1, cap2, cap3, cap4, cap5, cap6, cap7, cap8, cap9 = find(findText, searchText, pos)
|
||||||
|
self:TracePrint("ReplaceCharacters : pos1: %d, pos2: %d", pos1, pos2)
|
||||||
|
self:TracePrint("ReplaceCharacters : cap1: %s, cap2: %s, cap3: %s, cap4: %s, cap5: %s, cap6: %s, cap7: %s, cap8: %s, cap9: %s", cap1, cap2, cap3, cap4, cap5, cap6, cap7, cap8, cap9)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (text ~= result) then
|
if (text ~= result) then
|
||||||
@@ -414,47 +525,43 @@ function Grichelde:ReplaceAndConsolidate(text, replacements)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Checks if the text starts with a preversable ignore pattern, such as itemLinks, textures, raid target icons,
|
--- looks for colored items, item links or textures
|
||||||
--- emotes, ooc or %-substitutons and returns the end location of the match, or 0 if no pattern was found
|
function Grichelde:CheckForLink(text, currentChar)
|
||||||
-- @param text string
|
|
||||||
-- @param currentChar string(1) current character (first one) of the text, given for performance reasons
|
|
||||||
-- @param previousChar string(1) previous character of the text, otherwise unreachable
|
|
||||||
-- @param preserveEmotes boolean ignore replacements for emotes, for testing purposes
|
|
||||||
-- @return number
|
|
||||||
function Grichelde:CheckForPreversableText(text, currentChar, previousChar, replaceEmotes)
|
|
||||||
self:DebugPrint("CheckForPreversableText : text:", text)
|
|
||||||
local replaceEmotes = replaceEmotes or self.db.profile.channels.emote or false
|
|
||||||
|
|
||||||
-- Calling find on ever pattern might be inefficient but its way less code than marching over every character
|
|
||||||
if (currentChar == "|") then
|
if (currentChar == "|") then
|
||||||
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.LINKS) do
|
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.LINKS) do
|
||||||
local pos1, pos2 = find(text, "^" .. pattern)
|
local pos1, pos2 = find(text, "^" .. pattern)
|
||||||
if (pos1 == 1) and (pos2 ~= nil) then
|
if (pos1 == 1) and (pos2 ~= nil) then
|
||||||
self:DebugPrint("CheckForPreversableText : Found link or texture pattern \"%s\" at (%d, %d)", pattern, pos1, pos2)
|
local match = sub(text, pos1, pos2)
|
||||||
|
self:DebugPrint("CheckForLink : Found link or texture pattern \"%s\" at (%d, %d)", pattern, pos1, pos2)
|
||||||
return pos2
|
return pos2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- emote detection
|
--- looks for emotes
|
||||||
|
function Grichelde:CheckForEmote(text, currentChar, replaceEmotes)
|
||||||
if (currentChar == "*" or currentChar == "<") then
|
if (currentChar == "*" or currentChar == "<") then
|
||||||
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.EMOTES) do
|
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.EMOTES) do
|
||||||
local pos1, pos2 = find(text, "^" .. pattern)
|
local pos1, pos2 = find(text, "^" .. pattern)
|
||||||
if (pos1 == 1) and (pos2 ~= nil) then
|
if (pos1 == 1) and (pos2 ~= nil) then
|
||||||
local emote = sub(text, pos1, pos2)
|
local emote = sub(text, pos1, pos2)
|
||||||
if (replaceEmotes) then
|
if (not replaceEmotes) then
|
||||||
self:DebugPrint("CheckForPreversableText : Found emote \"%s\" but preserved it", emote)
|
self:DebugPrint("CheckForEmote : Found emote \"%s\" at (%d, %d), but preserved it", emote, pos1, pos2)
|
||||||
return pos2
|
return pos2
|
||||||
else
|
else
|
||||||
self:DebugPrint("CheckForPreversableText : Found emote \"%s\" at (%d, %d)", emote, pos1, pos2)
|
self:DebugPrint("CheckForEmote : Processing emote \"%s\" at (%d, %d)", emote, pos1, pos2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- looks for %-substitutions
|
||||||
|
function Grichelde:CheckForSubstitutions(text, currentChar)
|
||||||
local lowerText = toLower(text)
|
local lowerText = toLower(text)
|
||||||
|
|
||||||
-- %-substitutions
|
|
||||||
if (currentChar == "%") then
|
if (currentChar == "%") then
|
||||||
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.SUBSTITUTES) do
|
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.SUBSTITUTES) do
|
||||||
local pos1, pos2 = find(lowerText, "^" .. pattern)
|
local pos1, pos2 = find(lowerText, "^" .. pattern)
|
||||||
@@ -464,8 +571,12 @@ function Grichelde:CheckForPreversableText(text, currentChar, previousChar, repl
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- raid target markers
|
--- looks for general and localized raid target markers
|
||||||
|
function Grichelde:CheckForRaidTargetMarkers(text, currentChar)
|
||||||
|
local lowerText = toLower(text)
|
||||||
if (currentChar == "{") then
|
if (currentChar == "{") then
|
||||||
-- rt1-9
|
-- rt1-9
|
||||||
local pattern = Grichelde.IGNORE_PATTERNS.RAID_TARGETS[1]
|
local pattern = Grichelde.IGNORE_PATTERNS.RAID_TARGETS[1]
|
||||||
@@ -486,8 +597,12 @@ function Grichelde:CheckForPreversableText(text, currentChar, previousChar, repl
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- ooc bracket detection
|
--- looks for ooc with brackets
|
||||||
|
function Grichelde:CheckForOocBrackets(text, currentChar)
|
||||||
|
local lowerText = toLower(text)
|
||||||
if (currentChar == "(") then
|
if (currentChar == "(") then
|
||||||
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.OOC_BRACKETS) do
|
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.OOC_BRACKETS) do
|
||||||
local pos1, pos2 = find(lowerText, "^" .. pattern)
|
local pos1, pos2 = find(lowerText, "^" .. pattern)
|
||||||
@@ -497,15 +612,63 @@ function Grichelde:CheckForPreversableText(text, currentChar, previousChar, repl
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- ooc without brackets: remaing text is treated as ooc completely!
|
--- looks for ooc without brackets
|
||||||
|
function Grichelde:CheckForOocNoBrackets(text, currentChar, previousChar)
|
||||||
|
local lowerText = toLower(text)
|
||||||
if (currentChar == "o") then
|
if (currentChar == "o") then
|
||||||
local pattern = Grichelde.IGNORE_PATTERNS.OOC_NO_BRACKETS[1]
|
local pattern = Grichelde.IGNORE_PATTERNS.OOC_NO_BRACKETS[1]
|
||||||
if ((previousChar == nil) or (find(previousChar, "%s") ~= nil)) and (find(lowerText, pattern) ~= nil) then
|
if ((previousChar == nil) or (find(previousChar, "%s") ~= nil)) and (find(lowerText, pattern) ~= nil) then
|
||||||
self:DebugPrint("CheckForPreversableText : ooc for remaing text")
|
self:DebugPrint("CheckForPreversableText : ooc for remaing text")
|
||||||
|
-- remaing text is treated as ooc completely!
|
||||||
return length(text)
|
return length(text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Checks if the text starts with a preversable ignore pattern, such as itemLinks, textures, raid target icons,
|
||||||
|
--- emotes, ooc or %-substitutons and returns the end location of the match, or 0 if no pattern was found
|
||||||
|
-- @param text string
|
||||||
|
-- @param currentChar string(1) current character (first one) of the text, given for performance reasons
|
||||||
|
-- @param previousChar string(1) previous character of the text, otherwise unreachable
|
||||||
|
-- @param preserveEmotes boolean ignore replacements for emotes, for testing purposes
|
||||||
|
-- @return number
|
||||||
|
function Grichelde:CheckForPreversableText(text, currentChar, previousChar, replaceEmotes)
|
||||||
|
self:DebugPrint("CheckForPreversableText : text:", text)
|
||||||
|
local replaceEmotes = replaceEmotes or self.db.profile.channels.emote or false
|
||||||
|
|
||||||
|
local linkPos = self:CheckForLink(text, currentChar)
|
||||||
|
if (linkPos ~= nil) then
|
||||||
|
return linkPos
|
||||||
|
end
|
||||||
|
|
||||||
|
local emotePos = self:CheckForEmote(text, currentChar, replaceEmotes)
|
||||||
|
if (emotePos ~= nil) then
|
||||||
|
return emotePos
|
||||||
|
end
|
||||||
|
|
||||||
|
local substPos = self:CheckForSubstitutions(text, currentChar)
|
||||||
|
if (substPos ~= nil) then
|
||||||
|
return substPos
|
||||||
|
end
|
||||||
|
|
||||||
|
local rtmPos = self:CheckForRaidTargetMarkers(text, currentChar)
|
||||||
|
if (rtmPos ~= nil) then
|
||||||
|
return rtmPos
|
||||||
|
end
|
||||||
|
|
||||||
|
local oocBracketPos = self:CheckForOocBrackets(text, currentChar)
|
||||||
|
if (oocBracketPos ~= nil) then
|
||||||
|
return oocBracketPos
|
||||||
|
end
|
||||||
|
|
||||||
|
local oocNoBracketPos = self:CheckForOocNoBrackets(text, currentChar, previousChar)
|
||||||
|
if (oocNoBracketPos ~= nil) then
|
||||||
|
return oocNoBracketPos
|
||||||
|
end
|
||||||
|
|
||||||
self:DebugPrint("CheckForPreversableText : no ignore pattern found")
|
self:DebugPrint("CheckForPreversableText : no ignore pattern found")
|
||||||
return 0
|
return 0
|
||||||
@@ -521,49 +684,49 @@ function Grichelde:ReplaceText(text, replacements, replaceEmotes)
|
|||||||
local newText = text
|
local newText = text
|
||||||
local preserveEmotes = replaceEmotes or self.db.profile.channels.emote or false
|
local preserveEmotes = replaceEmotes or self.db.profile.channels.emote or false
|
||||||
local replacements = replacements or self.db.profile.replacements or {}
|
local replacements = replacements or self.db.profile.replacements or {}
|
||||||
local finalText = ""
|
local finalText, replaceText = "", ""
|
||||||
|
local currentChar
|
||||||
|
local escape = 0
|
||||||
|
|
||||||
local currentChar, previousChar
|
-- must not enforce UTF-8 support here, as the positions are used
|
||||||
local current = 1
|
while ((length(newText) > 0) and (escape < Grichelde.ENDLESS_LOOP_LIMIT)) do
|
||||||
local lastStart = 1
|
escape = escape + 1
|
||||||
|
local previousChar = currentChar
|
||||||
-- no UTF-8 support required here, as the positions are used
|
local first, textAhead = getNextCharUtf8(newText)
|
||||||
while current <= length(newText) do
|
currentChar = first
|
||||||
previousChar = currentChar
|
self:TracePrint("ReplaceText : currentChar : %s", currentChar)
|
||||||
currentChar = sub(newText, current, current)
|
|
||||||
self:TracePrint("ReplaceText : current/char : %s,%s", current, currentChar)
|
|
||||||
|
|
||||||
-- as there is not OR in Luas pattern matching, search for all of the exclude patterns after another is
|
-- as there is not OR in Luas pattern matching, search for all of the exclude patterns after another is
|
||||||
-- cumbersome and inefficient -> look for each char consecutively if it matches the starting pattern only
|
-- cumbersome and inefficient -> look for each char consecutively if it matches the starting pattern only
|
||||||
-- and if if matches do full pattern matching
|
-- and if if matches do full pattern matching
|
||||||
if (not tContains(lookAheads, currentChar)) then
|
if (tContains(lookAheads, currentChar)) then
|
||||||
current = current + 1
|
|
||||||
else
|
|
||||||
-- lookahead-check for all preservable patterns (itemLinks, textures, emotes, ooc, etc.)
|
-- lookahead-check for all preservable patterns (itemLinks, textures, emotes, ooc, etc.)
|
||||||
local textAhead = sub(newText, current)
|
--local textAhead = sub(newText, current)
|
||||||
local posEnd = self:CheckForPreversableText(textAhead, currentChar, previousChar, preserveEmotes)
|
local posEnd = self:CheckForPreversableText(newText, currentChar, previousChar, preserveEmotes)
|
||||||
if (posEnd > 0) then
|
if (posEnd > 0) then
|
||||||
self:DebugPrint("ReplaceText : Found an ignore pattern")
|
self:DebugPrint("ReplaceText : Found an ignore pattern")
|
||||||
|
|
||||||
-- split text and continue after preserved text
|
-- replace all text up until now
|
||||||
local textBefore = sub(newText, lastStart, current - 1)
|
local replacement = self:ReplaceAndConsolidate(replaceText, replacements)
|
||||||
local replacement = self:ReplaceAndConsolidate(textBefore, replacements)
|
local preserved = sub(newText, 1, posEnd)
|
||||||
local preservedText = sub(textAhead, 1, posEnd)
|
|
||||||
|
|
||||||
finalText = finalText .. replacement .. preservedText
|
finalText = finalText .. replacement .. preserved
|
||||||
current = current + posEnd
|
replaceText = ""
|
||||||
lastStart = current
|
newText = sub(newText, posEnd + 1)
|
||||||
self:DebugPrint("ReplaceText : restarting at", lastStart)
|
self:DebugPrint("ReplaceText : remaining text", newText)
|
||||||
else
|
else
|
||||||
-- no corresponding end was found to start pattern, continue loop with next char
|
-- no corresponding end was found to start pattern, continue loop with next char
|
||||||
current = current + 1
|
replaceText = replaceText .. currentChar
|
||||||
|
newText = textAhead
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
replaceText = replaceText .. currentChar
|
||||||
|
newText = textAhead
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- catchup remaining text to the end
|
-- catchup remaining text to the end
|
||||||
local remainingText = sub(newText, lastStart)
|
local replacement = self:ReplaceAndConsolidate(replaceText, replacements)
|
||||||
local replacement = self:ReplaceAndConsolidate(remainingText, replacements)
|
|
||||||
finalText = finalText .. replacement
|
finalText = finalText .. replacement
|
||||||
|
|
||||||
self:DebugPrint("ReplaceText : replaced \"%s\"", text)
|
self:DebugPrint("ReplaceText : replaced \"%s\"", text)
|
||||||
@@ -577,22 +740,24 @@ function Grichelde:IsOneBigEmote(text)
|
|||||||
|
|
||||||
-- emote detection
|
-- emote detection
|
||||||
local isEmote = false
|
local isEmote = false
|
||||||
-- scheme *emote*
|
local firstChar, rest = getNextCharUtf8(firstWord)
|
||||||
if (sub(firstWord, 1, 1) == "<") then
|
|
||||||
|
-- scheme <emote>
|
||||||
|
if (firstChar == "<") then
|
||||||
-- search for emote end
|
-- search for emote end
|
||||||
local _, emoteEnd = find(text, "%>", 2)
|
local _, emoteEnd = find(text, "%>", 2)
|
||||||
isEmote = (emoteEnd == length(text))
|
isEmote = (emoteEnd == lengthUtf8(text))
|
||||||
end
|
|
||||||
if (not isEmote and (sub(firstWord, 1, 1) == "*")) then
|
|
||||||
-- search for emote end
|
|
||||||
local _, emoteEnd = find(text, "%*", 2)
|
|
||||||
isEmote = (emoteEnd == length(text))
|
|
||||||
end
|
end
|
||||||
|
if (not isEmote and (firstChar == "*")) then
|
||||||
|
if (getNextCharUtf8(rest) == "*") then
|
||||||
-- scheme **emote**
|
-- scheme **emote**
|
||||||
if (not isEmote and (sub(firstWord, 1, 2) == "**")) then
|
|
||||||
-- search for emote end
|
|
||||||
local _, emoteEnd = find(text, "%*%*", 3)
|
local _, emoteEnd = find(text, "%*%*", 3)
|
||||||
isEmote = (emoteEnd == length(text))
|
isEmote = (emoteEnd == lengthUtf8(text))
|
||||||
|
else
|
||||||
|
-- scheme *emote*
|
||||||
|
local _, emoteEnd = find(text, "%*", 2)
|
||||||
|
isEmote = (emoteEnd == lengthUtf8(text))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- the whole text is one big emote
|
-- the whole text is one big emote
|
||||||
@@ -644,7 +809,7 @@ function Grichelde:CheckReplacementAllowed(text, channel)
|
|||||||
assert(firstWord ~= nil, "firstWord is never nil")
|
assert(firstWord ~= nil, "firstWord is never nil")
|
||||||
|
|
||||||
-- don't replace slash commands
|
-- don't replace slash commands
|
||||||
if (sub(firstWord, 1, 1) == "/") then
|
if (getNextCharUtf8(firstWord) == "/") then
|
||||||
self:DebugPrint("CheckReplacementAllowed : skip other slash commands:", firstWord)
|
self:DebugPrint("CheckReplacementAllowed : skip other slash commands:", firstWord)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -676,7 +841,7 @@ function Grichelde:CheckAndExtractMessageTypeTarget(message)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- first word should be a chat command
|
-- first word should be a chat command
|
||||||
if (sub(message, 1, 1) == "/") then
|
if (getNextCharUtf8(message) == "/") then
|
||||||
-- extract chat command
|
-- extract chat command
|
||||||
local chatCmd, targetAndText = self:SplitOnFirstMatch(message)
|
local chatCmd, targetAndText = self:SplitOnFirstMatch(message)
|
||||||
assert(chatCmd ~= nil, "chatCmd is never nil")
|
assert(chatCmd ~= nil, "chatCmd is never nil")
|
||||||
|
@@ -5,6 +5,8 @@ local Grichelde = _G.Grichelde or {}
|
|||||||
-- constants and upvalues
|
-- constants and upvalues
|
||||||
Grichelde.LOG_LEVEL = { DEBUG = 1, TRACE = 2 }
|
Grichelde.LOG_LEVEL = { DEBUG = 1, TRACE = 2 }
|
||||||
|
|
||||||
|
Grichelde.INPUT_LIMIT = 255
|
||||||
|
Grichelde.ENDLESS_LOOP_LIMIT = 10000
|
||||||
Grichelde.MAPPING_OFFSET = 10
|
Grichelde.MAPPING_OFFSET = 10
|
||||||
Grichelde.MINIMAP_ENABLED = 1.0
|
Grichelde.MINIMAP_ENABLED = 1.0
|
||||||
Grichelde.MINIMAP_DARKENDED = 0.5
|
Grichelde.MINIMAP_DARKENDED = 0.5
|
||||||
@@ -39,6 +41,8 @@ Grichelde.COLOR_CODES = {
|
|||||||
YELLOW = _G.YELLOW_FONT_COLOR_CODE or "|cffffff00",
|
YELLOW = _G.YELLOW_FONT_COLOR_CODE or "|cffffff00",
|
||||||
LIGHTYELLOW = _G.LIGHTYELLOW_FONT_COLOR_CODE or "|cffffff9a",
|
LIGHTYELLOW = _G.LIGHTYELLOW_FONT_COLOR_CODE or "|cffffff9a",
|
||||||
ORANGE = _G.ORANGE_FONT_COLOR_CODE or "|cffff7f3f",
|
ORANGE = _G.ORANGE_FONT_COLOR_CODE or "|cffff7f3f",
|
||||||
|
BLUE = "|cff0000ff",
|
||||||
|
HYPERLINK = "|cff4040ff",
|
||||||
CLOSE = _G.FONT_COLOR_CODE_CLOSE or "|r",
|
CLOSE = _G.FONT_COLOR_CODE_CLOSE or "|r",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +118,7 @@ Grichelde.BLIZZ_TYPE_TO_OPTIONS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- do not replace these patterns
|
-- do not replace these patterns
|
||||||
|
-- combined item links in the chat will look like this: |cff9d9d9d|Hitem:3299::::::::20:257::::::|h[Fractured Canine]|h|r
|
||||||
Grichelde.IGNORE_PATTERNS = {
|
Grichelde.IGNORE_PATTERNS = {
|
||||||
LINKS = {
|
LINKS = {
|
||||||
"|[Cc]%x%x%x%x%x%x%x%x.-|r", -- colored items (or links)
|
"|[Cc]%x%x%x%x%x%x%x%x.-|r", -- colored items (or links)
|
||||||
@@ -373,6 +378,10 @@ local function cRed(text)
|
|||||||
return Grichelde.F.color(Grichelde.COLOR_CODES.RED, text)
|
return Grichelde.F.color(Grichelde.COLOR_CODES.RED, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function cHyperlink(text)
|
||||||
|
return Grichelde.F.color(Grichelde.COLOR_CODES.HYPERLINK, text)
|
||||||
|
end
|
||||||
|
|
||||||
-- faster function lookups by mapping to local refs
|
-- faster function lookups by mapping to local refs
|
||||||
Grichelde.F = {
|
Grichelde.F = {
|
||||||
IsAddOnLoaded = _G.IsAddOnLoaded,
|
IsAddOnLoaded = _G.IsAddOnLoaded,
|
||||||
@@ -421,6 +430,7 @@ Grichelde.F = {
|
|||||||
cGreen = cGreen,
|
cGreen = cGreen,
|
||||||
cOrange = cOrange,
|
cOrange = cOrange,
|
||||||
cRed = cRed,
|
cRed = cRed,
|
||||||
|
cHyperlink = cHyperlink,
|
||||||
toByte = _G.string.byte,
|
toByte = _G.string.byte,
|
||||||
bytes2Char = _G.string.char,
|
bytes2Char = _G.string.char,
|
||||||
format = _G.string.format,
|
format = _G.string.format,
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
local _G = _G
|
local _G = _G
|
||||||
local Grichelde = _G.Grichelde or {}
|
local Grichelde = _G.Grichelde or {}
|
||||||
|
|
||||||
local pairs, tInsert, tClone, unpack, join, toString
|
local pairs, tInsert, tClone, tWipe, unpack, join, toString
|
||||||
= Grichelde.F.pairs, Grichelde.F.tInsert, Grichelde.F.tClone, Grichelde.F.unpack, Grichelde.F.join, Grichelde.F.toString
|
= Grichelde.F.pairs, Grichelde.F.tInsert, Grichelde.F.tClone, Grichelde.F.tWipe, Grichelde.F.unpack, Grichelde.F.join, Grichelde.F.toString
|
||||||
|
|
||||||
function Grichelde.getDefaultConfig()
|
function Grichelde.getDefaultConfig()
|
||||||
return {
|
return {
|
||||||
@@ -24,7 +24,7 @@ function Grichelde.getDefaultConfig()
|
|||||||
},
|
},
|
||||||
replacements = {
|
replacements = {
|
||||||
["**"] = {
|
["**"] = {
|
||||||
order = 9999,
|
order = 999,
|
||||||
searchText = "",
|
searchText = "",
|
||||||
replaceText = "",
|
replaceText = "",
|
||||||
exactCase = false,
|
exactCase = false,
|
||||||
@@ -32,22 +32,39 @@ function Grichelde.getDefaultConfig()
|
|||||||
matchWhen = 2,
|
matchWhen = 2,
|
||||||
stopOnMatch = false,
|
stopOnMatch = false,
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Grichelde.getDefaultSampleMappings()
|
||||||
|
return {
|
||||||
replacement_10 = {
|
replacement_10 = {
|
||||||
order = 10,
|
order = 10,
|
||||||
searchText = "s",
|
searchText = "s",
|
||||||
replaceText = "ch",
|
replaceText = "ch",
|
||||||
|
exactCase = false,
|
||||||
|
consolidate = true,
|
||||||
|
matchWhen = 2,
|
||||||
|
stopOnMatch = false,
|
||||||
},
|
},
|
||||||
replacement_11 = {
|
replacement_11 = {
|
||||||
order = 11,
|
order = 11,
|
||||||
searchText = "t",
|
searchText = "t",
|
||||||
replaceText = "ck",
|
replaceText = "ck",
|
||||||
|
exactCase = false,
|
||||||
|
consolidate = true,
|
||||||
|
matchWhen = 2,
|
||||||
|
stopOnMatch = false,
|
||||||
},
|
},
|
||||||
replacement_12 = {
|
replacement_12 = {
|
||||||
order = 12,
|
order = 12,
|
||||||
searchText = "p",
|
searchText = "p",
|
||||||
replaceText = "b",
|
replaceText = "b",
|
||||||
},
|
exactCase = false,
|
||||||
}
|
consolidate = true,
|
||||||
|
matchWhen = 2,
|
||||||
|
stopOnMatch = false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -55,11 +72,12 @@ end
|
|||||||
function Grichelde:LoadDatabase()
|
function Grichelde:LoadDatabase()
|
||||||
local db = LibStub("AceDB-3.0"):New(self.name .."DB", self.getDefaultConfig(), true)
|
local db = LibStub("AceDB-3.0"):New(self.name .."DB", self.getDefaultConfig(), true)
|
||||||
|
|
||||||
db.RegisterCallback(self, "OnNewProfile", "RefreshOptions")
|
db.RegisterCallback(self, "OnNewProfile", "RefreshProfiles")
|
||||||
db.RegisterCallback(self, "OnProfileChanged", "RefreshOptions")
|
db.RegisterCallback(self, "OnProfileChanged", "RefreshProfiles")
|
||||||
db.RegisterCallback(self, "OnProfileDeleted", "RefreshOptions")
|
db.RegisterCallback(self, "OnProfileDeleted", "RefreshProfiles")
|
||||||
db.RegisterCallback(self, "OnProfileCopied", "RefreshOptions")
|
db.RegisterCallback(self, "OnProfileCopied", "RefreshProfiles")
|
||||||
db.RegisterCallback(self, "OnProfileReset", "RefreshOptions")
|
db.RegisterCallback(self, "OnProfileReset", "RefreshProfiles")
|
||||||
|
db.RegisterCallback(self, "OnProfileShutdown", "RefreshProfiles")
|
||||||
|
|
||||||
return db
|
return db
|
||||||
end
|
end
|
||||||
@@ -104,15 +122,15 @@ end
|
|||||||
|
|
||||||
--- Sorts a replacements table by order sub-field and rename.
|
--- Sorts a replacements table by order sub-field and rename.
|
||||||
--- Do NOT reassign self.db.profile.replacements here or with its output as it will break defaults
|
--- Do NOT reassign self.db.profile.replacements here or with its output as it will break defaults
|
||||||
function Grichelde:ReorderReplacements()
|
function Grichelde:ReorderReplacements(replacements)
|
||||||
local replacements = self.db.profile.replacements or {}
|
local repls = replacements or self.db.profile.replacements or {}
|
||||||
|
|
||||||
self:TracePrint("ReorderReplacements : unsorted table")
|
self:TracePrint("ReorderReplacements : unsorted table")
|
||||||
self:TracePrint(replacements)
|
self:TracePrint(repls)
|
||||||
|
|
||||||
local orderToName = {}
|
local orderToName = {}
|
||||||
local size = 0
|
local size = 0
|
||||||
for replName, replTable in pairs(replacements) do
|
for replName, replTable in pairs(repls) do
|
||||||
size = size + 1
|
size = size + 1
|
||||||
tInsert(orderToName, replTable.order, replName)
|
tInsert(orderToName, replTable.order, replName)
|
||||||
end
|
end
|
||||||
@@ -125,31 +143,19 @@ function Grichelde:ReorderReplacements()
|
|||||||
|
|
||||||
while count < size do
|
while count < size do
|
||||||
local replName = orderToName[index]
|
local replName = orderToName[index]
|
||||||
if (replName ~= nil) and (replacements[replName] ~= nil) then
|
if (replName ~= nil) and (repls[replName] ~= nil) then
|
||||||
self:TracePrint("ReorderReplacements : replName: %s, replTable", replName)
|
self:TracePrint("ReorderReplacements : replName: %s, replTable", replName)
|
||||||
self:TracePrint(replacements[replName])
|
self:TracePrint(repls[replName])
|
||||||
local order = Grichelde.MAPPING_OFFSET + count
|
local order = Grichelde.MAPPING_OFFSET + count
|
||||||
sorted["replacement_" .. order] = tClone(replacements[replName])
|
sorted["replacement_" .. order] = tClone(repls[replName])
|
||||||
sorted["replacement_" .. order].order = order
|
sorted["replacement_" .. order].order = order
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if ( index > 10000) then break end
|
if (index > 999) then break end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- self:TracePrint("ReorderReplacements : sorted")
|
-- self:TracePrint("ReorderReplacements : sorted")
|
||||||
-- self:TracePrint(sorted)
|
-- self:TracePrint(sorted)
|
||||||
|
return sorted
|
||||||
-- do NOT set self.db.profile.replacements = {} it will break defaults
|
|
||||||
for replName, _ in pairs(replacements) do
|
|
||||||
replacements[replName] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- copy over sorted replacements
|
|
||||||
for replName, replTable in pairs(sorted) do
|
|
||||||
replacements[replName] = replTable
|
|
||||||
end
|
|
||||||
|
|
||||||
self:DebugPrint("ReorderReplacements : sorted table")
|
|
||||||
self:DebugPrint(self.db.profile.replacements)
|
|
||||||
end
|
end
|
||||||
|
@@ -2,6 +2,10 @@
|
|||||||
local _G = _G
|
local _G = _G
|
||||||
local Grichelde = _G.Grichelde or {}
|
local Grichelde = _G.Grichelde or {}
|
||||||
|
|
||||||
|
local cPrefix, cGreen, cRed
|
||||||
|
= Grichelde.F.cPrefix, Grichelde.F.cGreen, Grichelde.F.cRed
|
||||||
|
|
||||||
|
|
||||||
--- add Minimap button
|
--- add Minimap button
|
||||||
function Grichelde:MinimapButton()
|
function Grichelde:MinimapButton()
|
||||||
local function clickHandler(_, button)
|
local function clickHandler(_, button)
|
||||||
@@ -84,41 +88,59 @@ end
|
|||||||
|
|
||||||
function Grichelde:ToggleActivation()
|
function Grichelde:ToggleActivation()
|
||||||
if (self.db.profile.enabled == true) then
|
if (self.db.profile.enabled == true) then
|
||||||
|
if (self.dialog == nil) or (self.dialog.OpenFrames[self.name] == nil) then
|
||||||
|
self:PrefixedPrint(self.L.Profiles_Deactivated, cRed(self.db:GetCurrentProfile()))
|
||||||
|
end
|
||||||
self:Deactivate()
|
self:Deactivate()
|
||||||
else
|
else
|
||||||
|
if (self.dialog == nil) or (self.dialog.OpenFrames[self.name] == nil) then
|
||||||
|
self:PrefixedPrint(self.L.Profiles_Activated, cGreen(self.db:GetCurrentProfile()))
|
||||||
|
end
|
||||||
self:Activate()
|
self:Activate()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Grichelde:RefreshMinimap()
|
||||||
|
if (self.db.profile.enabled == true) then
|
||||||
|
self:Activate()
|
||||||
|
else
|
||||||
|
self:Deactivate()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Grichelde:Activate()
|
function Grichelde:Activate()
|
||||||
self.db.profile.enabled = true
|
self.db.profile.enabled = true
|
||||||
|
|
||||||
-- refresh option UI if open at the moment
|
-- refresh option UI if open at the moment
|
||||||
if (self.dialog ~= nil) and (self.dialog.OpenFrames[self.name] ~= nil) then
|
if (self.dialog ~= nil) and (self.dialog.OpenFrames[self.name] ~= nil) then
|
||||||
self.dialog:SelectGroup(self.name, "enabled")
|
self.dialog:SelectGroup(self.name)
|
||||||
local namePlusVersion = self:Format(self.L.AddonNamePlusVersion, self.L.AddonName, self.version)
|
local namePlusVersion = self:Format(self.L.AddonNamePlusVersion, self.L.AddonName, self.version)
|
||||||
local statusText = self:Format(self.L.AddonLoaded, namePlusVersion)
|
local statusText = self:Format(self.L.AddonLoaded, namePlusVersion)
|
||||||
self.dialog.OpenFrames[self.name]:SetStatusText(statusText)
|
self.dialog.OpenFrames[self.name]:SetStatusText(statusText)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (self.ldb ~= nil) then
|
||||||
self.ldb.iconR = Grichelde.MINIMAP_ENABLED
|
self.ldb.iconR = Grichelde.MINIMAP_ENABLED
|
||||||
self.ldb.iconG = Grichelde.MINIMAP_ENABLED
|
self.ldb.iconG = Grichelde.MINIMAP_ENABLED
|
||||||
self.ldb.iconB = Grichelde.MINIMAP_ENABLED
|
self.ldb.iconB = Grichelde.MINIMAP_ENABLED
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Grichelde:Deactivate()
|
function Grichelde:Deactivate()
|
||||||
self.db.profile.enabled = false
|
self.db.profile.enabled = false
|
||||||
|
|
||||||
-- refresh option UI if open at the moment
|
-- refresh option UI if open at the moment
|
||||||
if (self.dialog ~= nil) and (self.dialog.OpenFrames[self.name] ~= nil) then
|
if (self.dialog ~= nil) and (self.dialog.OpenFrames[self.name] ~= nil) then
|
||||||
self.dialog:SelectGroup(self.name, "enabled")
|
self.dialog:SelectGroup(self.name)
|
||||||
local namePlusVersion = self:Format(self.L.AddonNamePlusVersion, self.L.AddonName, self.version)
|
local namePlusVersion = self:Format(self.L.AddonNamePlusVersion, self.L.AddonName, self.version)
|
||||||
local statusText = self:Format(self.L.AddonUnloaded, namePlusVersion)
|
local statusText = self:Format(self.L.AddonUnloaded, namePlusVersion)
|
||||||
self.dialog.OpenFrames[self.name]:SetStatusText(statusText)
|
self.dialog.OpenFrames[self.name]:SetStatusText(statusText)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (self.ldb ~= nil) then
|
||||||
self.ldb.iconR = Grichelde.MINIMAP_DARKENDED
|
self.ldb.iconR = Grichelde.MINIMAP_DARKENDED
|
||||||
self.ldb.iconG = Grichelde.MINIMAP_DARKENDED
|
self.ldb.iconG = Grichelde.MINIMAP_DARKENDED
|
||||||
self.ldb.iconB = Grichelde.MINIMAP_DARKENDED
|
self.ldb.iconB = Grichelde.MINIMAP_DARKENDED
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@@ -164,9 +164,23 @@ function Grichelde:CreateOptionsUI()
|
|||||||
desc = self.L.Options_Help_Group_Desc,
|
desc = self.L.Options_Help_Group_Desc,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
args = {
|
args = {
|
||||||
basics = {
|
info = {
|
||||||
order = 10,
|
order = 10,
|
||||||
type = "group",
|
type = "group",
|
||||||
|
name = self.L.Options_Help_Tab_Info_Name,
|
||||||
|
desc = self.L.Options_Help_Tab_Info_Desc,
|
||||||
|
args = {
|
||||||
|
paragraph1 = {
|
||||||
|
order = 1,
|
||||||
|
type = "description",
|
||||||
|
name = self:Format(self.L.Options_Help_Info, self.L.AddonName),
|
||||||
|
fontSize = "medium",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
basics = {
|
||||||
|
order = 11,
|
||||||
|
type = "group",
|
||||||
name = self.L.Options_Help_Tab_Basics_Name,
|
name = self.L.Options_Help_Tab_Basics_Name,
|
||||||
desc = self.L.Options_Help_Tab_Basics_Desc,
|
desc = self.L.Options_Help_Tab_Basics_Desc,
|
||||||
args = {
|
args = {
|
||||||
@@ -179,7 +193,7 @@ function Grichelde:CreateOptionsUI()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expert = {
|
expert = {
|
||||||
order = 11,
|
order = 12,
|
||||||
type = "group",
|
type = "group",
|
||||||
name = self.L.Options_Help_Tab_Expert_Name,
|
name = self.L.Options_Help_Tab_Expert_Name,
|
||||||
desc = self.L.Options_Help_Tab_Expert_Desc,
|
desc = self.L.Options_Help_Tab_Expert_Desc,
|
||||||
@@ -193,7 +207,7 @@ function Grichelde:CreateOptionsUI()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
examples = {
|
examples = {
|
||||||
order = 12,
|
order = 13,
|
||||||
type = "group",
|
type = "group",
|
||||||
name = self.L.Options_Help_Tab_Examples_Name,
|
name = self.L.Options_Help_Tab_Examples_Name,
|
||||||
desc = self.L.Options_Help_Tab_Examples_Desc,
|
desc = self.L.Options_Help_Tab_Examples_Desc,
|
||||||
@@ -257,7 +271,7 @@ function Grichelde:CreateOptionsUI()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
disclaimer = {
|
disclaimer = {
|
||||||
order = 20,
|
order = 14,
|
||||||
type = "description",
|
type = "description",
|
||||||
name = self.L.Options_Help_Disclaimer,
|
name = self.L.Options_Help_Disclaimer,
|
||||||
},
|
},
|
||||||
@@ -406,24 +420,48 @@ function Grichelde:SetupOptions()
|
|||||||
return options, dialog
|
return options, dialog
|
||||||
end
|
end
|
||||||
|
|
||||||
function Grichelde:RefreshOptions(event, _, profileName)
|
function Grichelde:RefreshProfiles(event, _, profileName)
|
||||||
self:DebugPrint("RefreshOptions : event:", event)
|
local function replaceReplacements(replacements)
|
||||||
|
-- do NOT set self.db.profile.replacements = {} it will break defaults
|
||||||
|
tWipe(self.db.profile.replacements)
|
||||||
|
|
||||||
|
-- copy over sorted replacements
|
||||||
|
for replName, replTable in pairs(replacements) do
|
||||||
|
self.db.profile.replacements[replName] = replTable
|
||||||
|
end
|
||||||
|
|
||||||
|
self:DebugPrint("RefreshProfiles : reorderReplacements : sorted table")
|
||||||
|
self:DebugPrint(self.db.profile.replacements)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function addEmptyMappingWithoutRefresh()
|
||||||
|
self:DebugPrint("RefreshProfiles : addEmptyMappingWithoutRefresh")
|
||||||
|
self.db.profile.replacements.replacement_10.order = 10
|
||||||
|
end
|
||||||
|
|
||||||
|
self:DebugPrint("RefreshProfiles : event:", event)
|
||||||
|
--- AceDB will call OnProfileShutdown, OnProfileChanged and OnNewProfile in this order
|
||||||
if (event == "OnNewProfile") then
|
if (event == "OnNewProfile") then
|
||||||
|
addEmptyMappingWithoutRefresh()
|
||||||
self:PrefixedPrint(self.L.Profiles_Created, cGreen(self.db:GetCurrentProfile()))
|
self:PrefixedPrint(self.L.Profiles_Created, cGreen(self.db:GetCurrentProfile()))
|
||||||
elseif (event == "OnProfileChanged") then
|
elseif (event == "OnProfileChanged") then
|
||||||
self:PrefixedPrint(self.L.Profiles_Loaded, cGreen(self.db:GetCurrentProfile()))
|
self:DebugPrint(self.L.Profiles_Loaded, cGreen(self.db:GetCurrentProfile()))
|
||||||
elseif (event == "OnProfileDeleted") then
|
elseif (event == "OnProfileDeleted") then
|
||||||
self:PrefixedPrint(self.L.Profiles_Deleted, cRed(profileName))
|
self:PrefixedPrint(self.L.Profiles_Deleted, cRed(profileName))
|
||||||
elseif (event == "OnProfileCopied") then
|
elseif (event == "OnProfileCopied") then
|
||||||
self:PrefixedPrint(self.L.Profiles_Copied, cOrange(profileName))
|
self:DebugPrint(self.L.Profiles_Copied, cOrange(profileName))
|
||||||
elseif (event == "OnProfileReset") then
|
elseif (event == "OnProfileReset") then
|
||||||
|
addEmptyMappingWithoutRefresh()
|
||||||
self:PrefixedPrint(self.L.Profiles_Reset, cOrange(self.db:GetCurrentProfile()))
|
self:PrefixedPrint(self.L.Profiles_Reset, cOrange(self.db:GetCurrentProfile()))
|
||||||
else
|
else
|
||||||
self:DebugPrint("Refreshing Profile %s on options change: %s", self.db:GetCurrentProfile(), event)
|
self:DebugPrint("Refreshing Profile %s on options change: %s", self.db:GetCurrentProfile(), event)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:ReorderReplacements()
|
local repls = self:ReorderReplacements()
|
||||||
self:RefreshReplacements(self.db.profile.replacements)
|
replaceReplacements(repls)
|
||||||
|
self:RefreshOptions(repls)
|
||||||
|
self:RefreshDialog()
|
||||||
|
self:RefreshMinimap()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Grichelde:ToggleOptions()
|
function Grichelde:ToggleOptions()
|
||||||
@@ -556,19 +594,17 @@ function Grichelde:ImportExample(num)
|
|||||||
self.db:SetProfile(profileName)
|
self.db:SetProfile(profileName)
|
||||||
assert(self.db:GetCurrentProfile() == profileName, "profile was not loaded")
|
assert(self.db:GetCurrentProfile() == profileName, "profile was not loaded")
|
||||||
|
|
||||||
local exampleProfile = self.db.profile
|
tWipe(self.db.profile.replacements)
|
||||||
tWipe(exampleProfile.replacements)
|
|
||||||
|
|
||||||
for replName, replTable in spairs(self.L.Options_Help_Examples[num].replacements) do
|
for replName, replTable in spairs(self.L.Options_Help_Examples[num].replacements) do
|
||||||
self:TracePrint("ImportExample : replacement: %s", replName)
|
self:TracePrint("ImportExample : replacement: %s", replName)
|
||||||
self:TracePrint(replTable)
|
self:TracePrint(replTable)
|
||||||
|
|
||||||
if (replName ~= nil) and (replTable ~= nil) and (replTable.searchText ~= nil) then
|
if (replName ~= nil) and (replTable ~= nil) and (replTable.searchText ~= nil) then
|
||||||
exampleProfile.replacements[replName] = tClone(replTable)
|
self.db.profile.replacements[replName] = tClone(replTable)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:RefreshReplacements(self.db.profile.replacements)
|
self:RefreshProfiles("ImportExample" .. num)
|
||||||
else
|
else
|
||||||
self:ErrorPrint(self.L.Profiles_AlreadyExistsError, profileName)
|
self:ErrorPrint(self.L.Profiles_AlreadyExistsError, profileName)
|
||||||
end
|
end
|
||||||
@@ -577,8 +613,8 @@ end
|
|||||||
--- Create UI options for the given replacement table (from DB).
|
--- Create UI options for the given replacement table (from DB).
|
||||||
--- Usually called with with self.db.profile.replacements
|
--- Usually called with with self.db.profile.replacements
|
||||||
-- @param replacementsTable
|
-- @param replacementsTable
|
||||||
function Grichelde:RefreshReplacements(replacementsTable)
|
function Grichelde:RefreshOptions(replacementsTable)
|
||||||
self:TracePrint("RefreshReplacements : DB table:")
|
self:TracePrint("RefreshOptions : DB table:")
|
||||||
self:TracePrint(replacementsTable)
|
self:TracePrint(replacementsTable)
|
||||||
|
|
||||||
-- remove all previous replacements from options (not DB), except header and buttons
|
-- remove all previous replacements from options (not DB), except header and buttons
|
||||||
@@ -594,9 +630,11 @@ function Grichelde:RefreshReplacements(replacementsTable)
|
|||||||
replacements[replName] = self:CreateMapping(toNumber(replNumber))
|
replacements[replName] = self:CreateMapping(toNumber(replNumber))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- self:TracePrint("RefreshReplacements : UI options:")
|
-- self:TracePrint("RefreshOptions : UI options:")
|
||||||
-- self:TracePrint(replacements)
|
-- self:TracePrint(replacements)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Grichelde:RefreshDialog()
|
||||||
self.dialog:ConfigTableChanged(nil, self.name)
|
self.dialog:ConfigTableChanged(nil, self.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -606,7 +644,7 @@ function Grichelde:AddEmptyMapping()
|
|||||||
self:DebugPrint("AddEmptyMapping : old DB entries:")
|
self:DebugPrint("AddEmptyMapping : old DB entries:")
|
||||||
self:DebugPrint(replacements)
|
self:DebugPrint(replacements)
|
||||||
|
|
||||||
local maxRepl = Grichelde.MAPPING_OFFSET
|
local maxRepl = Grichelde.MAPPING_OFFSET - 1
|
||||||
for replName, _ in pairs(replacements) do
|
for replName, _ in pairs(replacements) do
|
||||||
local num = match(replName, "^replacement_(%d+)")
|
local num = match(replName, "^replacement_(%d+)")
|
||||||
if (num ~= nil) and (maxRepl < toNumber(num)) then
|
if (num ~= nil) and (maxRepl < toNumber(num)) then
|
||||||
@@ -622,7 +660,7 @@ function Grichelde:AddEmptyMapping()
|
|||||||
self:DebugPrint("AddEmptyMapping : new DB entries:")
|
self:DebugPrint("AddEmptyMapping : new DB entries:")
|
||||||
self:DebugPrint(replacements)
|
self:DebugPrint(replacements)
|
||||||
|
|
||||||
self:RefreshOptions("AddEmptyMapping " .. newMapping)
|
self:RefreshProfiles("AddEmptyMapping " .. newMapping)
|
||||||
self.dialog:SelectGroup(self.name, "replacements", newMapping)
|
self.dialog:SelectGroup(self.name, "replacements", newMapping)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -651,7 +689,7 @@ function Grichelde:MoveUp(info)
|
|||||||
replacements[swapName].order = currentOrder
|
replacements[swapName].order = currentOrder
|
||||||
replacements[currentName].order = currentOrder - 1
|
replacements[currentName].order = currentOrder - 1
|
||||||
|
|
||||||
self:RefreshOptions("MoveUp " .. currentName)
|
self:RefreshProfiles("MoveUp " .. currentName)
|
||||||
|
|
||||||
self:DebugPrint("MoveUp : refresh focus on %s", swapName)
|
self:DebugPrint("MoveUp : refresh focus on %s", swapName)
|
||||||
self.dialog:SelectGroup(self.name, "replacements", swapName)
|
self.dialog:SelectGroup(self.name, "replacements", swapName)
|
||||||
@@ -694,7 +732,7 @@ function Grichelde:MoveDown(info)
|
|||||||
replacements[swapName].order = currentOrder
|
replacements[swapName].order = currentOrder
|
||||||
replacements[currentName].order = currentOrder + 1
|
replacements[currentName].order = currentOrder + 1
|
||||||
|
|
||||||
self:RefreshOptions("MoveDown " .. currentName)
|
self:RefreshProfiles("MoveDown " .. currentName)
|
||||||
|
|
||||||
self:DebugPrint("MoveDown : refresh focus on %s", swapName)
|
self:DebugPrint("MoveDown : refresh focus on %s", swapName)
|
||||||
self.dialog:SelectGroup(self.name, "replacements", swapName)
|
self.dialog:SelectGroup(self.name, "replacements", swapName)
|
||||||
@@ -774,7 +812,7 @@ function Grichelde:DeleteMapping(info)
|
|||||||
self:DebugPrint("delete option: %s", currentName)
|
self:DebugPrint("delete option: %s", currentName)
|
||||||
self.db.profile.replacements[currentName] = nil
|
self.db.profile.replacements[currentName] = nil
|
||||||
|
|
||||||
self:RefreshOptions("DeleteMapping " .. currentName)
|
self:RefreshProfiles("DeleteMapping " .. currentName)
|
||||||
|
|
||||||
local _, replNumber = self:SplitOnFirstMatch(currentName, "_")
|
local _, replNumber = self:SplitOnFirstMatch(currentName, "_")
|
||||||
local newMapping = "replacement_" .. toNumber(replNumber - 1)
|
local newMapping = "replacement_" .. toNumber(replNumber - 1)
|
||||||
@@ -788,5 +826,5 @@ function Grichelde:DeleteAllMappings()
|
|||||||
tWipe(self.db.profile.replacements)
|
tWipe(self.db.profile.replacements)
|
||||||
self:AddEmptyMapping()
|
self:AddEmptyMapping()
|
||||||
|
|
||||||
self:RefreshOptions("DeleteAllMappings")
|
self:RefreshProfiles("DeleteAllMappings")
|
||||||
end
|
end
|
||||||
|
@@ -18,10 +18,10 @@ function Grichelde:TestMatch(text, pattern)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Grichelde:RunTests()
|
function Grichelde:RunTests()
|
||||||
local function test(name, replacements, testData)
|
local function test(name, replacements, testData, replaceEmotes)
|
||||||
local i, ok, size = 0, 0, tSize(testData)
|
local i, ok, size = 0, 0, tSize(testData)
|
||||||
for input, expected in pairs(testData) do
|
for input, expected in pairs(testData) do
|
||||||
local actual = self:ReplaceText(input, replacements, false)
|
local actual = self:ReplaceText(input, replacements, replaceEmotes or false)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if (actual == expected) then
|
if (actual == expected) then
|
||||||
ok = ok + 1
|
ok = ok + 1
|
||||||
@@ -172,7 +172,7 @@ function Grichelde:RunTests()
|
|||||||
["abcdz"] = "aefgz",
|
["abcdz"] = "aefgz",
|
||||||
["abcd"] = "aefg",
|
["abcd"] = "aefg",
|
||||||
["bcdz"] = "efgz",
|
["bcdz"] = "efgz",
|
||||||
-- replacement_10
|
-- replacement_11
|
||||||
["uio"] = "bnm",
|
["uio"] = "bnm",
|
||||||
["auioz"] = "auioz",
|
["auioz"] = "auioz",
|
||||||
["auio"] = "auio",
|
["auio"] = "auio",
|
||||||
@@ -197,6 +197,19 @@ function Grichelde:RunTests()
|
|||||||
["awerz"] = "asdfz",
|
["awerz"] = "asdfz",
|
||||||
["awer"] = "awer",
|
["awer"] = "awer",
|
||||||
["werz"] = "werz",
|
["werz"] = "werz",
|
||||||
|
|
||||||
|
-- replacement_10
|
||||||
|
["bcd abcdz abcd bcdz"] = "efg aefgz aefg efgz",
|
||||||
|
-- replacement_11
|
||||||
|
["uio auioz auio uioz"] = "bnm auioz auio uioz",
|
||||||
|
-- replacement_12
|
||||||
|
["hij ahijz ahij hijz"] = "klm ahijz ahij klmz",
|
||||||
|
-- replacement_13
|
||||||
|
["nop anopz anop nopz"] = "qrs anopz aqrs nopz",
|
||||||
|
-- replacement_14
|
||||||
|
["tuv atuvz atuv tuvz"] = "wxy atuvz awxy wxyz",
|
||||||
|
-- replacement_15
|
||||||
|
["wer awerz awer werz"] = "wer asdfz awer werz",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ok = ok + o
|
ok = ok + o
|
||||||
@@ -411,21 +424,31 @@ function Grichelde:RunTests()
|
|||||||
all = all + a
|
all = all + a
|
||||||
|
|
||||||
o, a = test(
|
o, a = test(
|
||||||
"Stottern",
|
"Stottern 1",
|
||||||
{
|
{
|
||||||
replacement_10 = {
|
replacement_10 = {
|
||||||
order = 10,
|
order = 10,
|
||||||
searchText = "^([^aeiouy]*)([aeiouy])",
|
searchText = "^([^aeiouy]-)([aeiouy])",
|
||||||
replaceText = "%1%2-%1%2-%1%2",
|
replaceText = "%1%2-%1%2-%1%2",
|
||||||
exactCase = false,
|
exactCase = false,
|
||||||
consolidate = true,
|
consolidate = true,
|
||||||
matchWhen = 4,
|
matchWhen = 4,
|
||||||
stopOnMatch = false,
|
stopOnMatch = false,
|
||||||
},
|
},
|
||||||
|
replacement_11 = {
|
||||||
|
order = 11,
|
||||||
|
searchText = "([^bwp%s]-)([bwp])",
|
||||||
|
replaceText = "%1%2-%1%2-%1%2",
|
||||||
|
exactCase = false,
|
||||||
|
consolidate = true,
|
||||||
|
matchWhen = 2,
|
||||||
|
stopOnMatch = false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
["Ich mag dich."] = "I-I-Ich mag dich.",
|
["Ich mag dich."] = "I-I-Ich mag dich.",
|
||||||
["Dich mag ich."] = "Di-Di-Dich mag ich.",
|
["Dich mag ich."] = "Di-Di-Dich mag ich.",
|
||||||
|
["Bmm rrpss w"] = "B-B-Bmm rrp-rrp-rrpss w-w-w",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ok = ok + o
|
ok = ok + o
|
||||||
@@ -695,7 +718,7 @@ function Grichelde:RunTests()
|
|||||||
replacement_13 = {
|
replacement_13 = {
|
||||||
order = 13,
|
order = 13,
|
||||||
searchText = "youe",
|
searchText = "youe",
|
||||||
replaceText = "tho",
|
replaceText = "thou",
|
||||||
exactCase = false,
|
exactCase = false,
|
||||||
consolidate = true,
|
consolidate = true,
|
||||||
matchWhen = 3,
|
matchWhen = 3,
|
||||||
@@ -709,6 +732,49 @@ function Grichelde:RunTests()
|
|||||||
ok = ok + o
|
ok = ok + o
|
||||||
all = all + a
|
all = all + a
|
||||||
|
|
||||||
|
o, a = test(
|
||||||
|
"emote detection on",
|
||||||
|
{
|
||||||
|
replacement_10 = {
|
||||||
|
order = 10,
|
||||||
|
searchText = "r",
|
||||||
|
replaceText = "rr",
|
||||||
|
exactCase = false,
|
||||||
|
consolidate = false,
|
||||||
|
matchWhen = 2,
|
||||||
|
stopOnMatch = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
["Der Herr Richter *schaut Herrn Richter an*"] = "Derr Herrrr Rrichterr *schaut Herrn Richter an*",
|
||||||
|
["*schaut Herrn Richter an*"] = "*schaut Herrn Richter an*",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ok = ok + o
|
||||||
|
all = all + a
|
||||||
|
|
||||||
|
o, a = test(
|
||||||
|
"emote detection ignored",
|
||||||
|
{
|
||||||
|
replacement_10 = {
|
||||||
|
order = 10,
|
||||||
|
searchText = "r",
|
||||||
|
replaceText = "rr",
|
||||||
|
exactCase = false,
|
||||||
|
consolidate = false,
|
||||||
|
matchWhen = 2,
|
||||||
|
stopOnMatch = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
["Der Herr Richter *schaut Herrn Richter an*"] = "Derr Herrrr Rrichterr *schaut Herrrrn Rrichterr an*",
|
||||||
|
["*schaut Herrn Richter an*"] = "*schaut Herrrrn Rrichterr an*",
|
||||||
|
},
|
||||||
|
true
|
||||||
|
)
|
||||||
|
ok = ok + o
|
||||||
|
all = all + a
|
||||||
|
|
||||||
if (ok == all) then
|
if (ok == all) then
|
||||||
self:PrefixedPrint("All %d tests %s", all, cGreen("passed"))
|
self:PrefixedPrint("All %d tests %s", all, cGreen("passed"))
|
||||||
else
|
else
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
local _G = _G
|
local _G = _G
|
||||||
local Grichelde = _G.Grichelde or {}
|
local Grichelde = _G.Grichelde or {}
|
||||||
|
|
||||||
local pairs, find, cGreen, cOrange, cRed, toNumber
|
local pairs, tSize, tClone, find, sub, cGreen, cOrange, cRed, toNumber
|
||||||
= Grichelde.F.pairs, Grichelde.F.find, Grichelde.F.cGreen, Grichelde.F.cOrange, Grichelde.F.cRed, Grichelde.F.toNumber
|
= Grichelde.F.pairs, Grichelde.F.tSize,Grichelde.F.tClone, Grichelde.F.find, Grichelde.F.sub, Grichelde.F.cGreen, Grichelde.F.cOrange, Grichelde.F.cRed, Grichelde.F.toNumber
|
||||||
|
|
||||||
function Grichelde:Upgrade_To_v060()
|
function Grichelde:Upgrade_To_v060()
|
||||||
self:PrefixedPrint(self.L.Upgrade_ToVersion, cOrange("0.6.0"))
|
self:PrefixedPrint(self.L.Upgrade_ToVersion, cOrange("0.6.0"))
|
||||||
@@ -90,12 +90,40 @@ function Grichelde:Upgrade_To_v090()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Grichelde:UpgradeDatabase()
|
function Grichelde:UpgradeDatabase()
|
||||||
local dbVersion = self.db.global.version or "0.0.0"
|
local function parseVersion(version)
|
||||||
self:DebugPrint("Database version:", dbVersion)
|
local _, _, major, minor, patch, ext = find(version, "(%d+)%.(%d+)%.(%d+)(.*)")
|
||||||
|
local preBuild, build = ext, ""
|
||||||
|
if (sub(ext, 1, 1) == "-") then
|
||||||
|
local b = find(ext, "+", 2)
|
||||||
|
if (b ~= nil) then
|
||||||
|
preBuild = sub(ext, 1, b)
|
||||||
|
build = sub(ext, b + 1)
|
||||||
|
else
|
||||||
|
preBuild = sub(ext, 1, b)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return toNumber(major) or 0, toNumber(minor) or 0, toNumber(patch) or 0, preBuild, build
|
||||||
|
end
|
||||||
|
|
||||||
local dbMajor, dbMinor, dbPatch = self:ParseVersion(dbVersion)
|
local gMajor, gMinor, gPatch = parseVersion(self.version)
|
||||||
local gMajor, gMinor, gPatch = self:ParseVersion(self.version)
|
local dbVersion = self.db.global.version
|
||||||
|
|
||||||
|
if (dbVersion == nil) then
|
||||||
|
self:DebugPrint("New installation detected, add sample mappings")
|
||||||
|
-- do NOT set self.db.profile.replacements = {} it will break defaults
|
||||||
|
local sampleRepl = self.getDefaultSampleMappings()
|
||||||
|
for replName, replTable in pairs(sampleRepl) do
|
||||||
|
self:TracePrint("UpgradeDatabase : copySampleMappings %s", replName)
|
||||||
|
self.db.profile.replacements[replName] = tClone(replTable)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.db.global.version = self:Format("%d.%d.%d", gMajor, gMinor, gPatch)
|
||||||
|
self:DebugPrint("Database version %s sucessfully created", self.db.global.version)
|
||||||
|
else
|
||||||
|
-- detect if upgrade is neccessary or downgrade was done
|
||||||
|
self:DebugPrint("Detected database version:", dbVersion)
|
||||||
|
|
||||||
|
local dbMajor, dbMinor, dbPatch = parseVersion(dbVersion)
|
||||||
local downGrade = false
|
local downGrade = false
|
||||||
if (dbMajor > gMajor) then
|
if (dbMajor > gMajor) then
|
||||||
downGrade = true
|
downGrade = true
|
||||||
@@ -146,7 +174,7 @@ function Grichelde:UpgradeDatabase()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if (upgrade == 0) then
|
if (upgrade == 0) then
|
||||||
self:DebugPrint("Database up-to-date")
|
self:DebugPrint("Database was up-to-date")
|
||||||
elseif (error == false) then
|
elseif (error == false) then
|
||||||
self:PrefixedPrint(cGreen(self.L.Upgrade_Successful))
|
self:PrefixedPrint(cGreen(self.L.Upgrade_Successful))
|
||||||
else
|
else
|
||||||
@@ -154,3 +182,4 @@ function Grichelde:UpgradeDatabase()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
@@ -2,23 +2,8 @@
|
|||||||
local _G = _G
|
local _G = _G
|
||||||
local Grichelde = _G.Grichelde or {}
|
local Grichelde = _G.Grichelde or {}
|
||||||
|
|
||||||
local type, print, pairs, tSize, select, unpack, find, sub, gsub, cGray, cDarkgray, cRed, cPrefix, format, rep, toString, toNumber
|
local type, print, pairs, tSize, select, unpack, find, cGray, cDarkgray, cRed, cPrefix, format, rep, toString
|
||||||
= Grichelde.F.type, Grichelde.F.print, Grichelde.F.pairs, Grichelde.F.tSize, Grichelde.F.select, Grichelde.F.unpack, Grichelde.F.find, Grichelde.F.sub, Grichelde.F.gsub, Grichelde.F.cGray, Grichelde.F.cDarkgray, Grichelde.F.cRed, Grichelde.F.cPrefix, Grichelde.F.format, Grichelde.F.rep, Grichelde.F.toString, Grichelde.F.toNumber
|
= Grichelde.F.type, Grichelde.F.print, Grichelde.F.pairs, Grichelde.F.tSize, Grichelde.F.select, Grichelde.F.unpack, Grichelde.F.find, Grichelde.F.cGray, Grichelde.F.cDarkgray, Grichelde.F.cRed, Grichelde.F.cPrefix, Grichelde.F.format, Grichelde.F.rep, Grichelde.F.toString
|
||||||
|
|
||||||
function Grichelde:ParseVersion(version)
|
|
||||||
local _, _, major, minor, patch, ext = find(version, "(%d+)%.(%d+)%.(%d+)(.*)")
|
|
||||||
local preBuild, build = ext, ""
|
|
||||||
if (sub(ext, 1, 1) == "-") then
|
|
||||||
local b = find(ext, "+", 2)
|
|
||||||
if (b ~= nil) then
|
|
||||||
preBuild = sub(ext, 1, b)
|
|
||||||
build = sub(ext, b + 1)
|
|
||||||
else
|
|
||||||
preBuild = sub(ext, 1, b)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return toNumber(major) or 0, toNumber(minor) or 0, toNumber(patch) or 0, preBuild, build
|
|
||||||
end
|
|
||||||
|
|
||||||
-- show strings differently to distinguish them from numbers
|
-- show strings differently to distinguish them from numbers
|
||||||
function Grichelde:plainValue(val)
|
function Grichelde:plainValue(val)
|
||||||
|
11
README.md
11
README.md
@@ -1,10 +1,9 @@
|
|||||||
# Grichelde - Text replacer
|
# Grichelde - Text replacer
|
||||||
|
|
||||||
Grichelde is a WoW Classic Addon that replaces any characters or words you typed in a chatbox according to your replacement rules and text.
|
Grichelde is a WoW Classic Addon that replaces any characters or words you typed in a chat input line according to your replacement rules.
|
||||||
The replacement is done **before** the text is send to others/in the target channel. It does **not** change text others have written in the chat/channel,
|
The replacement is done **before** the text is send to other players/in the target channel. It does **not** change text other players have written in the chat, but the text they will see **from you**.
|
||||||
but the text they will see **from you** when you sent it.
|
|
||||||
|
|
||||||
Its purpose it to simulate a speaking disability of your toon and hereby strengthen immersion in roleplay.
|
Its purpose is to simulate a speaking disability of your toon and hereby strengthen immersion in roleplay.
|
||||||
Initially started as a helper addon for a roleplaying friend, Grichelde can be used for much more, like
|
Initially started as a helper addon for a roleplaying friend, Grichelde can be used for much more, like
|
||||||
|
|
||||||
* fixing your common spelling errors :)
|
* fixing your common spelling errors :)
|
||||||
@@ -40,7 +39,9 @@ Only slash commands, item links, textures, placeholders and ooc-markers are excl
|
|||||||
|
|
||||||
After entering a search or replacement text, you see a button "Okay" next to your input. This is **not** a validation message,
|
After entering a search or replacement text, you see a button "Okay" next to your input. This is **not** a validation message,
|
||||||
but the save button for text. This is a restriction from the UI library and can be seen in other addons as well.
|
but the save button for text. This is a restriction from the UI library and can be seen in other addons as well.
|
||||||
Please click on "Okay" to save the input permanently.
|
Please click on "Okay" to save the input permanently, otherwise it will not be stored..
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
If it still does not work or gives you errors, please read the next question.
|
If it still does not work or gives you errors, please read the next question.
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@ if not L then return end
|
|||||||
|
|
||||||
local cYellow = Grichelde.F.cYellow
|
local cYellow = Grichelde.F.cYellow
|
||||||
local cGray = Grichelde.F.cGray
|
local cGray = Grichelde.F.cGray
|
||||||
|
local cHyperlink = Grichelde.F.cHyperlink
|
||||||
local cPrefix = Grichelde.F.cPrefix
|
local cPrefix = Grichelde.F.cPrefix
|
||||||
|
|
||||||
-- system messages
|
-- system messages
|
||||||
@@ -37,6 +38,8 @@ L.Error_UnsupportedChannel = "Nicht unterst\195\188tzter Kanal"
|
|||||||
L.Profiles_Available = "Verf\195\188gbare Profile:"
|
L.Profiles_Available = "Verf\195\188gbare Profile:"
|
||||||
L.Profiles_Created = "Neues Profil %s angelegt."
|
L.Profiles_Created = "Neues Profil %s angelegt."
|
||||||
L.Profiles_Loaded = "Profil %s geladen."
|
L.Profiles_Loaded = "Profil %s geladen."
|
||||||
|
L.Profiles_Activated = "Profil %s aktiviert."
|
||||||
|
L.Profiles_Deactivated = "Profil %s deaktiviert."
|
||||||
L.Profiles_Refreshed = "Profil %s aktualisiert."
|
L.Profiles_Refreshed = "Profil %s aktualisiert."
|
||||||
L.Profiles_Deleted = "Profil %s gel\195\182scht."
|
L.Profiles_Deleted = "Profil %s gel\195\182scht."
|
||||||
L.Profiles_Copied = "Einstellungen von Profil %s \195\188bernommen."
|
L.Profiles_Copied = "Einstellungen von Profil %s \195\188bernommen."
|
||||||
@@ -135,6 +138,8 @@ L.Options_Help_Group_Desc = "Hilfstellungen zu den Suchmustern und zur Ersetzung
|
|||||||
L.Options_Help_Disclaimer = cYellow("Haftungsausschlu\195\159:") .. " Das Addon wird im reinen Ist-Zustand zur Verf\195\188gung gestellt, ohne Garantie auf Funktion und Fehlerfreiheit (f\195\188r mehr Details siehe GPL 3 Lizenzdokument). "
|
L.Options_Help_Disclaimer = cYellow("Haftungsausschlu\195\159:") .. " Das Addon wird im reinen Ist-Zustand zur Verf\195\188gung gestellt, ohne Garantie auf Funktion und Fehlerfreiheit (f\195\188r mehr Details siehe GPL 3 Lizenzdokument). "
|
||||||
.. "Ferner \195\188bernimmt der Autor keinerlei Haftung oder Gew\195\164hrleistung f\195\188r durch das Addon oder dessen Nutzung entstandene Fehler oder Sch\195\164den, "
|
.. "Ferner \195\188bernimmt der Autor keinerlei Haftung oder Gew\195\164hrleistung f\195\188r durch das Addon oder dessen Nutzung entstandene Fehler oder Sch\195\164den, "
|
||||||
.. "insb. den Verlust von Spielfortschritt oder Daten aufgrund von Abst\195\188rzen des WoW-Clients."
|
.. "insb. den Verlust von Spielfortschritt oder Daten aufgrund von Abst\195\188rzen des WoW-Clients."
|
||||||
|
L.Options_Help_Tab_Info_Name = "Info"
|
||||||
|
L.Options_Help_Tab_Info_Desc = "\195\156ber dieses Addon."
|
||||||
L.Options_Help_Tab_Basics_Name = "Grundlagen"
|
L.Options_Help_Tab_Basics_Name = "Grundlagen"
|
||||||
L.Options_Help_Tab_Basics_Desc = "Erl\195\164utert die Grundlagen des Addons"
|
L.Options_Help_Tab_Basics_Desc = "Erl\195\164utert die Grundlagen des Addons"
|
||||||
L.Options_Help_Tab_Expert_Name = "Experte"
|
L.Options_Help_Tab_Expert_Name = "Experte"
|
||||||
@@ -142,33 +147,42 @@ L.Options_Help_Tab_Expert_Desc = "Beleuchtet die Besonderheiten bei der Textsuch
|
|||||||
L.Options_Help_Tab_Examples_Name = "Beispiele"
|
L.Options_Help_Tab_Examples_Name = "Beispiele"
|
||||||
L.Options_Help_Tab_Examples_Desc = "Beispiele f\195\188r bestimmte Szenarien."
|
L.Options_Help_Tab_Examples_Desc = "Beispiele f\195\188r bestimmte Szenarien."
|
||||||
|
|
||||||
|
L.Options_Help_Info = cYellow("\195\156ber dieses Addon")
|
||||||
|
.. "|n%s ersetzt beliebige, selbstdefinierte Zeichenfolgen durch andere selbstdefinierte Zeichenfolgen, die ihr eingebt. Die Ersetzung findet vor dem Versenden an andere Spieler oder Kanäle statt. "
|
||||||
|
.. "Es \195\164ndert nicht den Text den andere Spieler im Chat geschrieben haben, nur eure eigenen Eingaben. Es soll den individuellen Sprachfehler eures Charakters simulieren und dadurch die Immersion erh\195\182hen."
|
||||||
|
.. "|n|nNat\195\188rlich kann man es auch f\195\188r andere Dinge zweckentfremden (Trollifizierer, Abk\195\188rzungen, Kosenamen, etc.). Eine ausf\195\188hrliche Beschreibung aller Optionen, der Funktionsweise und viele Beispiele befinden sich auf den nachfolgenden Reitern."
|
||||||
|
.. "|n|n" .. cYellow("Kontakt")
|
||||||
|
.. "|nBitte Fehler und Erfahrungsberichte direkt als Kommentar auf der Projektwebseite bei " .. cPrefix("CurseForge") .. " (" .. cHyperlink("https://www.curseforge.com/wow/addons/grichelde") .. ") einmelden. "
|
||||||
|
.. "Ihr k\195\182nnt auch gern Screenshots der Fehlermeldungen und eurer Zuweisungen anh\195\164ngen. Ein \195\156bersichtsfenster aller Mappings kann mit dem Kommando " .. cPrefix("\"/gri mappings\"") .. " aufgerufen und herauskopiert werden. "
|
||||||
|
.. "|nIch freue mich \195\188ber euere Erfahrungsberichte und Fehlerreports."
|
||||||
|
.. "|n|n" .. cYellow("Dank")
|
||||||
|
.. "|nMein Dank geht an meine lieben Beta-Tester " .. cPrefix("Chamera") .. ", " .. cPrefix("Tabenoca") .. " und " .. cPrefix("Nordraka") .. ", und besondereren Dank an " .. cPrefix("Shinue") .. " f\195\188r die Inspiration und lustigen Momente."
|
||||||
L.Options_Help_Basics = cYellow("Reihenfolge")
|
L.Options_Help_Basics = cYellow("Reihenfolge")
|
||||||
.. "|nEs sind unbegrenzt viele Textersetzung m\195\182glich, und sie werden in der Reihenfolge der definierten Zuordnungen abgearbeitet, von oben nach unten. "
|
.. "|nEs sind unbegrenzt viele Textersetzung m\195\182glich, und sie werden in der Reihenfolge der definierten Zuordnungen abgearbeitet, von oben nach unten. "
|
||||||
.. "Ersetzungen sind transitiv, d.h. nachfolgende Zuordnungen beziehen sich nicht auf den Originaltext, sondern das Resultat der vorherigen Ersetzung. "
|
.. "Ersetzungen sind transitiv, d.h. nachfolgende Zuordnungen beziehen sich nicht auf den Originaltext, sondern das Resultat der vorherigen Ersetzung. "
|
||||||
.. "|nMit der Zuordnung " .. cPrefix("\"a\" => \"b\"") .. " und " .. cPrefix("\"b\" => \"c\"") .. " wird bei Eingabe von " .. cPrefix("\"a\" => \"c\"") .. "."
|
.. "|nMit der Zuordnung " .. cPrefix("\"a\" => \"b\"") .. " und " .. cPrefix("\"b\" => \"c\"") .. " wird bei Eingabe von " .. cPrefix("\"a\" => \"c\"") .. "."
|
||||||
.. "|n|n" .. cYellow("Exakte Gro\195\159- und Kleinschreibung")
|
.. "|n|n" .. cYellow("Exakte Gro\195\159- und Kleinschreibung")
|
||||||
.. "|nBei exakter Gro\195\159- und Kleinschreibung muss die Schreibweise genau \195\188berstimmen, sonst findet keine Textersetzug f\195\188r diese Zuordnung statt. "
|
.. "|nBei exakter Gro\195\159- und Kleinschreibung muss die Schreibweise genau \195\188berstimmen, sonst wird diese Zuordnung \195\188bersprungen. "
|
||||||
.. "Wird die Gro\195\159- und Kleinschreibung ignoriert, wird die Gro\195\159schreibung jedes Zeichens bei der Ersetzung \195\188bernommen. "
|
.. "Wird die Gro\195\159- und Kleinschreibung ignoriert, wird die Gro\195\159schreibung jedes Zeichens bei der Ersetzung \195\188bernommen. "
|
||||||
.. "|nMit der Zuordnung " .. cPrefix("\"aBcDeF\" => \"uvWXYz\"") .. " wird aus " .. cPrefix("\"abcdef\" => \"uvwxyz\"") .. ", "
|
.. "|nMit der Zuordnung " .. cPrefix("\"aBcDeF\" => \"uvWXYz\"") .. " wird aus " .. cPrefix("\"abcdef\" => \"uvwxyz\"") .. ", "
|
||||||
.."aus " .. cPrefix("\"ABCDEF\" => \"UVWXYZ\"") .. " und aus " .. cPrefix("\"AbCdEf\" => \"UvWxYz\"") .. "."
|
.."aus " .. cPrefix("\"ABCDEF\" => \"UVWXYZ\"") .. " und aus " .. cPrefix("\"AbCdEf\" => \"UvWxYz\"") .. "."
|
||||||
.. "|n|n" .. cYellow("Zusammenfassen aufeinanderfolgender Treffer")
|
.. "|n|n" .. cYellow("Zusammenfassen aufeinanderfolgender Treffer")
|
||||||
.. "|nDas Zusammenfassen aufeinanderfolgender Treffer vermeidet unsch\195\182ne Wiederholungen, die durch die Ersetzung entstehen k\195\182nnen. "
|
.. "|nDas Zusammenfassen aufeinanderfolgender Treffer vermeidet unsch\195\182ne Wiederholungen, die durch die Ersetzung entstehen k\195\182nnen. "
|
||||||
.. "Die Zusammenfassung wird erst nach der Ersetzung vorgenommen, d.h. am vollst\195\164ndig ersetzten Text f\195\188r jede Zuordnung. "
|
.. "Die Zusammenfassung wird erst nach der Ersetzung vorgenommen, d.h. am vollst\195\164ndig ersetzten Text f\195\188r alle Zuordnungen. "
|
||||||
.. "|nMit der Zuordnung " .. cPrefix("\"s\" => \"sch\"") .. " wird aus " .. cPrefix("\"Tasse\" => \"Tasche\"") .. " statt " .. cPrefix("\"Taschsche\"") .. ", "
|
.. "|nMit der Zuordnung " .. cPrefix("\"s\" => \"sch\"") .. " wird aus " .. cPrefix("\"Tasse\" => \"Tasche\"") .. " statt " .. cPrefix("\"Taschsche\"") .. ", "
|
||||||
.. "aber " .. cPrefix("\"schmeissen\" => \"schchmeichen\"") .. ". Solche Randbedingungen beseitigt in der Regel eine weitere Zuordnung wie " .. cPrefix("\"schch\" => \"sch\"") .. "."
|
.. "aber aus " .. cPrefix("\"schmeissen\" => \"schchmeischen\"") .. ". Solche Randbedingungen beseitigt in der Regel eine weitere Zuordnung: " .. cPrefix("\"schch\" => \"sch\"") .. "."
|
||||||
.. "|n|n" .. cYellow("Anhalten nach Treffer")
|
.. "|n|n" .. cYellow("Anhalten nach Treffer")
|
||||||
.. "|nEs werden keine weiteren Ersetzungen mehr vorgenommen, wenn die aktuelle Zuordnung zutreffend ist. Alle nachfolgenden Zuordnungen werden dann \195\188bersprungen. "
|
.. "|nAlle nachfolgenden Ersetzungen mehr \195\188bersprungen, wenn die aktuelle Zuordnung zutreffend ist. Wenn bei der aktuelle Zuordnung kein Treffer vorliegt, werden die restlichen Zuordnung ganz normal weiter abgearbeitet."
|
||||||
.. "Wenn kein Treffer vorliegt, werden die restlichen Zuordnung ganz normal weiter abgearbeitet."
|
|
||||||
L.Options_Help_Expert = cYellow("verk\195\188rzende/verl\195\163ngernde Ersetzungen")
|
L.Options_Help_Expert = cYellow("verk\195\188rzende/verl\195\163ngernde Ersetzungen")
|
||||||
.. "|nIst der Ersetzungstext k\195\188rzer als der eigentliche Suchtext, werden die \195\188bersch\195\188\195\159igen Zeichen des Suchtreffers entfernt. "
|
.. "|nIst der Ersetzungstext k\195\188rzer als der eigentliche Suchtext, werden die \195\188bersch\195\188\195\159igen Zeichen des Suchtreffers entfernt. "
|
||||||
.. "Ist der Ersetzungstext l\195\163nger, werden die \195\188brigen Zeichen nach dem Treffer hinten drangehangen. Dabei wird die Gro\195\159- und Kleinschreibung des letzten Zeichens ber\195\188cksichtigt, "
|
.. "Ist der Ersetzungstext l\195\163nger, werden die \195\188brigen Zeichen nach dem Treffer hinten drangehangen. Dabei wird die Gro\195\159- und Kleinschreibung des letzten Zeichens ber\195\188cksichtigt, "
|
||||||
.. "ebenso wie die Gro\195\159- und Kleinschreibung des nachfolgenden Zeichens. Gro\195\159geschriebene Abk\195\188rzungen und Ausdr\195\188cke bleiben so einheitlich. "
|
.. "ebenso wie die Gro\195\159- und Kleinschreibung des nachfolgenden Zeichens. Gro\195\159geschriebene Abk\195\188rzungen und Ausdr\195\188cke bleiben so einheitlich. "
|
||||||
.. "|nMit der Zuordnung " .. cPrefix("\"Kr\195\164uter\" => \"Gr\195\188nzeugs\"") .. " wird aus " .. cPrefix("\"KR\195\132UTER\" => \"GR\195\156NZEUGS\"") .. " statt " .. cPrefix("\"GR\195\156NZEUgs\"") .. " "
|
.. "|nMit der Zuordnung " .. cPrefix("\"Kr\195\164uter\" => \"Gr\195\188nzeugs\"") .. " wird aus " .. cPrefix("\"KR\195\132UTER\" => \"GR\195\156NZEUGS\"") .. " statt " .. cPrefix("\"GR\195\156NZEUgs\"") .. " "
|
||||||
.. "unter Beibehaltung von absichtlicher Gro\195\159schreibung wie " .. cPrefix("\"Kr\195\132utERGarten\" => \"Gr195\156nzEUGSgarten\"") .. " statt " .. cPrefix("\"Gr\195\188nzeugsGarten\"") .. "."
|
.. "unter Beibehaltung von absichtlicher Gro\195\159schreibung wie " .. cPrefix("\"Kr\195\132utERGarten\" => \"Gr\195\156nzEUGSgarten\"") .. " statt " .. cPrefix("\"Gr\195\188nzeugsGarten\"") .. "."
|
||||||
.. "|n|n" .. cYellow("Standby")
|
.. "|n|n" .. cYellow("Standby")
|
||||||
.. "|nErsetzungen k\195\182nnen auch nur bei Bedarf durchgef\195\188hrt werden, selbst wenn das Addon oder ein Kanal deaktivert wurde. "
|
.. "|nErsetzungen k\195\182nnen auch nur bei Bedarf durchgef\195\188hrt werden, selbst wenn das Addon oder ein Kanal deaktivert wurde. "
|
||||||
.. "Vor der Eingabe in der Chatbox schreibt man " .. cPrefix("/gri").. " oder " .. cPrefix("/grichelde").. " und optional noch den Zielkanal "
|
.. "Vor der Eingabe in der Chatbox schreibt man " .. cPrefix("/gri").. " oder " .. cPrefix("/grichelde").. " und optional noch den Zielkanal "
|
||||||
.. "z.B. " .. cPrefix("\"/gri /g hallo leute\"") .. " und alle aktiven Zuordnungen werden ersetzt, selbst wenn der Gildenkanal oder das Addon nicht aktiv sind."
|
.. "z.B. " .. cPrefix("\"/gri /g Hallo Leute\"") .. " und alle aktiven Zuordnungen werden ersetzt, selbst wenn der Gildenkanal oder das Addon nicht aktiv sind."
|
||||||
.. "|n|n" .. cYellow("Regul\195\164re Ausdr\195\188cke")
|
.. "|n|n" .. cYellow("Regul\195\164re Ausdr\195\188cke")
|
||||||
.. "|nRegEx sind sehr m\195\163chtige Such- und Ersetzunsgmuster die h\195\163ufig in der Programmierung verwendet werden. Generell werden RegEx in den Suchtexten \195\188bernommen, "
|
.. "|nRegEx sind sehr m\195\163chtige Such- und Ersetzunsgmuster die h\195\163ufig in der Programmierung verwendet werden. Generell werden RegEx in den Suchtexten \195\188bernommen, "
|
||||||
.. "aber Lua unterst\195\188tzt nicht den vollst\195\163ndigen Umfang von PCRE. Trotzdem funktionieren viele Muster wie Anker bei Zeilenanfang " .. cPrefix("\"^\"") .. " oder Zeilenende " .. cPrefix("\"$\"")
|
.. "aber Lua unterst\195\188tzt nicht den vollst\195\163ndigen Umfang von PCRE. Trotzdem funktionieren viele Muster wie Anker bei Zeilenanfang " .. cPrefix("\"^\"") .. " oder Zeilenende " .. cPrefix("\"$\"")
|
||||||
@@ -549,7 +563,7 @@ L.Options_Help_Examples = {
|
|||||||
replacements = {
|
replacements = {
|
||||||
replacement_10 = {
|
replacement_10 = {
|
||||||
order = 10,
|
order = 10,
|
||||||
searchText = "^([^aeiouy]*)([aeiouy])",
|
searchText = "^([^aeiouy]-)([aeiouy])",
|
||||||
replaceText = "%1%2-%1%2-%1%2",
|
replaceText = "%1%2-%1%2-%1%2",
|
||||||
exactCase = false,
|
exactCase = false,
|
||||||
consolidate = true,
|
consolidate = true,
|
||||||
|
@@ -8,6 +8,7 @@ if not L then return end
|
|||||||
|
|
||||||
local cYellow = Grichelde.F.cYellow
|
local cYellow = Grichelde.F.cYellow
|
||||||
local cGray = Grichelde.F.cGray
|
local cGray = Grichelde.F.cGray
|
||||||
|
local cHyperlink = Grichelde.F.cHyperlink
|
||||||
local cPrefix = Grichelde.F.cPrefix
|
local cPrefix = Grichelde.F.cPrefix
|
||||||
|
|
||||||
-- system messages
|
-- system messages
|
||||||
@@ -37,10 +38,12 @@ L.Error_UnsupportedChannel = "Unsupported channel"
|
|||||||
L.Profiles_Available = "Available profiles:"
|
L.Profiles_Available = "Available profiles:"
|
||||||
L.Profiles_Created = "New profile %s created."
|
L.Profiles_Created = "New profile %s created."
|
||||||
L.Profiles_Loaded = "Profile %s is loaded."
|
L.Profiles_Loaded = "Profile %s is loaded."
|
||||||
L.Profiles_Refreshed = "Profil %s refreshed."
|
L.Profiles_Activated = "Profile %s activated."
|
||||||
|
L.Profiles_Deactivated = "Profile %s deactivated."
|
||||||
|
L.Profiles_Refreshed = "Profile %s refreshed."
|
||||||
L.Profiles_Deleted = "Profile %s deleted."
|
L.Profiles_Deleted = "Profile %s deleted."
|
||||||
L.Profiles_Copied = "Settings applied from profile %s."
|
L.Profiles_Copied = "Settings applied from profile %s."
|
||||||
L.Profiles_Reset = "Profil %s reset."
|
L.Profiles_Reset = "Profile %s reset."
|
||||||
L.Profiles_Invalid = "Invalid profile %s!"
|
L.Profiles_Invalid = "Invalid profile %s!"
|
||||||
L.Profiles_DeleteError = "The active profile cannot be deleted!"
|
L.Profiles_DeleteError = "The active profile cannot be deleted!"
|
||||||
L.Profiles_AlreadyExistsError = "The profile %s already exists!"
|
L.Profiles_AlreadyExistsError = "The profile %s already exists!"
|
||||||
@@ -135,6 +138,8 @@ L.Options_Help_Group_Desc = "Guideance to search patterns and replacement logic.
|
|||||||
L.Options_Help_Disclaimer = cYellow("Disclaimer of warranty:") .. " The addon is provided \"AS IS\" and comes without warranty of any kind of function or correctness (for more details, consult the GPL 3 license). "
|
L.Options_Help_Disclaimer = cYellow("Disclaimer of warranty:") .. " The addon is provided \"AS IS\" and comes without warranty of any kind of function or correctness (for more details, consult the GPL 3 license). "
|
||||||
.."Also the author is not held responsible for any risk or damage the addon or its use might cause, especially lost of progress or data due to crashes of the WoW client."
|
.."Also the author is not held responsible for any risk or damage the addon or its use might cause, especially lost of progress or data due to crashes of the WoW client."
|
||||||
|
|
||||||
|
L.Options_Help_Tab_Info_Name = "Info"
|
||||||
|
L.Options_Help_Tab_Info_Desc = "About this addon."
|
||||||
L.Options_Help_Tab_Basics_Name = "Basics"
|
L.Options_Help_Tab_Basics_Name = "Basics"
|
||||||
L.Options_Help_Tab_Basics_Desc = "Some explanatory notes the the basic behaviour."
|
L.Options_Help_Tab_Basics_Desc = "Some explanatory notes the the basic behaviour."
|
||||||
L.Options_Help_Tab_Expert_Name = "Expert"
|
L.Options_Help_Tab_Expert_Name = "Expert"
|
||||||
@@ -142,6 +147,16 @@ L.Options_Help_Tab_Expert_Desc = "More details on special search options."
|
|||||||
L.Options_Help_Tab_Examples_Name = "Examples"
|
L.Options_Help_Tab_Examples_Name = "Examples"
|
||||||
L.Options_Help_Tab_Examples_Desc = "Templates for particular scenarios."
|
L.Options_Help_Tab_Examples_Desc = "Templates for particular scenarios."
|
||||||
|
|
||||||
|
L.Options_Help_Info = cYellow("About this addon")
|
||||||
|
.. "|n%s replaces any characters or words you typed in a chatbox according to your replacement rules and text. The replacement is done before the text is send to other players/in the target channel. "
|
||||||
|
.. "It does not change text other players have written in the chat, but the text they will see from you. Its purpose is to simulate a speaking disability of your toon and to strengthen immersion in roleplay."
|
||||||
|
.. "|n|nOf course it can be used for many other things, too (trollifier, abbreviations, nick names, etc.). A extensive description of all options, the general replacement workflow and a lot of examples can be found on the next tabs."
|
||||||
|
.. "|n|n" .. cYellow("Contact")
|
||||||
|
.. "|nPlease report errors and your experiences directly as a comment on the project website at " .. cPrefix("CurseForge") .. " (" .. cHyperlink("https://www.curseforge.com/wow/addons/grichelde") .. "). "
|
||||||
|
.. "You are encouraged to attach screenshots of error messages and your mappings. An overview of all your mappings is shnown by using the command " .. cPrefix("\"/gri mappings\"") .. " and copy it out. "
|
||||||
|
.. "|nI'm looking forward for your feedback and reports."
|
||||||
|
.. "|n|n" .. cYellow("Thanks")
|
||||||
|
.. "|Many thanks to my beta testers " .. cPrefix("Chamera") .. ", " .. cPrefix("Tabenoca") .. " and " .. cPrefix("Nordraka") .. ", and very special thanks to " .. cPrefix("Shinue") .. " for the inspiration and hilarious moments."
|
||||||
L.Options_Help_Basics = cYellow("Ordering")
|
L.Options_Help_Basics = cYellow("Ordering")
|
||||||
.. "|nYou can have an unlimited number of replacements. All mappings will be processed in same order as defined, from top down. "
|
.. "|nYou can have an unlimited number of replacements. All mappings will be processed in same order as defined, from top down. "
|
||||||
.. "Replacements are also transitive, so consecutive mappings do not work on the original input but the resulting text from the previous replacements. "
|
.. "Replacements are also transitive, so consecutive mappings do not work on the original input but the resulting text from the previous replacements. "
|
||||||
@@ -157,7 +172,7 @@ L.Options_Help_Basics = cYellow("Ordering")
|
|||||||
.. "|nWith mapping " .. cPrefix("\"s\" => \"sh\"") .. " text becomes " .. cPrefix("\"tossing\" => \"toshing\"") .. " instead of " .. cPrefix("\"toshshing\"") .. ", yet still " .. cPrefix("\"paths\" => \"pathsh\"") .. ". "
|
.. "|nWith mapping " .. cPrefix("\"s\" => \"sh\"") .. " text becomes " .. cPrefix("\"tossing\" => \"toshing\"") .. " instead of " .. cPrefix("\"toshshing\"") .. ", yet still " .. cPrefix("\"paths\" => \"pathsh\"") .. ". "
|
||||||
.. "Such edge cases can usually be mitigated with an additional mapping at the end: " .. cPrefix("\"thsh\" => \"thz\"") .. "."
|
.. "Such edge cases can usually be mitigated with an additional mapping at the end: " .. cPrefix("\"thsh\" => \"thz\"") .. "."
|
||||||
.. "|n|n" .. cYellow("stop on match")
|
.. "|n|n" .. cYellow("stop on match")
|
||||||
.. "|nNo other replacements are done, when the current mapping matched. This will skip any other consecutive mappings when hit. When no match ocurred, the remaining mappings are processed as usual."
|
.. "|nAll other consecutive replacements are skipped, when the current mapping matched. When the current mapping does not match, the remaining mappings are processed as usual."
|
||||||
L.Options_Help_Expert = cYellow("shortening/lengthening replacements")
|
L.Options_Help_Expert = cYellow("shortening/lengthening replacements")
|
||||||
.. "|nIf the replacement is shorter than the actual match, all remaining characters will be skipped. If the replacement is longer, all remaining characters will be appended. "
|
.. "|nIf the replacement is shorter than the actual match, all remaining characters will be skipped. If the replacement is longer, all remaining characters will be appended. "
|
||||||
.. "The case of the replaced character is considered as well as the case of the next character in the original text. That way capital case abbreviations and expressions will not be distorted. "
|
.. "The case of the replaced character is considered as well as the case of the next character in the original text. That way capital case abbreviations and expressions will not be distorted. "
|
||||||
@@ -592,7 +607,7 @@ L.Options_Help_Examples = {
|
|||||||
replacements = {
|
replacements = {
|
||||||
replacement_10 = {
|
replacement_10 = {
|
||||||
order = 10,
|
order = 10,
|
||||||
searchText = "^([^aeiouy]*)([aeiouy])",
|
searchText = "^([^aeiouy]-)([aeiouy])",
|
||||||
replaceText = "%1%2-%1%2-%1%2",
|
replaceText = "%1%2-%1%2-%1%2",
|
||||||
exactCase = false,
|
exactCase = false,
|
||||||
consolidate = true,
|
consolidate = true,
|
||||||
|
17
twitch/announcements.txt
Normal file
17
twitch/announcements.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
https://wow.gamepedia.com/Localizing_an_addon
|
||||||
|
https://wow.gamepedia.com/Pattern_matching
|
||||||
|
https://wow.gamepedia.com/Lua_functions#String_Functions
|
||||||
|
https://wow.gamepedia.com/API_SetRaidTarget
|
||||||
|
https://www.wowace.com/projects/ace3/pages/ace-db-3-0-tutorial
|
||||||
|
https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0
|
||||||
|
https://wowwiki.fandom.com/wiki/Events_A-Z_(full_list)
|
||||||
|
|
||||||
|
|
||||||
|
Liebe RP-Gemeinde, ich benötige eure Mithilfe beim Test meines ersten WoW-Addons. :handshake:
|
||||||
|
|
||||||
|
Es heißt "Grichelde" und ersetzt beliebige, selbstdefinierte Zeichenfolgen durch andere selbstdefinierte Zeichenfolgen, die ihr eingebt. Es ändert nicht den Text den andere im Chat geschrieben haben, nur eure eigenen Eingaben. Die Idee wurde nach mehreren lustigen RP-Sitzungen mit einer Untoten ohne Unterkiefer geboren, deren Spielerin den Sprachfehler immer mühsam per Hand eintippen musste. Es soll den individuellen Sprachfehler eures Charakters simulieren und dadurch die Immersion erhöhen. Auf der Webseite findet ihr ein paar Screenshots, die euch die Funktion einfach verbildlichen sollten: https://www.curseforge.com/wow/addons/grichelde/screenshots
|
||||||
|
|
||||||
|
Natürlich kann man es auch für andere Dinge zweckentfremden (Trollifizierer :dragon_face: , Abkürzungen, Kosenamen, etc.). Es gibt ein nettes UI zum Konfigurieren der Ersetzungen und der aktiven Kanäle und auch eine großzügige Hilfesektion mit vielen Beispielen. Die Suchtreffer können auf ganze Wörter oder am Anfang, der Mitte und/oder am Ende eines Wortes eingeschränkt werden. Für die Profis gibt es sogar Unterstützung für reguläre Ausdrücke :sunglasses:, das ermöglicht auch schwierigere Ersetzungen mit Wiederholungen, wie Stottern. Für Rollenspieler gibts auch eine eigene Emote- und OOC-Erkennung.
|
||||||
|
|
||||||
|
Installieren kann man es über Twitch, dort muss aktuell noch die Suche und Installation von Beta-Versionen aktiviert sein, oder manuell über diesen Link runterladen und in den WoW\Interface\Addons Ordner kopieren: https://www.curseforge.com/wow/addons/grichelde
|
||||||
|
Bitte Fehler auf der Projektwebseite bei CurseForge einmelden, damit wir den Discord nicht zweckentfremden. Ich freue mich über euere Erfahrungsberichte und Fehlerreports.
|
@@ -19,13 +19,16 @@ Templates for various situations, now also with import possibility
|
|||||||
Help
|
Help
|
||||||
Built-in help texts
|
Built-in help texts
|
||||||
|
|
||||||
|
Confirm text changes
|
||||||
|
When you enter a search or replacement text, please confirm your input with the Okay button. Otherwise its not saved.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Beispielersetzung
|
Beispielersetzung
|
||||||
Eine Texteingabe wird im "Sagen"-Kanal ersetzt.
|
Eine Texteingabe wird im "Sagen"-Kanal ersetzt.
|
||||||
|
|
||||||
Zeichenersetzung
|
Zeichenersetzung
|
||||||
Erzeuge bedingte Zuordnungen zwischen Such- und Ersetzungetext.
|
Erzeuge bedingte Zuordnungen zwischen Such- und Ersetzungstext.
|
||||||
|
|
||||||
Kanälekonfiguration
|
Kanälekonfiguration
|
||||||
einzeln pro Kanal aktivierbar
|
einzeln pro Kanal aktivierbar
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 100 KiB |
Binary file not shown.
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 97 KiB |
BIN
twitch/text-okay.jpg
Normal file
BIN
twitch/text-okay.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Reference in New Issue
Block a user