diff --git a/Delete-Character.lua b/Delete-Character.lua index edf7047..29b9ba8 100644 --- a/Delete-Character.lua +++ b/Delete-Character.lua @@ -75,7 +75,7 @@ if lang == nil then lang = "en" end -local path = "./data/" .. lang .. ".lua" +local path = "./data/" .. lang .. "/" .. lang .. ".lua" dofile (path) @@ -84,7 +84,7 @@ dofile (path) function select_account() local selected if naccounts >1 then - selected = iup.ListDialog (1, L.ChooseAccounttoDelete, + selected = iup.ListDialog (1, L.Account, naccounts, --Size accounts_list, 1, --Initial @@ -111,19 +111,65 @@ if account == nil then os.exit() end +-- Select Server + +world_list = {} -- String list for selection dialog +nworlds = 0 +for i,j in pairs(History_SV["Default"][account]["$AccountWide"]["worlds"]) do + nworlds = nworlds +1 + table.insert(world_list, i) +end + + +-- insert marker for older chars +table.insert(world_list, "##NEITHER##") + +if nworlds > 1 then + local selected = iup.ListDialog (1, L.ChooseWorld, + nworlds+1, --Size + world_list, + 1, --Initial + 1,nworlds+1 --MaxCol MaxLine + ) + + if selected <0 then + iup.Close() + os.exit() + end + world = world_list[selected+1] +end + + playerNames = {} playerName2ID={} - for playerID, j in pairs(History_SV["Default"][account]["$AccountWide"]["data"]) do - if j.name == nil then - table.insert(playerNames, playerID) -- old Style - playerName2ID[playerID] = playerID - else - table.insert(playerNames, j.name) - playerName2ID[j.name] = playerID +if world == "##NEITHER##" then + + for playerID, j in pairs(History_SV["Default"][account]["$AccountWide"]["data"]) do + if j.world == nil then + if j.name == nil then + table.insert(playerNames, playerID) -- old Style + playerName2ID[playerID] = playerID + else + table.insert(playerNames, j.name) + playerName2ID[j.name] = playerID + end + end end - end - + +else + for playerID, j in pairs(History_SV["Default"][account]["$AccountWide"]["data"]) do + if j.world == world then + if j.name == nil then + table.insert(playerNames, playerID) -- old Style + playerName2ID[playerID] = playerID + else + table.insert(playerNames, j.name) + playerName2ID[j.name] = playerID + end + end + end +end -- No players. if #playerNames == 0 then @@ -131,7 +177,7 @@ if #playerNames == 0 then os.exit() end -selected = iup.ListDialog (1, L.SelectA, +selected = iup.ListDialog (1, L.ChooseChartoDelete, #playerNames, --Size playerNames, 1, --Initial @@ -170,7 +216,7 @@ os.execute("copy ..\\..\\SavedVariables\\History.lua ..\\..\\SavedVariables\\Hi newf = assert(io.open("../../SavedVariables/History.new", "w")) -- ============== --- Erase Account +-- Erase Character History_SV["Default"][account]["$AccountWide"]["data"][playerID] = nil diff --git a/data/de/de.lua b/data/de/de.lua index 4c73d34..2d520b5 100644 --- a/data/de/de.lua +++ b/data/de/de.lua @@ -88,6 +88,7 @@ DLC_names = { NoAccount ="Only 1 account, can't delete that.", ChooseAccounttoDelete = "Choose Account to Delete", ChooseChartoDelete = "Choose Character to Delete", + ChooseWorld ="Choose Server", YesLabel = "Y", NoLabel = "N", Version = "Version", diff --git a/data/en/en.lua b/data/en/en.lua index 4b2919f..e312fa6 100644 --- a/data/en/en.lua +++ b/data/en/en.lua @@ -85,6 +85,7 @@ DLC_names = { NoAccount ="Only 1 account, can't delete that.", ChooseAccounttoDelete = "Choose Account to Delete", ChooseChartoDelete = "Choose Character to Delete", + ChooseWorld ="Choose Server", YesLabel = "Y", NoLabel = "N", Version = "Version", diff --git a/data/fr/fr.lua b/data/fr/fr.lua index fef4f0c..b6ec42d 100644 --- a/data/fr/fr.lua +++ b/data/fr/fr.lua @@ -84,6 +84,7 @@ DLC_names = { NoAccount ="Only 1 account, can't delete that.", ChooseAccounttoDelete = "Choose Account to Delete", ChooseChartoDelete = "Choose Character to Delete", + ChooseWorld ="Choose Server", YesLabel = "O", NoLabel = "N", Version = "Version",