Search in sources :

Example 1 with BodyMaterial

use of com.lilithsthrone.game.character.body.valueEnums.BodyMaterial in project liliths-throne-public by Innoxia.

the class Body method loadFromXML.

public static Body loadFromXML(StringBuilder log, Element parentElement, Document doc) {
    // **************** Core **************** //
    Element element = (Element) parentElement.getElementsByTagName("bodyCore").item(0);
    int importedFemininity = (Integer.valueOf(element.getAttribute("femininity")));
    CharacterUtils.appendToImportLog(log, "</br>Body: Set femininity: " + Integer.valueOf(element.getAttribute("femininity")));
    int importedHeight = (Integer.valueOf(element.getAttribute("height")));
    CharacterUtils.appendToImportLog(log, "</br>Body: Set height: " + Integer.valueOf(element.getAttribute("height")));
    int importedBodySize = (Integer.valueOf(element.getAttribute("bodySize")));
    CharacterUtils.appendToImportLog(log, "</br>Body: Set body size: " + Integer.valueOf(element.getAttribute("bodySize")));
    int importedMuscle = (Integer.valueOf(element.getAttribute("muscle")));
    CharacterUtils.appendToImportLog(log, "</br>Body: Set muscle: " + Integer.valueOf(element.getAttribute("muscle")));
    // TODO export
    GenitalArrangement importedGenitalArrangement = GenitalArrangement.NORMAL;
    if (element.getAttribute("genitalArrangement") != null && !element.getAttribute("genitalArrangement").isEmpty()) {
        importedGenitalArrangement = GenitalArrangement.valueOf(element.getAttribute("genitalArrangement"));
    }
    BodyMaterial importedBodyMaterial = BodyMaterial.FLESH;
    if (element.getAttribute("bodyMaterial") != null && !element.getAttribute("bodyMaterial").isEmpty()) {
        importedBodyMaterial = BodyMaterial.valueOf(element.getAttribute("bodyMaterial"));
    }
    // **************** Antenna **************** //
    Element antennae = (Element) parentElement.getElementsByTagName("antennae").item(0);
    Antenna importedAntenna = new Antenna(AntennaType.valueOf(antennae.getAttribute("type")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Antennae:" + "</br>type: " + importedAntenna.getType());
    importedAntenna.rows = Integer.valueOf(antennae.getAttribute("rows"));
    CharacterUtils.appendToImportLog(log, "</br>rows: " + importedAntenna.getAntennaRows());
    // **************** Arm **************** //
    Element arm = (Element) parentElement.getElementsByTagName("arm").item(0);
    Arm importedArm = new Arm(ArmType.valueOf(arm.getAttribute("type")), Integer.valueOf(arm.getAttribute("rows")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Arm:" + "</br>type: " + importedArm.getType());
    CharacterUtils.appendToImportLog(log, "</br>rows: " + importedArm.getArmRows());
    try {
        importedArm.underarmHair = BodyHair.valueOf(arm.getAttribute("underarmHair"));
        CharacterUtils.appendToImportLog(log, "</br>underarm hair: " + importedArm.getUnderarmHair());
    } catch (IllegalArgumentException e) {
        importedArm.underarmHair = BodyHair.ZERO_NONE;
        CharacterUtils.appendToImportLog(log, "</br>underarm hair: OLD_VALUE - Set to NONE");
    }
    // **************** Ass **************** //
    Element ass = (Element) parentElement.getElementsByTagName("ass").item(0);
    Element anus = (Element) parentElement.getElementsByTagName("anus").item(0);
    Ass importedAss = new Ass(AssType.valueOf(ass.getAttribute("type")), Integer.valueOf(ass.getAttribute("assSize")), Integer.valueOf(anus.getAttribute("wetness")), Float.valueOf(anus.getAttribute("capacity")), Integer.valueOf(anus.getAttribute("elasticity")), Integer.valueOf(anus.getAttribute("plasticity")), Boolean.valueOf(anus.getAttribute("virgin")));
    importedAss.hipSize = Integer.valueOf(ass.getAttribute("hipSize"));
    importedAss.anus.orificeAnus.stretchedCapacity = (Float.valueOf(anus.getAttribute("stretchedCapacity")));
    importedAss.anus.bleached = (Boolean.valueOf(anus.getAttribute("bleached")));
    try {
        importedAss.anus.assHair = (BodyHair.valueOf(anus.getAttribute("assHair")));
    } catch (IllegalArgumentException e) {
        importedAss.anus.assHair = BodyHair.ZERO_NONE;
        CharacterUtils.appendToImportLog(log, "</br>ass hair: OLD_VALUE - Set to NONE");
    }
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Ass:" + "</br>type: " + importedAss.getType() + "</br>assSize: " + importedAss.getAssSize() + "</br>hipSize: " + importedAss.getHipSize());
    if (anus != null) {
        CharacterUtils.appendToImportLog(log, "</br></br>Anus:" + "</br>wetness: " + importedAss.anus.orificeAnus.wetness + "</br>elasticity: " + importedAss.anus.orificeAnus.elasticity + "</br>elasticity: " + importedAss.anus.orificeAnus.plasticity + "</br>capacity: " + importedAss.anus.orificeAnus.capacity + "</br>stretchedCapacity: " + importedAss.anus.orificeAnus.stretchedCapacity + "</br>virgin: " + importedAss.anus.orificeAnus.virgin + "</br>bleached: " + importedAss.anus.bleached + "</br>assHair: " + importedAss.anus.assHair + "</br>Modifiers:");
        Element anusModifiers = (Element) anus.getElementsByTagName("anusModifiers").item(0);
        importedAss.anus.orificeAnus.orificeModifiers.clear();
        for (OrificeModifier om : OrificeModifier.values()) {
            if (Boolean.valueOf(anusModifiers.getAttribute(om.toString()))) {
                importedAss.anus.orificeAnus.orificeModifiers.add(om);
                CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":true");
            } else {
                CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":false");
            }
        }
    }
    // **************** Breasts **************** //
    Element breasts = (Element) parentElement.getElementsByTagName("breasts").item(0);
    Element nipples = (Element) parentElement.getElementsByTagName("nipples").item(0);
    BreastShape breastShape = BreastShape.ROUND;
    try {
        breastShape = BreastShape.valueOf(breasts.getAttribute("shape"));
    } catch (Exception e) {
    }
    int milkStorage = 0;
    try {
        if (!breasts.getAttribute("lactation").isEmpty()) {
            milkStorage = Integer.valueOf(breasts.getAttribute("lactation"));
        } else {
            milkStorage = Integer.valueOf(breasts.getAttribute("milkStorage"));
        }
    } catch (Exception ex) {
    }
    Breast importedBreast = new Breast(BreastType.valueOf(breasts.getAttribute("type")), breastShape, Integer.valueOf(breasts.getAttribute("size")), milkStorage, Integer.valueOf(breasts.getAttribute("rows")), Integer.valueOf(nipples.getAttribute("nippleSize")), NippleShape.valueOf(nipples.getAttribute("nippleShape")), Integer.valueOf(nipples.getAttribute("areolaeSize")), Integer.valueOf(breasts.getAttribute("nippleCountPerBreast")), Float.valueOf(nipples.getAttribute("capacity")), Integer.valueOf(nipples.getAttribute("elasticity")), Integer.valueOf(nipples.getAttribute("plasticity")), Boolean.valueOf(nipples.getAttribute("virgin")));
    try {
        importedBreast.milkStored = Integer.valueOf(breasts.getAttribute("storedMilk"));
        importedBreast.milkRegeneration = Integer.valueOf(breasts.getAttribute("milkRegeneration"));
    } catch (Exception ex) {
    }
    importedBreast.nipples.orificeNipples.stretchedCapacity = (Float.valueOf(nipples.getAttribute("stretchedCapacity")));
    importedBreast.nipples.pierced = (Boolean.valueOf(nipples.getAttribute("pierced")));
    importedBreast.nipples.areolaeShape = (AreolaeShape.valueOf(nipples.getAttribute("areolaeShape")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Breasts:" + "</br>type: " + importedBreast.getType() + "</br>size: " + importedBreast.getSize() + "</br>rows: " + importedBreast.getRows() + "</br>lactation: " + importedBreast.getRawMilkStorageValue() + "</br>nippleCountPer: " + importedBreast.getNippleCountPerBreast() + "</br></br>Nipples:" + "</br>elasticity: " + importedBreast.nipples.orificeNipples.getElasticity() + "</br>plasticity: " + importedBreast.nipples.orificeNipples.getPlasticity() + "</br>capacity: " + importedBreast.nipples.orificeNipples.getRawCapacityValue() + "</br>stretchedCapacity: " + importedBreast.nipples.orificeNipples.getStretchedCapacity() + "</br>virgin: " + importedBreast.nipples.orificeNipples.isVirgin() + "</br>pierced: " + importedBreast.nipples.isPierced() + "</br>nippleSize: " + importedBreast.nipples.getNippleSize() + "</br>nippleShape: " + importedBreast.nipples.getNippleShape() + "</br>areolaeSize: " + importedBreast.nipples.getAreolaeSize() + "</br>areolaeShape: " + importedBreast.nipples.getAreolaeShape() + "</br>Modifiers:");
    Element nippleModifiers = (Element) nipples.getElementsByTagName("nippleModifiers").item(0);
    importedBreast.nipples.orificeNipples.orificeModifiers.clear();
    for (OrificeModifier om : OrificeModifier.values()) {
        if (Boolean.valueOf(nippleModifiers.getAttribute(om.toString()))) {
            importedBreast.nipples.orificeNipples.orificeModifiers.add(om);
            CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":false");
        }
    }
    CharacterUtils.appendToImportLog(log, "</br></br>Milk:");
    Element milk = (Element) parentElement.getElementsByTagName("milk").item(0);
    importedBreast.milk.flavour = (FluidFlavour.valueOf(milk.getAttribute("flavour")));
    CharacterUtils.appendToImportLog(log, " flavour: " + importedBreast.milk.getFlavour() + "</br>Modifiers:");
    Element milkModifiers = (Element) milk.getElementsByTagName("milkModifiers").item(0);
    for (FluidModifier fm : FluidModifier.values()) {
        if (Boolean.valueOf(milkModifiers.getAttribute(fm.toString()))) {
            importedBreast.milk.fluidModifiers.add(fm);
            CharacterUtils.appendToImportLog(log, "</br>" + fm.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + fm.toString() + ":false");
        }
    }
    // **************** Ear **************** //
    Element ear = (Element) parentElement.getElementsByTagName("ear").item(0);
    Ear importedEar = new Ear(EarType.valueOf(ear.getAttribute("type")));
    importedEar.pierced = (Boolean.valueOf(ear.getAttribute("pierced")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Ear:" + "</br>type: " + importedEar.getType() + "</br>pierced: " + importedEar.isPierced());
    // **************** Eye **************** //
    Element eye = (Element) parentElement.getElementsByTagName("eye").item(0);
    String eyeTypeFromSave = eye.getAttribute("type");
    Map<String, String> eyeTypeConverterMap = new HashMap<>();
    eyeTypeConverterMap.put("EYE_HUMAN", "HUMAN");
    eyeTypeConverterMap.put("EYE_ANGEL", "ANGEL");
    eyeTypeConverterMap.put("EYE_DEMON_COMMON", "DEMON_COMMON");
    eyeTypeConverterMap.put("EYE_DOG_MORPH", "DOG_MORPH");
    eyeTypeConverterMap.put("EYE_LYCAN", "LYCAN");
    eyeTypeConverterMap.put("EYE_FELINE", "CAT_MORPH");
    eyeTypeConverterMap.put("EYE_SQUIRREL", "SQUIRREL_MORPH");
    eyeTypeConverterMap.put("EYE_HORSE_MORPH", "HORSE_MORPH");
    eyeTypeConverterMap.put("EYE_HARPY", "HARPY");
    eyeTypeConverterMap.put("EYE_SLIME", "SLIME");
    if (eyeTypeConverterMap.containsKey(eyeTypeFromSave)) {
        eyeTypeFromSave = eyeTypeConverterMap.get(eyeTypeFromSave);
    }
    Eye importedEye = new Eye(EyeType.valueOf(eyeTypeFromSave));
    importedEye.eyePairs = (Integer.valueOf(eye.getAttribute("eyePairs")));
    importedEye.irisShape = (EyeShape.valueOf(eye.getAttribute("irisShape")));
    importedEye.pupilShape = (EyeShape.valueOf(eye.getAttribute("pupilShape")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Eye:" + "</br>type: " + importedEye.getType() + "</br>pairs: " + importedEye.getEyePairs() + "</br>iris shape: " + importedEye.getIrisShape() + "</br>pupil shape: " + importedEye.getPupilShape());
    // **************** Face **************** //
    Element face = (Element) parentElement.getElementsByTagName("face").item(0);
    Element mouth = (Element) parentElement.getElementsByTagName("mouth").item(0);
    Face importedFace = new Face(FaceType.valueOf(face.getAttribute("type")), Integer.valueOf(mouth.getAttribute("lipSize")));
    importedFace.piercedNose = (Boolean.valueOf(face.getAttribute("piercedNose")));
    try {
        importedFace.facialHair = (BodyHair.valueOf(face.getAttribute("facialHair")));
    } catch (IllegalArgumentException e) {
        importedFace.facialHair = BodyHair.ZERO_NONE;
        CharacterUtils.appendToImportLog(log, "</br>facial hair: OLD_VALUE - Set to NONE");
    }
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Face: " + "</br>type: " + importedFace.getType() + "</br>piercedNose: " + importedFace.isPiercedNose() + "</br>facial hair: " + importedFace.getFacialHair() + "</br></br>Mouth: ");
    importedFace.mouth.orificeMouth.elasticity = (Integer.valueOf(mouth.getAttribute("elasticity")));
    importedFace.mouth.orificeMouth.plasticity = (Integer.valueOf(mouth.getAttribute("plasticity")));
    importedFace.mouth.orificeMouth.capacity = (Float.valueOf(mouth.getAttribute("capacity")));
    importedFace.mouth.orificeMouth.stretchedCapacity = (Float.valueOf(mouth.getAttribute("stretchedCapacity")));
    importedFace.mouth.orificeMouth.virgin = (Boolean.valueOf(mouth.getAttribute("virgin")));
    importedFace.mouth.piercedLip = (Boolean.valueOf(mouth.getAttribute("piercedLip")));
    CharacterUtils.appendToImportLog(log, "</br>elasticity: " + importedFace.mouth.orificeMouth.getElasticity() + "</br>plasticity: " + importedFace.mouth.orificeMouth.getPlasticity() + "</br>capacity: " + importedFace.mouth.orificeMouth.getCapacity() + "</br>stretchedCapacity: " + importedFace.mouth.orificeMouth.getStretchedCapacity() + "</br>virgin: " + importedFace.mouth.orificeMouth.isVirgin() + "</br>piercedLip: " + importedFace.mouth.isPiercedLip() + "</br>lipSize: " + importedFace.mouth.getLipSize() + "</br>Modifiers: ");
    Element mouthModifiers = (Element) mouth.getElementsByTagName("mouthModifiers").item(0);
    importedFace.mouth.orificeMouth.orificeModifiers.clear();
    for (OrificeModifier om : OrificeModifier.values()) {
        if (Boolean.valueOf(mouthModifiers.getAttribute(om.toString()))) {
            importedFace.mouth.orificeMouth.orificeModifiers.add(om);
            CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":false");
        }
    }
    Element tongue = (Element) parentElement.getElementsByTagName("tongue").item(0);
    importedFace.tongue.pierced = (Boolean.valueOf(tongue.getAttribute("piercedTongue")));
    importedFace.tongue.tongueLength = (Integer.valueOf(tongue.getAttribute("tongueLength")));
    CharacterUtils.appendToImportLog(log, "</br></br>Tongue: " + "</br>piercedTongue: " + importedFace.tongue.isPierced() + "</br>tongueLength: " + importedFace.tongue.getTongueLength() + "</br>Modifiers: ");
    Element tongueModifiers = (Element) tongue.getElementsByTagName("tongueModifiers").item(0);
    importedFace.tongue.tongueModifiers.clear();
    for (TongueModifier tm : TongueModifier.values()) {
        if (Boolean.valueOf(tongueModifiers.getAttribute(tm.toString()))) {
            importedFace.tongue.tongueModifiers.add(tm);
            CharacterUtils.appendToImportLog(log, "</br>" + tm.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + tm.toString() + ":false");
        }
    }
    // **************** Hair **************** //
    Element hair = (Element) parentElement.getElementsByTagName("hair").item(0);
    String hairTypeFromSave = hair.getAttribute("type");
    Map<String, String> hairTypeConverterMap = new HashMap<>();
    hairTypeConverterMap.put("HAIR_HUMAN", "HUMAN");
    hairTypeConverterMap.put("HAIR_ANGEL", "ANGEL");
    hairTypeConverterMap.put("HAIR_DEMON", "DEMON_COMMON");
    hairTypeConverterMap.put("HAIR_CANINE_FUR", "DOG_MORPH");
    hairTypeConverterMap.put("HAIR_LYCAN_FUR", "LYCAN");
    hairTypeConverterMap.put("HAIR_FELINE_FUR", "CAT_MORPH");
    hairTypeConverterMap.put("HAIR_HORSE_HAIR", "HORSE_MORPH");
    hairTypeConverterMap.put("HAIR_SQUIRREL_FUR", "SQUIRREL_MORPH");
    hairTypeConverterMap.put("SLIME", "SLIME");
    hairTypeConverterMap.put("HAIR_HARPY", "HARPY");
    if (hairTypeConverterMap.containsKey(hairTypeFromSave)) {
        hairTypeFromSave = hairTypeConverterMap.get(hairTypeFromSave);
    }
    Hair importedHair = new Hair(HairType.valueOf(hairTypeFromSave), Integer.valueOf(hair.getAttribute("length")), HairStyle.valueOf(hair.getAttribute("hairStyle")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Hair: " + "</br>type: " + importedHair.getType() + "</br>length: " + importedHair.getLength() + "</br>hairStyle: " + importedHair.getStyle());
    // **************** Horn **************** //
    Element horn = (Element) parentElement.getElementsByTagName("horn").item(0);
    Horn importedHorn = new Horn(HornType.NONE, 0);
    int rows = (Integer.valueOf(horn.getAttribute("rows")));
    String hornType = horn.getAttribute("type");
    if (hornType.equals("DEMON")) {
        hornType = "";
    }
    if (hornType.equals("BOVINE")) {
        hornType = "";
    }
    int length = 0;
    if (!hornType.equals("NONE")) {
        length = HornLength.TWO_LONG.getMedianValue();
    }
    if (!horn.getAttribute("length").isEmpty()) {
        try {
            length = Integer.valueOf(horn.getAttribute("length"));
        } catch (IllegalArgumentException e) {
        }
    }
    try {
        importedHorn = new Horn(HornType.valueOf(hornType), length);
        importedHorn.rows = rows;
        CharacterUtils.appendToImportLog(log, "</br></br>Body: Horn: " + "</br>type: " + importedHorn.getType() + "</br>length: " + length + "</br>rows: " + importedHorn.getHornRows());
    } catch (IllegalArgumentException e) {
        if (horn.getAttribute("type").startsWith("DEMON")) {
            importedHorn = new Horn(HornType.SWEPT_BACK, length);
            importedHorn.rows = rows;
        } else if (horn.getAttribute("type").startsWith("BOVINE")) {
            importedHorn = new Horn(HornType.CURVED, length);
            importedHorn.rows = rows;
        }
        CharacterUtils.appendToImportLog(log, "</br></br>Body: Horn: " + "</br>type NOT FOUND, defaulted to: " + importedHorn.getType() + "</br>rows: " + importedHorn.getHornRows());
    }
    // **************** Leg **************** //
    Element leg = (Element) parentElement.getElementsByTagName("leg").item(0);
    Leg importedLeg = new Leg(LegType.valueOf(leg.getAttribute("type")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Leg: " + "</br>type: " + importedLeg.getType());
    // **************** Penis **************** //
    Element penis = (Element) parentElement.getElementsByTagName("penis").item(0);
    Element testicles = (Element) parentElement.getElementsByTagName("testicles").item(0);
    int girth = 2;
    if (penis.getAttribute("girth") != null && !penis.getAttribute("girth").isEmpty()) {
        girth = Integer.valueOf(penis.getAttribute("girth"));
    }
    Penis importedPenis = new Penis(PenisType.valueOf(penis.getAttribute("type")), Integer.valueOf(penis.getAttribute("size")), girth, Integer.valueOf(testicles.getAttribute("testicleSize")), Integer.valueOf(testicles.getAttribute("cumProduction")), Integer.valueOf(testicles.getAttribute("numberOfTesticles")));
    importedPenis.pierced = (Boolean.valueOf(penis.getAttribute("pierced")));
    if (!penis.getAttribute("virgin").isEmpty()) {
        importedPenis.virgin = (Boolean.valueOf(penis.getAttribute("virgin")));
    }
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Penis: " + "</br>type: " + importedPenis.getType() + "</br>size: " + importedPenis.getRawSizeValue() + "</br>pierced: " + importedPenis.isPierced() + "</br>Penis Modifiers: ");
    Element penisModifiers = (Element) penis.getElementsByTagName("penisModifiers").item(0);
    importedPenis.penisModifiers.clear();
    for (PenisModifier pm : PenisModifier.values()) {
        if (penisModifiers != null && Boolean.valueOf(penisModifiers.getAttribute(pm.toString()))) {
            importedPenis.penisModifiers.add(pm);
            CharacterUtils.appendToImportLog(log, "</br>" + pm.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + pm.toString() + ":false");
        }
    }
    importedPenis.orificeUrethra.elasticity = (Integer.valueOf(penis.getAttribute("elasticity")));
    importedPenis.orificeUrethra.plasticity = (Integer.valueOf(penis.getAttribute("plasticity")));
    importedPenis.orificeUrethra.capacity = (Float.valueOf(penis.getAttribute("capacity")));
    importedPenis.orificeUrethra.stretchedCapacity = (Float.valueOf(penis.getAttribute("stretchedCapacity")));
    if (!penis.getAttribute("urethraVirgin").isEmpty()) {
        importedPenis.orificeUrethra.virgin = (Boolean.valueOf(penis.getAttribute("urethraVirgin")));
    } else {
        importedPenis.orificeUrethra.virgin = true;
    }
    CharacterUtils.appendToImportLog(log, "</br>elasticity: " + importedPenis.orificeUrethra.getElasticity() + "</br>plasticity: " + importedPenis.orificeUrethra.getPlasticity() + "</br>capacity: " + importedPenis.orificeUrethra.getCapacity() + "</br>stretchedCapacity: " + importedPenis.orificeUrethra.getStretchedCapacity() + "</br>virgin: " + importedPenis.orificeUrethra.isVirgin() + "</br>Urethra Modifiers:");
    Element urethraModifiers = (Element) penis.getElementsByTagName("urethraModifiers").item(0);
    importedPenis.orificeUrethra.orificeModifiers.clear();
    for (OrificeModifier om : OrificeModifier.values()) {
        if (Boolean.valueOf(urethraModifiers.getAttribute(om.toString()))) {
            importedPenis.orificeUrethra.orificeModifiers.add(om);
            CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":false");
        }
    }
    importedPenis.testicle.internal = (Boolean.valueOf(testicles.getAttribute("internal")));
    CharacterUtils.appendToImportLog(log, "</br></br>Testicles: " + "</br>cumProduction: " + importedPenis.testicle.getRawCumProductionValue() + "</br>numberOfTesticles: " + importedPenis.testicle.getTesticleCount() + "</br>testicleSize: " + importedPenis.testicle.getTesticleSize() + "</br>internal: " + importedPenis.testicle.isInternal());
    CharacterUtils.appendToImportLog(log, "</br></br>Cum:");
    Element cum = (Element) parentElement.getElementsByTagName("cum").item(0);
    importedPenis.testicle.cum.flavour = (FluidFlavour.valueOf(cum.getAttribute("flavour")));
    CharacterUtils.appendToImportLog(log, " flavour: " + importedPenis.testicle.cum.getFlavour() + "</br>Modifiers:");
    Element cumModifiers = (Element) cum.getElementsByTagName("cumModifiers").item(0);
    for (FluidModifier fm : FluidModifier.values()) {
        if (Boolean.valueOf(cumModifiers.getAttribute(fm.toString()))) {
            importedPenis.testicle.cum.fluidModifiers.add(fm);
            CharacterUtils.appendToImportLog(log, "</br>" + fm.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + fm.toString() + ":false");
        }
    }
    // **************** Skin **************** //
    Element skin = (Element) parentElement.getElementsByTagName("skin").item(0);
    String skinTypeFromSave = skin.getAttribute("type");
    Map<String, String> skinTypeConverterMap = new HashMap<>();
    skinTypeConverterMap.put("HUMAN", "HUMAN");
    skinTypeConverterMap.put("ANGEL", "ANGEL");
    skinTypeConverterMap.put("DEMON_COMMON", "DEMON_COMMON");
    skinTypeConverterMap.put("CANINE_FUR", "DOG_MORPH");
    skinTypeConverterMap.put("LYCAN_FUR", "LYCAN");
    skinTypeConverterMap.put("FELINE_FUR", "CAT_MORPH");
    skinTypeConverterMap.put("SQUIRREL_FUR", "SQUIRREL_MORPH");
    skinTypeConverterMap.put("HORSE_HAIR", "HORSE_MORPH");
    skinTypeConverterMap.put("SLIME", "SLIME");
    skinTypeConverterMap.put("FEATHERS", "HARPY");
    if (skinTypeConverterMap.containsKey(skinTypeFromSave)) {
        skinTypeFromSave = skinTypeConverterMap.get(skinTypeFromSave);
    }
    Skin importedSkin = new Skin(SkinType.valueOf(skinTypeFromSave));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Skin: " + "</br>type: " + importedSkin.getType());
    // **************** Tail **************** //
    Element tail = (Element) parentElement.getElementsByTagName("tail").item(0);
    Tail importedTail = new Tail(TailType.valueOf(tail.getAttribute("type")));
    importedTail.tailCount = (Integer.valueOf(tail.getAttribute("count")));
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Tail: " + "</br>type: " + importedTail.getType() + "</br>count: " + importedTail.getTailCount());
    // **************** Vagina **************** //
    Element vagina = (Element) parentElement.getElementsByTagName("vagina").item(0);
    Vagina importedVagina = new Vagina(VaginaType.valueOf(vagina.getAttribute("type")), (vagina.getAttribute("labiaSize").isEmpty() ? 1 : Integer.valueOf(vagina.getAttribute("labiaSize"))), Integer.valueOf(vagina.getAttribute("clitSize")), Integer.valueOf(vagina.getAttribute("wetness")), Float.valueOf(vagina.getAttribute("capacity")), Integer.valueOf(vagina.getAttribute("elasticity")), Integer.valueOf(vagina.getAttribute("plasticity")), Boolean.valueOf(vagina.getAttribute("virgin")));
    importedVagina.pierced = (Boolean.valueOf(vagina.getAttribute("pierced")));
    importedVagina.orificeVagina.stretchedCapacity = (Float.valueOf(vagina.getAttribute("stretchedCapacity")));
    try {
        importedVagina.orificeVagina.squirter = (Boolean.valueOf(vagina.getAttribute("squirter")));
    } catch (Exception ex) {
    }
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Vagina: " + "</br>type: " + importedVagina.getType() + "</br>clitSize: " + importedVagina.getClitorisSize() + "</br>pierced: " + importedVagina.isPierced() + "</br>wetness: " + importedVagina.orificeVagina.wetness + "</br>elasticity: " + importedVagina.orificeVagina.getElasticity() + "</br>plasticity: " + importedVagina.orificeVagina.getPlasticity() + "</br>capacity: " + importedVagina.orificeVagina.getCapacity() + "</br>stretchedCapacity: " + importedVagina.orificeVagina.getStretchedCapacity() + "</br>virgin: " + importedVagina.orificeVagina.isVirgin());
    Element vaginaModifiers = (Element) vagina.getElementsByTagName("vaginaModifiers").item(0);
    importedVagina.orificeVagina.orificeModifiers.clear();
    if (vaginaModifiers != null) {
        for (OrificeModifier om : OrificeModifier.values()) {
            if (Boolean.valueOf(vaginaModifiers.getAttribute(om.toString()))) {
                importedVagina.orificeVagina.orificeModifiers.add(om);
                CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":true");
            } else {
                CharacterUtils.appendToImportLog(log, "</br>" + om.toString() + ":false");
            }
        }
    }
    CharacterUtils.appendToImportLog(log, "</br></br>Girlcum:");
    Element girlcum = (Element) parentElement.getElementsByTagName("girlcum").item(0);
    importedVagina.girlcum.flavour = (FluidFlavour.valueOf(girlcum.getAttribute("flavour")));
    CharacterUtils.appendToImportLog(log, " flavour: " + importedVagina.girlcum.getFlavour() + "</br>Modifiers:");
    Element girlcumModifiers = (Element) girlcum.getElementsByTagName("girlcumModifiers").item(0);
    for (FluidModifier fm : FluidModifier.values()) {
        if (Boolean.valueOf(girlcumModifiers.getAttribute(fm.toString()))) {
            importedVagina.girlcum.fluidModifiers.add(fm);
            CharacterUtils.appendToImportLog(log, "</br>" + fm.toString() + ":true");
        } else {
            CharacterUtils.appendToImportLog(log, "</br>" + fm.toString() + ":false");
        }
    }
    // **************** Wing **************** //
    Element wing = (Element) parentElement.getElementsByTagName("wing").item(0);
    int wingSize = 0;
    if (!wing.getAttribute("size").isEmpty()) {
        wingSize = Integer.valueOf(wing.getAttribute("size"));
    }
    Wing importedWing = new Wing(WingType.valueOf(wing.getAttribute("type")), wingSize);
    CharacterUtils.appendToImportLog(log, "</br></br>Body: Wing: " + "</br>type: " + importedWing.getType() + "</br>" + "</br>size: " + importedWing.getSizeValue() + "</br>");
    Body body = new Body.BodyBuilder(importedArm, importedAss, importedBreast, importedFace, importedEye, importedEar, importedHair, importedLeg, importedSkin, importedBodyMaterial, importedGenitalArrangement, importedHeight, importedFemininity, importedBodySize, importedMuscle).vagina(importedVagina).penis(importedPenis).horn(importedHorn).antenna(importedAntenna).tail(importedTail).wing(importedWing).build();
    body.setPiercedStomach(Boolean.valueOf(element.getAttribute("piercedStomach")));
    CharacterUtils.appendToImportLog(log, "</br>Body: Set piercedStomach: " + Boolean.valueOf(element.getAttribute("piercedStomach")));
    if (element.getAttribute("pubicHair") != null && !element.getAttribute("pubicHair").isEmpty()) {
        try {
            body.setPubicHair(BodyHair.valueOf(element.getAttribute("pubicHair")));
            CharacterUtils.appendToImportLog(log, "</br>Body: Set pubicHair: " + body.getPubicHair());
        } catch (IllegalArgumentException e) {
            body.pubicHair = BodyHair.ZERO_NONE;
            CharacterUtils.appendToImportLog(log, "</br>pubic hair: OLD_VALUE - Set to NONE");
        }
    }
    for (int i = 0; i < element.getElementsByTagName("bodyCovering").getLength(); i++) {
        Element e = ((Element) element.getElementsByTagName("bodyCovering").item(i));
        String type = e.getAttribute("type");
        if (type.equals("HORN_COW") || type.equals("HORN_DEMON")) {
            type = "HORN";
        }
        try {
            String colourPrimary = e.getAttribute("colourPrimary");
            String colourSecondary = e.getAttribute("colourSecondary");
            if (type.startsWith("HAIR_")) {
                if (colourPrimary.equals("COVERING_TAN")) {
                    colourPrimary = "COVERING_DIRTY_BLONDE";
                }
                if (colourSecondary.equals("COVERING_TAN")) {
                    colourSecondary = "COVERING_DIRTY_BLONDE";
                }
            }
            if (e.getAttribute("modifier").isEmpty()) {
                body.setBodyCoveringForXMLImport(BodyCoveringType.valueOf(type), CoveringPattern.valueOf(e.getAttribute("pattern")), Colour.valueOf(colourPrimary), !e.getAttribute("glowPrimary").isEmpty() ? Boolean.valueOf(e.getAttribute("glowPrimary")) : false, Colour.valueOf(colourSecondary), !e.getAttribute("glowSecondary").isEmpty() ? Boolean.valueOf(e.getAttribute("glowSecondary")) : false);
            } else {
                BodyCoveringType coveringType = BodyCoveringType.valueOf(type);
                CoveringModifier modifier = CoveringModifier.valueOf(e.getAttribute("modifier"));
                body.setBodyCoveringForXMLImport(coveringType, CoveringPattern.valueOf(e.getAttribute("pattern")), coveringType.getNaturalModifiers().contains(modifier) || coveringType.getExtraModifiers().contains(modifier) ? modifier : coveringType.getNaturalModifiers().get(0), Colour.valueOf(colourPrimary), !e.getAttribute("glowPrimary").isEmpty() ? Boolean.valueOf(e.getAttribute("glowPrimary")) : false, Colour.valueOf(colourSecondary), !e.getAttribute("glowSecondary").isEmpty() ? Boolean.valueOf(e.getAttribute("glowSecondary")) : false);
            }
            if (!e.getAttribute("discovered").isEmpty() && Boolean.valueOf(e.getAttribute("discovered"))) {
                body.getBodyCoveringTypesDiscovered().add(BodyCoveringType.valueOf(type));
            }
            CharacterUtils.appendToImportLog(log, "</br>Body: Set bodyCovering: " + e.getAttribute("type") + " pattern:" + CoveringPattern.valueOf(e.getAttribute("pattern")) + " " + Colour.valueOf(e.getAttribute("colourPrimary")) + " glow:" + Boolean.valueOf(e.getAttribute("glowPrimary")) + " | " + Colour.valueOf(e.getAttribute("colourSecondary")) + " glow:" + Boolean.valueOf(e.getAttribute("glowSecondary")) + " (discovered: " + e.getAttribute("discovered") + ")");
        } catch (Exception ex) {
        }
    }
    body.calculateRace();
    return body;
}
Also used : HashMap(java.util.HashMap) CoveringModifier(com.lilithsthrone.game.character.body.valueEnums.CoveringModifier) Element(org.w3c.dom.Element) BodyCoveringType(com.lilithsthrone.game.character.body.types.BodyCoveringType) PenisModifier(com.lilithsthrone.game.character.body.valueEnums.PenisModifier) BodyHair(com.lilithsthrone.game.character.body.valueEnums.BodyHair) GenitalArrangement(com.lilithsthrone.game.character.body.valueEnums.GenitalArrangement) BodyMaterial(com.lilithsthrone.game.character.body.valueEnums.BodyMaterial) BreastShape(com.lilithsthrone.game.character.body.valueEnums.BreastShape) FluidModifier(com.lilithsthrone.game.character.body.valueEnums.FluidModifier) TongueModifier(com.lilithsthrone.game.character.body.valueEnums.TongueModifier) OrificeModifier(com.lilithsthrone.game.character.body.valueEnums.OrificeModifier)

Aggregations

BodyCoveringType (com.lilithsthrone.game.character.body.types.BodyCoveringType)1 BodyHair (com.lilithsthrone.game.character.body.valueEnums.BodyHair)1 BodyMaterial (com.lilithsthrone.game.character.body.valueEnums.BodyMaterial)1 BreastShape (com.lilithsthrone.game.character.body.valueEnums.BreastShape)1 CoveringModifier (com.lilithsthrone.game.character.body.valueEnums.CoveringModifier)1 FluidModifier (com.lilithsthrone.game.character.body.valueEnums.FluidModifier)1 GenitalArrangement (com.lilithsthrone.game.character.body.valueEnums.GenitalArrangement)1 OrificeModifier (com.lilithsthrone.game.character.body.valueEnums.OrificeModifier)1 PenisModifier (com.lilithsthrone.game.character.body.valueEnums.PenisModifier)1 TongueModifier (com.lilithsthrone.game.character.body.valueEnums.TongueModifier)1 HashMap (java.util.HashMap)1 Element (org.w3c.dom.Element)1