Figuredata parses correctly with whitespace now

This commit is contained in:
Beny 2020-10-15 13:40:43 +02:00
parent b7b81e8af9
commit 0d0f0d3373

View File

@ -1,5 +1,6 @@
package com.eu.habbo.habbohotel.users.clothingvalidation; package com.eu.habbo.habbohotel.users.clothingvalidation;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -57,55 +58,64 @@ public class Figuredata {
for(int i = 0; i < palettesList.getLength(); i++) { for(int i = 0; i < palettesList.getLength(); i++) {
Node nNode = palettesList.item(i); Node nNode = palettesList.item(i);
Element element = (Element)nNode; if(nNode.getNodeType() == Node.ELEMENT_NODE) {
int paletteId = Integer.parseInt(element.getAttribute("id")); Element element = (Element) nNode;
FiguredataPalette palette = new FiguredataPalette(paletteId); int paletteId = Integer.parseInt(element.getAttribute("id"));
FiguredataPalette palette = new FiguredataPalette(paletteId);
NodeList colorsList = nNode.getChildNodes(); NodeList colorsList = nNode.getChildNodes();
for(int ii = 0; ii < colorsList.getLength(); ii++) { for (int ii = 0; ii < colorsList.getLength(); ii++) {
Element colorElement = (Element)colorsList.item(ii); if(colorsList.item(ii).getNodeType() == Node.ELEMENT_NODE) {
FiguredataPaletteColor color = new FiguredataPaletteColor( Element colorElement = (Element) colorsList.item(ii);
Integer.parseInt(colorElement.getAttribute("id")), FiguredataPaletteColor color = new FiguredataPaletteColor(
Integer.parseInt(colorElement.getAttribute("index")), Integer.parseInt(colorElement.getAttribute("id")),
!colorElement.getAttribute("club").equals("0"), Integer.parseInt(colorElement.getAttribute("index")),
colorElement.getAttribute("selectable").equals("1"), !colorElement.getAttribute("club").equals("0"),
colorElement.getTextContent() colorElement.getAttribute("selectable").equals("1"),
); colorElement.getTextContent()
palette.addColor(color); );
palette.addColor(color);
}
}
palettes.put(palette.id, palette);
} }
palettes.put(palette.id, palette);
} }
for(int i = 0; i < settypesList.getLength(); i++) { for(int i = 0; i < settypesList.getLength(); i++) {
Node nNode = settypesList.item(i); Node nNode = settypesList.item(i);
Element element = (Element)nNode;
String type = element.getAttribute("type"); if(nNode.getNodeType() == Node.ELEMENT_NODE) {
int paletteId = Integer.parseInt(element.getAttribute("paletteid")); Element element = (Element) nNode;
boolean mandM0 = element.getAttribute("mand_m_0").equals("1");
boolean mandF0 = element.getAttribute("mand_f_0").equals("1");
boolean mandM1 = element.getAttribute("mand_m_1").equals("1");
boolean mandF1 = element.getAttribute("mand_f_1").equals("1");
FiguredataSettype settype = new FiguredataSettype(type, paletteId, mandM0, mandF0, mandM1, mandF1); String type = element.getAttribute("type");
int paletteId = Integer.parseInt(element.getAttribute("paletteid"));
boolean mandM0 = element.getAttribute("mand_m_0").equals("1");
boolean mandF0 = element.getAttribute("mand_f_0").equals("1");
boolean mandM1 = element.getAttribute("mand_m_1").equals("1");
boolean mandF1 = element.getAttribute("mand_f_1").equals("1");
NodeList setsList = nNode.getChildNodes(); FiguredataSettype settype = new FiguredataSettype(type, paletteId, mandM0, mandF0, mandM1, mandF1);
for(int ii = 0; ii < setsList.getLength(); ii++) {
Element setElement = (Element)setsList.item(ii); NodeList setsList = nNode.getChildNodes();
FiguredataSettypeSet set = new FiguredataSettypeSet( for (int ii = 0; ii < setsList.getLength(); ii++) {
Integer.parseInt(setElement.getAttribute("id")), if(setsList.item(ii).getNodeType() == Node.ELEMENT_NODE) {
setElement.getAttribute("gender"), Element setElement = (Element) setsList.item(ii);
!setElement.getAttribute("club").equals("0"), FiguredataSettypeSet set = new FiguredataSettypeSet(
setElement.getAttribute("colorable").equals("1"), Integer.parseInt(setElement.getAttribute("id")),
setElement.getAttribute("selectable").equals("1"), setElement.getAttribute("gender"),
setElement.getAttribute("preselectable").equals("1"), !setElement.getAttribute("club").equals("0"),
setElement.getAttribute("sellable").equals("1") setElement.getAttribute("colorable").equals("1"),
); setElement.getAttribute("selectable").equals("1"),
settype.addSet(set); setElement.getAttribute("preselectable").equals("1"),
setElement.getAttribute("sellable").equals("1")
);
settype.addSet(set);
}
}
settypes.put(settype.type, settype);
} }
settypes.put(settype.type, settype);
} }
} }