- Awards
- 38
Hola a todos, aqui les dejo la guia por Sarah Wesker de como cambiar los items.xml ITEM ID para items.xml ClientID,
Nos iremos en la carpeta data/ de nuestro servidor y crearemos una carpeta llamada xmlConverter
Dentro crearemos 2 carpetas, una llamada input otra output:
De esta forma:
Ahora nos iremos en data/scripts y agregaremos este Talkaction en un archivo llamdo xmlConverter.lua:
Ahora, los archivos que desearemos pasar a Client ID ( en el caso items.xml ) lo copiaremos dentro de la carpeta Input,
Este último debe de empezar de esta forma:
Entraremos en el juego y haremos el comando /xmlConverter y tendremos el archivo creado en la carpeta output.
Nos iremos en la carpeta data/ de nuestro servidor y crearemos una carpeta llamada xmlConverter
Dentro crearemos 2 carpetas, una llamada input otra output:
De esta forma:
Ahora nos iremos en data/scripts y agregaremos este Talkaction en un archivo llamdo xmlConverter.lua:
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()
Ahora, los archivos que desearemos pasar a Client ID ( en el caso items.xml ) lo copiaremos dentro de la carpeta Input,
Este último debe de empezar de esta forma:
Entraremos en el juego y haremos el comando /xmlConverter y tendremos el archivo creado en la carpeta output.