Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xmlTable = {grounds = {}, xmlStart = '', xmlEnd = ''}
- function parseXml()
- editedXml = ''
- editedDecorations = ''
- xmlTable.grounds = {}
- c = 0xE6FAFF
- id = 1
- color = {0xC80046,0xC80031,0xC8001B,0xC70004,0xC81300,0xC72800,0xC83B00,0xC84D00,0xC85F00,0xC77000,0xC88200,0xC89500,0xC8A900,0xC8BF00,0xB8C800,0xA1C700,0x8CC800,0x77C800,0x63C800,0x4EC800,0x38C800,0x20C800,0x06C800,0x00C815,0x00C82D,0x00C844,0x00C859,0x00C86E,0x00C783,0x00C897,0x00C7AD,0x00C8C5,0x00B3C7,0x009EC8,0x008BC8,0x0079C8,0x0067C8,0x0055C8,0x0043C8,0x0031C8,0x001CC8,0x0006C8,0x1100C8,0x2700C8,0x3C00C7,0x5100C8,0x6500C8,0x7A00C8,0x9100C8,0xA800C8}
- if tfm.get.room.xmlMapInfo.xml then
- xml = tfm.get.room.xmlMapInfo.xml
- grounds = xml:match('<S>[^´]+/>'):gsub("<S>","")
- for id in grounds:gmatch('<S[^/]+/>') do
- table.insert(xmlTable.grounds,id)
- end
- xmlTable.xmlStart = xml:match('<C>[^´]+<S>')
- xmlTable.xmlEnd = xml:match('</S>[^´]+</C>')
- for k,v in pairs(xmlTable.grounds) do
- if id < #color then
- id = id+1
- else
- id = 1
- end
- c = color[id]
- if not v:match('T="9"') then
- if not v:match('T="13"') then
- if not v:match('m=""') then
- if not v:match('o="[A-Z0-9a-z]+"') then
- v = v:gsub('T="[0-9]+"',string.format('T="12" o="%s"',string.format("%X", c)))
- else
- o = string.format('o="%s"',string.format("%X", c))
- v = v:gsub('o="[A-Z0-9a-z]+"',o)
- end
- end
- else
- if not v:match('m=""') then
- if not v:match('o="[A-Z0-9a-z]+"') then
- v = v:gsub('T="[0-9]+"',string.format('T="12" o="%s"',string.format("%X", c)))
- else
- o = string.format('o="%s"',string.format("%X", c))
- v = v:gsub('o="[A-Z0-9a-z]+"',o)
- end
- end
- end
- end
- editedXml = editedXml..v
- end
- xml = string.format("%s%s%s",xmlTable.xmlStart,editedXml,xmlTable.xmlEnd)
- tfm.exec.newGame(xml)
- cheese = {t='',x='',y=''}
- if xml:match('<F[^/]+/>') then
- cheese.t = xml:match('<F[^/]+/>'):gsub("<F",""):gsub("/>","")
- tfm.exec.addImage('dRKmgdP.png',"!2",cheese.t:match('X="[0-9]+"'):gsub("X=",""):gsub('"',""),cheese.t:match('Y="[0-9]+"'):gsub("Y=",""):gsub('"',""))
- end
- end
- end
- function eventNewGame()
- if tfm.get.room.xmlMapInfo then
- mapAuthor = tfm.get.room.xmlMapInfo.author
- if mapAuthor ~= '#Module' then
- parseXml()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement