Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ff1e6a1d5 | |||
e53900d2b1 |
23
CHANGELOG.md
23
CHANGELOG.md
@@ -3,6 +3,27 @@ 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.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]
|
## Version 0.9.1-rc - 2020-08-01 [Release Candidate]
|
||||||
### Fixed
|
### Fixed
|
||||||
- emote detection mixed in other channels
|
- emote detection mixed in other channels
|
||||||
@@ -27,7 +48,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
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
## Interface: 11305
|
## Interface: 11306
|
||||||
|
|
||||||
## 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.1-rc
|
## Version: 1.1.0
|
||||||
## 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, isLetter, 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.isLetter, 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
|
||||||
@@ -429,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
|
if (currentChar == "|") then
|
||||||
-- @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
|
|
||||||
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 (not replaceEmotes) then
|
if (not replaceEmotes) then
|
||||||
self:DebugPrint("CheckForPreversableText : Found emote \"%s\" at (%d, %d), but preserved it", emote, pos1, pos2)
|
self:DebugPrint("CheckForEmote : Found emote \"%s\" at (%d, %d), but preserved it", emote, pos1, pos2)
|
||||||
return pos2
|
return pos2
|
||||||
else
|
else
|
||||||
self:DebugPrint("CheckForPreversableText : ignoring 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)
|
||||||
@@ -479,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]
|
||||||
@@ -501,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)
|
||||||
@@ -512,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
|
||||||
@@ -536,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)
|
||||||
@@ -592,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
|
||||||
@@ -659,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
|
||||||
@@ -691,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,
|
||||||
|
@@ -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,
|
||||||
},
|
},
|
||||||
|
@@ -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 :)
|
||||||
|
@@ -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
|
||||||
@@ -137,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"
|
||||||
@@ -144,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("\"$\"")
|
||||||
|
@@ -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
|
||||||
@@ -137,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"
|
||||||
@@ -144,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. "
|
||||||
@@ -159,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. "
|
||||||
|
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.
|
Reference in New Issue
Block a user