Skip to content

Commit

Permalink
- escaping ',' in npc names for sending.
Browse files Browse the repository at this point in the history
  • Loading branch information
cont1nuity committed Apr 23, 2024
1 parent 2a1dd5c commit cfee1e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Plater_ChangeLog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function Plater.GetChangelogTable()
if (not Plater.ChangeLogTable) then
Plater.ChangeLogTable = {

{1713856200, "Bug Fix", "April 23rd, 2024", "Sending NPC information to other players would not work if the name contained a ','.", "cont1nuity"},
{1713856200, "Bug Fix", "April 23rd, 2024", "Fixing options alignment issue with Cata.", "cont1nuity"},
{1713856200, "Backend Change", "April 22nd, 2024", "Base support for TWW.", "cont1nuity"},
{1713856200, "Backend Change", "April 19nd, 2024", "Backend changes to options layout.", "Terciob"},
Expand Down
10 changes: 10 additions & 0 deletions Plater_Comms.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ end
local npcName = nextDataToApprove[3]
local npcZone = nextDataToApprove[4]
local senderName = nextDataToApprove[6]

npcName = string.gsub(npcName, "@C@", ","))
npcZone = string.gsub(npcZone, "@C@", ","))

frame.Text1:SetText("From: " .. senderName)

Expand All @@ -381,6 +384,8 @@ end

elseif (whichInfo == "npcrename") then
local newName = nextDataToApprove[5]
newName = string.gsub(newName, "@C@", ","))

frame.Text2:SetText("Rename: |cFFFFDD00" .. npcName .. "|r to: |cFFFFDD00" .. newName)

frame.AcceptButton:SetClickFunction(function()
Expand Down Expand Up @@ -802,6 +807,9 @@ end
Plater:Msg("npcInfo not found.")
return
end

npcName = string.gsub(npcName, ",", "@C@"))
npcZone = string.gsub(npcZone, ",", "@C@"))

local dataToSend

Expand All @@ -822,6 +830,8 @@ end
Plater:Msg("npc does not have a custom name.")
return
end

npcNameRenamed = string.gsub(npcNameRenamed, ",", "@C@"))

dataToSend = whichInfo .. "," .. npcId .. "," .. npcName .. "," .. npcZone .. "," .. (autoAccept and "1" or "0") .. "," .. npcNameRenamed

Expand Down

0 comments on commit cfee1e1

Please sign in to comment.