- Awards
- 38
Hola a todos,
Aquí encontrarán como cambiar el archivo items.xml para items.xml de Item ID para client ID.
Abrirán la carpeta de su servidor en data, crearan una carpeta llamada xmlConverter, dentro de esta carpeta crearan 2 otras una llamada input otra output.
En la carpeta input pegarán su items.xml,
Luego nos iremos en data/scripts y pegaremos esto:
En el juego haremos con el god el comando /xmlconverter, en la carpeta output encontraran el items.xml convertido en clientID.
Script por Sarah Wesker:
Aquí encontrarán como cambiar el archivo items.xml para items.xml de Item ID para client ID.
Abrirán la carpeta de su servidor en data, crearan una carpeta llamada xmlConverter, dentro de esta carpeta crearan 2 otras una llamada input otra output.
En la carpeta input pegarán su items.xml,
Luego nos iremos en data/scripts y pegaremos esto:
En el juego haremos con el god el comando /xmlconverter, en la carpeta output encontraran el items.xml convertido en clientID.
Script por Sarah Wesker:
Código:
--[[
Credits: Sarah Wesker
Version: 1.0
Compat: TFS 1.3
Create: December 2020
]]--
local function convertXmlFile(file)
local f = io.open(file, 'r')
if not f then
return false
end
local newFile = io.open(file:gsub('input', 'output'), 'w')
if not newFile then
f:close()
return false
end
local index = 0
local lines = {}
for line in f:lines() do
local fromId
local toId
fromId = tonumber(line:match('id="(%d+)"'))
if not fromId then
fromId = tonumber(line:match('fromId="(%d+)"'))
toId = tonumber(line:match('toId="(%d+)"'))
if not fromId or not toId then
goto continue
end
else
toId = fromId
end
for _, itemId in pairs({fromId, toId}) do
if itemId ~= 0 then
local itemType = ItemType(itemId)
if itemType then
local clientId = itemType:getClientId()
if clientId ~= 0 then
line = line:gsub(tostring(itemId), tostring(clientId))
end
end
end
end
::continue::
index = index +1
lines[index] = line..'\n'
end
f:close()
newFile:write(table.concat(lines))
newFile:close()
return true
end
local talkTest = TalkAction("/xmlConverter")
function talkTest.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
for file in io.popen([[dir "data\xmlConverter\input" /b /a /s]]):lines() do
convertXmlFile(file)
end
player:popupFYI("The conversion from itemId to clientId was successful.")
return false
end
talkTest:separator(" ")
talkTest:register()