Search in sources :

Example 6 with SexType

use of com.lilithsthrone.game.sex.SexType in project liliths-throne-public by Innoxia.

the class GameCharacter method saveAsXML.

@Override
public Element saveAsXML(Element parentElement, Document doc) {
    Element properties = doc.createElement("character");
    parentElement.appendChild(properties);
    // ************** Core information **************//
    Element characterCoreInfo = doc.createElement("core");
    Comment comment = doc.createComment("If you want to edit any of these values, just be warned that it might break the game...");
    properties.appendChild(characterCoreInfo);
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "id", this.getId());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "pathName", this.getClass().getCanonicalName());
    Element name = doc.createElement("name");
    characterCoreInfo.appendChild(name);
    CharacterUtils.addAttribute(doc, name, "nameFeminine", this.getNameTriplet().getFeminine());
    CharacterUtils.addAttribute(doc, name, "nameAndrogynous", this.getNameTriplet().getAndrogynous());
    CharacterUtils.addAttribute(doc, name, "nameMasculine", this.getNameTriplet().getMasculine());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "surname", this.getSurname());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "description", this.getDescription());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "playerPetName", playerPetName);
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "playerKnowsName", String.valueOf(this.isPlayerKnowsName()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "level", String.valueOf(this.getTrueLevel()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "version", Main.VERSION_NUMBER);
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "history", this.getHistory().toString());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "personality", this.getPersonality().toString());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "sexualOrientation", this.getSexualOrientation().toString());
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "obedience", String.valueOf(this.getObedienceValue()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "genderIdentity", String.valueOf(this.getGenderIdentity()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "experience", String.valueOf(this.getExperience()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "perkPoints", String.valueOf(this.getPerkPoints()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "health", String.valueOf(this.getHealth()));
    CharacterUtils.createXMLElementWithValue(doc, characterCoreInfo, "mana", String.valueOf(this.getMana()));
    // Knows area map:
    Element characterPlayerKnowsAreas = doc.createElement("playerKnowsAreas");
    characterCoreInfo.appendChild(characterPlayerKnowsAreas);
    for (CoverableArea area : getPlayerKnowsAreas()) {
        Element element = doc.createElement("area");
        characterPlayerKnowsAreas.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", area.toString());
    }
    characterCoreInfo.getParentNode().insertBefore(comment, characterCoreInfo);
    // ************** Location Information **************//
    Element locationInformation = doc.createElement("locationInformation");
    properties.appendChild(locationInformation);
    CharacterUtils.createXMLElementWithValue(doc, locationInformation, "worldLocation", this.getWorldLocation().toString());
    CharacterUtils.createXMLElementWithValue(doc, locationInformation, "homeWorldLocation", this.getHomeWorldLocation().toString());
    Element location = doc.createElement("location");
    locationInformation.appendChild(location);
    CharacterUtils.addAttribute(doc, location, "x", String.valueOf(this.getLocation().getX()));
    CharacterUtils.addAttribute(doc, location, "y", String.valueOf(this.getLocation().getY()));
    location = doc.createElement("homeLocation");
    locationInformation.appendChild(location);
    CharacterUtils.addAttribute(doc, location, "x", String.valueOf(this.getHomeLocation().getX()));
    CharacterUtils.addAttribute(doc, location, "y", String.valueOf(this.getHomeLocation().getY()));
    // ************** Body **************//
    Element characterBody = doc.createElement("body");
    properties.appendChild(characterBody);
    this.body.saveAsXML(characterBody, doc);
    // ************** Inventory **************//
    this.inventory.saveAsXML(properties, doc);
    // ************** Attributes **************//
    // Attributes:
    Element characterCoreAttributes = doc.createElement("attributes");
    properties.appendChild(characterCoreAttributes);
    for (Attribute att : Attribute.values()) {
        if (this.getBaseAttributeValue(att) != att.getBaseValue()) {
            Element element = doc.createElement("attribute");
            characterCoreAttributes.appendChild(element);
            CharacterUtils.addAttribute(doc, element, "type", att.toString());
            CharacterUtils.addAttribute(doc, element, "value", String.valueOf(this.getBaseAttributeValue(att)));
        }
    }
    Element characterPotionAttributes = doc.createElement("potionAttributes");
    properties.appendChild(characterPotionAttributes);
    for (Entry<Attribute, Float> entry : getPotionAttributes().entrySet()) {
        Element element = doc.createElement("attribute");
        characterPotionAttributes.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, element, "value", String.valueOf(entry.getValue()));
    }
    // Perks:
    Element characterEquippedPerks = doc.createElement("traits");
    properties.appendChild(characterEquippedPerks);
    for (Perk p : this.getTraits()) {
        Element element = doc.createElement("perk");
        characterEquippedPerks.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", p.toString());
    }
    Element characterPerks = doc.createElement("perks");
    properties.appendChild(characterPerks);
    for (Entry<Integer, Set<Perk>> p : this.getPerksMap().entrySet()) {
        for (Perk perk : p.getValue()) {
            Element element = doc.createElement("perk");
            characterPerks.appendChild(element);
            CharacterUtils.addAttribute(doc, element, "row", p.getKey().toString());
            CharacterUtils.addAttribute(doc, element, "type", perk.toString());
        }
    }
    // Fetishes:
    Element characterFetishes = doc.createElement("fetishes");
    properties.appendChild(characterFetishes);
    for (Fetish f : this.getFetishes()) {
        Element element = doc.createElement("fetish");
        characterFetishes.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", f.toString());
    }
    Element fetishDesire = doc.createElement("fetishDesire");
    properties.appendChild(fetishDesire);
    for (Entry<Fetish, FetishDesire> entry : this.getFetishDesireMap().entrySet()) {
        Element fondenessEntry = doc.createElement("entry");
        fetishDesire.appendChild(fondenessEntry);
        CharacterUtils.addAttribute(doc, fondenessEntry, "fetish", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, fondenessEntry, "desire", entry.getValue().toString());
    }
    Element fetishExperience = doc.createElement("fetishExperience");
    properties.appendChild(fetishExperience);
    for (Entry<Fetish, Integer> entry : this.getFetishExperienceMap().entrySet()) {
        Element expEntry = doc.createElement("entry");
        fetishExperience.appendChild(expEntry);
        CharacterUtils.addAttribute(doc, expEntry, "fetish", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, expEntry, "experience", String.valueOf(entry.getValue()));
    }
    // Status effects:
    Element characterStatusEffects = doc.createElement("statusEffects");
    properties.appendChild(characterStatusEffects);
    for (StatusEffect se : this.getStatusEffects()) {
        Element element = doc.createElement("statusEffect");
        characterStatusEffects.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", se.toString());
        CharacterUtils.addAttribute(doc, element, "value", String.valueOf(this.getStatusEffectDuration(se)));
    }
    // ************** Relationships **************//
    Element characterRelationships = doc.createElement("characterRelationships");
    properties.appendChild(characterRelationships);
    for (Entry<String, Float> entry : this.getAffectionMap().entrySet()) {
        Element relationship = doc.createElement("relationship");
        characterRelationships.appendChild(relationship);
        CharacterUtils.addAttribute(doc, relationship, "character", entry.getKey());
        CharacterUtils.addAttribute(doc, relationship, "value", String.valueOf(entry.getValue()));
    }
    // ************** Pregnancy **************//
    // Pregnancy:
    Element characterPregnancy = doc.createElement("pregnancy");
    properties.appendChild(characterPregnancy);
    CharacterUtils.addAttribute(doc, characterPregnancy, "timeProgressedToFinalPregnancyStage", String.valueOf(this.getTimeProgressedToFinalPregnancyStage()));
    Element characterPotentialPartnersAsMother = doc.createElement("potentialPartnersAsMother");
    characterPregnancy.appendChild(characterPotentialPartnersAsMother);
    for (PregnancyPossibility pregPoss : this.getPotentialPartnersAsMother()) {
        pregPoss.saveAsXML(characterPotentialPartnersAsMother, doc);
    }
    Element characterPotentialPartnersAsFather = doc.createElement("potentialPartnersAsFather");
    characterPregnancy.appendChild(characterPotentialPartnersAsFather);
    for (PregnancyPossibility pregPoss : this.getPotentialPartnersAsFather()) {
        pregPoss.saveAsXML(characterPotentialPartnersAsFather, doc);
    }
    Element characterPregnancyCurrentLitter = doc.createElement("pregnantLitter");
    characterPregnancy.appendChild(characterPregnancyCurrentLitter);
    if (this.getPregnantLitter() != null) {
        this.getPregnantLitter().saveAsXML(characterPregnancyCurrentLitter, doc);
    }
    Element characterPregnancyBirthedLitters = doc.createElement("birthedLitters");
    characterPregnancy.appendChild(characterPregnancyBirthedLitters);
    for (Litter litter : this.getLittersBirthed()) {
        litter.saveAsXML(characterPregnancyBirthedLitters, doc);
    }
    Element characterPregnancyLittersFathered = doc.createElement("littersFathered");
    characterPregnancy.appendChild(characterPregnancyLittersFathered);
    for (Litter litter : this.getLittersFathered()) {
        litter.saveAsXML(characterPregnancyLittersFathered, doc);
    }
    // ************** Family **************//
    Element characterFamily = doc.createElement("family");
    properties.appendChild(characterFamily);
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "motherId", this.getMotherId());
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "fatherId", this.getFatherId());
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "dayOfConception", String.valueOf(this.getDayOfConception()));
    CharacterUtils.createXMLElementWithValue(doc, characterFamily, "dayOfBirth", String.valueOf(this.getDayOfBirth()));
    // ************** Slavery **************//
    Element slaveryElement = doc.createElement("slavery");
    properties.appendChild(slaveryElement);
    Element slavesOwned = doc.createElement("slavesOwned");
    slaveryElement.appendChild(slavesOwned);
    for (String slave : this.getSlavesOwned()) {
        Element element = doc.createElement("slave");
        slavesOwned.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "id", slave);
    }
    CharacterUtils.createXMLElementWithValue(doc, slaveryElement, "owner", this.getOwner() == null ? "" : this.getOwner().getId());
    CharacterUtils.createXMLElementWithValue(doc, slaveryElement, "slaveJob", this.getSlaveJob().toString());
    Element slaveJobSettings = doc.createElement("slaveJobSettings");
    slaveryElement.appendChild(slaveJobSettings);
    for (SlaveJobSetting setting : this.getSlaveJobSettings()) {
        Element element = doc.createElement("setting");
        slaveJobSettings.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "value", setting.toString());
    }
    Element slavePermissionSettings = doc.createElement("slavePermissionSettings");
    slaveryElement.appendChild(slavePermissionSettings);
    for (Entry<SlavePermission, Set<SlavePermissionSetting>> entry : this.getSlavePermissionSettings().entrySet()) {
        Element element = doc.createElement("permission");
        slavePermissionSettings.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "type", entry.getKey().toString());
        for (SlavePermissionSetting setting : entry.getValue()) {
            Element settingElement = doc.createElement("setting");
            element.appendChild(settingElement);
            CharacterUtils.addAttribute(doc, settingElement, "value", setting.toString());
        }
    }
    Element slaveWorkHours = doc.createElement("slaveWorkHours");
    slaveryElement.appendChild(slaveWorkHours);
    for (int i = 0; i < workHours.length; i++) {
        CharacterUtils.addAttribute(doc, slaveWorkHours, "hour" + String.valueOf(i), String.valueOf(workHours[i]));
    }
    // ************** Sex Stats **************//
    Element characterSexStats = doc.createElement("sexStats");
    properties.appendChild(characterSexStats);
    Element characterCummedInAreas = doc.createElement("cummedInAreas");
    characterSexStats.appendChild(characterCummedInAreas);
    for (OrificeType orifice : OrificeType.values()) {
        Element element = doc.createElement("entry");
        characterCummedInAreas.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "orifice", orifice.toString());
        CharacterUtils.addAttribute(doc, element, "cumQuantity", String.valueOf(this.getCummedInAreaMap().get(orifice)));
    }
    CharacterUtils.createXMLElementWithValue(doc, characterSexStats, "sexConsensualCount", String.valueOf(this.getSexConsensualCount()));
    CharacterUtils.createXMLElementWithValue(doc, characterSexStats, "sexAsSubCount", String.valueOf(this.getSexAsSubCount()));
    CharacterUtils.createXMLElementWithValue(doc, characterSexStats, "sexAsDomCount", String.valueOf(this.getSexAsDomCount()));
    Element characterCumCount = doc.createElement("cumCounts");
    characterSexStats.appendChild(characterCumCount);
    for (SexParticipantType participant : SexParticipantType.values()) {
        for (PenetrationType pt : PenetrationType.values()) {
            for (OrificeType ot : OrificeType.values()) {
                if (this.getCumCount(new SexType(participant, pt, ot)) > 0) {
                    Element element = doc.createElement("cumCount");
                    characterCumCount.appendChild(element);
                    CharacterUtils.addAttribute(doc, element, "participantType", participant.toString());
                    CharacterUtils.addAttribute(doc, element, "penetrationType", pt.toString());
                    CharacterUtils.addAttribute(doc, element, "orificeType", ot.toString());
                    CharacterUtils.addAttribute(doc, element, "count", String.valueOf(this.getCumCount(new SexType(participant, pt, ot))));
                }
            }
        }
    }
    Element characterSexCount = doc.createElement("sexCounts");
    characterSexStats.appendChild(characterSexCount);
    for (SexParticipantType participant : SexParticipantType.values()) {
        for (PenetrationType pt : PenetrationType.values()) {
            for (OrificeType ot : OrificeType.values()) {
                if (this.getSexCount(new SexType(participant, pt, ot)) > 0) {
                    Element element = doc.createElement("sexCount");
                    characterSexCount.appendChild(element);
                    CharacterUtils.addAttribute(doc, element, "participantType", participant.toString());
                    CharacterUtils.addAttribute(doc, element, "penetrationType", pt.toString());
                    CharacterUtils.addAttribute(doc, element, "orificeType", ot.toString());
                    CharacterUtils.addAttribute(doc, element, "count", String.valueOf(this.getSexCount(new SexType(participant, pt, ot))));
                }
            }
        }
    }
    Element characterVirginityTakenBy = doc.createElement("virginityTakenBy");
    characterSexStats.appendChild(characterVirginityTakenBy);
    for (SexParticipantType participant : SexParticipantType.values()) {
        for (PenetrationType pt : PenetrationType.values()) {
            for (OrificeType ot : OrificeType.values()) {
                if (this.getVirginityLoss(new SexType(participant, pt, ot)) != null && !this.getVirginityLoss(new SexType(participant, pt, ot)).isEmpty()) {
                    Element element = doc.createElement("virginity");
                    characterVirginityTakenBy.appendChild(element);
                    CharacterUtils.addAttribute(doc, element, "participantType", participant.toString());
                    CharacterUtils.addAttribute(doc, element, "penetrationType", pt.toString());
                    CharacterUtils.addAttribute(doc, element, "orificeType", ot.toString());
                    CharacterUtils.addAttribute(doc, element, "takenBy", String.valueOf(this.getVirginityLoss(new SexType(participant, pt, ot))));
                }
            }
        }
    }
    Element sexPartnerMapElement = doc.createElement("sexPartnerMap");
    characterSexStats.appendChild(sexPartnerMapElement);
    for (String s : sexPartnerMap.keySet()) {
        Element element = doc.createElement("id");
        sexPartnerMapElement.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "value", s);
        for (Entry<SexType, Integer> entry : sexPartnerMap.get(s).entrySet()) {
            Element entryElement = doc.createElement("entry");
            element.appendChild(entryElement);
            CharacterUtils.addAttribute(doc, entryElement, "participantType", entry.getKey().getAsParticipant().toString());
            CharacterUtils.addAttribute(doc, entryElement, "penetrationType", entry.getKey().getPenetrationType().toString());
            CharacterUtils.addAttribute(doc, entryElement, "orificeType", entry.getKey().getOrificeType().toString());
            CharacterUtils.addAttribute(doc, entryElement, "count", String.valueOf(entry.getValue()));
        }
    }
    // ************** Fluids **************//
    Element characterAddictionsCore = doc.createElement("addictionsCore");
    properties.appendChild(characterAddictionsCore);
    CharacterUtils.addAttribute(doc, characterAddictionsCore, "alcoholLevel", String.valueOf(alcoholLevel));
    Element characterAddictions = doc.createElement("addictions");
    characterAddictionsCore.appendChild(characterAddictions);
    for (Addiction add : addictions) {
        add.saveAsXML(characterAddictions, doc);
    }
    Element psychoactives = doc.createElement("psychoactiveFluids");
    characterAddictionsCore.appendChild(psychoactives);
    for (FluidType ft : this.getPsychoactiveFluidsIngested()) {
        Element element = doc.createElement("fluid");
        psychoactives.appendChild(element);
        CharacterUtils.addAttribute(doc, element, "value", ft.toString());
    }
    return properties;
}
Also used : FluidType(com.lilithsthrone.game.character.body.types.FluidType) SlaveJobSetting(com.lilithsthrone.game.slavery.SlaveJobSetting) CoverableArea(com.lilithsthrone.game.character.body.CoverableArea) EnumSet(java.util.EnumSet) Set(java.util.Set) HashSet(java.util.HashSet) ClothingSet(com.lilithsthrone.game.inventory.clothing.ClothingSet) Attribute(com.lilithsthrone.game.character.attributes.Attribute) Element(org.w3c.dom.Element) SlavePermission(com.lilithsthrone.game.slavery.SlavePermission) PenetrationType(com.lilithsthrone.game.sex.PenetrationType) SexParticipantType(com.lilithsthrone.game.sex.SexParticipantType) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) Comment(org.w3c.dom.Comment) SexType(com.lilithsthrone.game.sex.SexType) OrificeType(com.lilithsthrone.game.sex.OrificeType) Perk(com.lilithsthrone.game.character.effects.Perk) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) SlavePermissionSetting(com.lilithsthrone.game.slavery.SlavePermissionSetting) Addiction(com.lilithsthrone.game.character.effects.Addiction) FetishDesire(com.lilithsthrone.game.character.fetishes.FetishDesire)

Example 7 with SexType

use of com.lilithsthrone.game.sex.SexType in project liliths-throne-public by Innoxia.

the class GameCharacter method loadGameCharacterVariablesFromXML.

public static void loadGameCharacterVariablesFromXML(GameCharacter character, StringBuilder log, Element parentElement, Document doc, CharacterImportSetting... settings) {
    boolean noPregnancy = Arrays.asList(settings).contains(CharacterImportSetting.NO_PREGNANCY);
    // ************** Core information **************//
    NodeList nodes = parentElement.getElementsByTagName("core");
    Element element = (Element) nodes.item(0);
    String version = "";
    if (element.getElementsByTagName("version").item(0) != null) {
        version = ((Element) element.getElementsByTagName("version").item(0)).getAttribute("value");
    }
    if (((Element) element.getElementsByTagName("id").item(0)) != null) {
        character.setId(((Element) element.getElementsByTagName("id").item(0)).getAttribute("value"));
        CharacterUtils.appendToImportLog(log, "</br>Set id: " + character.getId());
    }
    // Name:
    if (!((Element) element.getElementsByTagName("name").item(0)).getAttribute("value").isEmpty()) {
        character.setName(new NameTriplet(((Element) element.getElementsByTagName("name").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set name: " + ((Element) element.getElementsByTagName("name").item(0)).getAttribute("value"));
    } else {
        Element nameElement = ((Element) element.getElementsByTagName("name").item(0));
        character.setName(new NameTriplet(nameElement.getAttribute("nameMasculine"), nameElement.getAttribute("nameAndrogynous"), nameElement.getAttribute("nameFeminine")));
    }
    // Surname:
    if (element.getElementsByTagName("surname") != null && element.getElementsByTagName("surname").getLength() > 0) {
        character.setSurname(((Element) element.getElementsByTagName("surname").item(0)).getAttribute("value"));
        CharacterUtils.appendToImportLog(log, "</br>Set surname: " + ((Element) element.getElementsByTagName("surname").item(0)).getAttribute("value"));
    }
    // Level:
    character.setLevel(Integer.valueOf(((Element) element.getElementsByTagName("level").item(0)).getAttribute("value")));
    CharacterUtils.appendToImportLog(log, "</br>Set level: " + Integer.valueOf(((Element) element.getElementsByTagName("level").item(0)).getAttribute("value")));
    // Sexual Orientation:
    if (element.getElementsByTagName("sexualOrientation").getLength() != 0) {
        if (!((Element) element.getElementsByTagName("sexualOrientation").item(0)).getAttribute("value").equals("null")) {
            character.setSexualOrientation(SexualOrientation.valueOf(((Element) element.getElementsByTagName("sexualOrientation").item(0)).getAttribute("value")));
            CharacterUtils.appendToImportLog(log, "</br>Set Sexual Orientation: " + SexualOrientation.valueOf(((Element) element.getElementsByTagName("sexualOrientation").item(0)).getAttribute("value")));
        } else {
            character.setSexualOrientation(SexualOrientation.AMBIPHILIC);
            CharacterUtils.appendToImportLog(log, "</br>Set Sexual Orientation: " + SexualOrientation.AMBIPHILIC);
        }
    }
    if (element.getElementsByTagName("description").getLength() != 0) {
        character.setDescription(((Element) element.getElementsByTagName("description").item(0)).getAttribute("value"));
        CharacterUtils.appendToImportLog(log, "</br>Set description");
    }
    if (element.getElementsByTagName("playerPetName").getLength() != 0) {
        String petName = ((Element) element.getElementsByTagName("playerPetName").item(0)).getAttribute("value");
        character.setPlayerPetName(petName);
        CharacterUtils.appendToImportLog(log, "</br>Set playerPetName: " + petName);
    }
    if (element.getElementsByTagName("playerKnowsName").getLength() != 0) {
        character.setPlayerKnowsName(Boolean.valueOf(((Element) element.getElementsByTagName("playerKnowsName").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set playerKnowsName: " + character.isPlayerKnowsName());
    }
    if (element.getElementsByTagName("history").getLength() != 0) {
        try {
            character.setHistory(History.valueOf(((Element) element.getElementsByTagName("history").item(0)).getAttribute("value")));
            CharacterUtils.appendToImportLog(log, "</br>Set history: " + character.getHistory());
        } catch (Exception ex) {
            character.setHistory(History.STUDENT);
            CharacterUtils.appendToImportLog(log, "</br>History import failed. Set history to: " + character.getHistory());
        }
    }
    if (element.getElementsByTagName("personality").getLength() != 0) {
        String personality = ((Element) element.getElementsByTagName("personality").item(0)).getAttribute("value");
        if (personality.equals("AIR_SOCIALABLE")) {
            personality = "AIR_SOCIABLE";
        }
        character.setPersonality(Personality.valueOf(personality));
        CharacterUtils.appendToImportLog(log, "</br>Set personality: " + character.getPersonality());
    }
    if (element.getElementsByTagName("obedience").getLength() != 0) {
        character.setObedience(Float.valueOf(((Element) element.getElementsByTagName("obedience").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set obedience: " + character.getObedience());
    }
    boolean setGenderIdentity = false;
    if (element.getElementsByTagName("genderIdentity").getLength() != 0) {
        try {
            if (!((Element) element.getElementsByTagName("genderIdentity").item(0)).getAttribute("value").equals("null")) {
                character.setGenderIdentity(Gender.valueOf(((Element) element.getElementsByTagName("genderIdentity").item(0)).getAttribute("value")));
                CharacterUtils.appendToImportLog(log, "</br>Set genderIdentity: " + character.getGenderIdentity());
                setGenderIdentity = true;
            }
        } catch (Exception ex) {
        }
    }
    int extraLevelUpPoints = 0;
    // If there is a version number, attributes should be working correctly:
    if (element.getElementsByTagName("version").item(0) != null) {
        nodes = parentElement.getElementsByTagName("attributes");
        Element attElement = (Element) nodes.item(0);
        for (int i = 0; i < attElement.getElementsByTagName("attribute").getLength(); i++) {
            Element e = ((Element) attElement.getElementsByTagName("attribute").item(i));
            try {
                if (e.getAttribute("type").equals("CORRUPTION")) {
                    character.setAttribute(Attribute.MAJOR_CORRUPTION, Float.valueOf(e.getAttribute("value")), false);
                } else if (e.getAttribute("type").equals("STRENGTH") || e.getAttribute("type").equals("MAJOR_STRENGTH")) {
                    character.setAttribute(Attribute.MAJOR_PHYSIQUE, Float.valueOf(e.getAttribute("value")), false);
                } else {
                    if (!version.isEmpty() && Main.isVersionOlderThan(version, "0.2.0")) {
                        Attribute att = Attribute.valueOf(e.getAttribute("type"));
                        switch(att) {
                            case DAMAGE_FIRE:
                            case DAMAGE_ICE:
                            case DAMAGE_LUST:
                            case DAMAGE_PHYSICAL:
                            case DAMAGE_POISON:
                            case DAMAGE_SPELLS:
                                character.setAttribute(att, Float.valueOf(e.getAttribute("value")) - 100, false);
                                break;
                            default:
                                character.setAttribute(att, Float.valueOf(e.getAttribute("value")), false);
                                break;
                        }
                    } else {
                        character.setAttribute(Attribute.valueOf(e.getAttribute("type")), Float.valueOf(e.getAttribute("value")), false);
                    }
                }
                CharacterUtils.appendToImportLog(log, "</br>Set Attribute: " + Attribute.valueOf(e.getAttribute("type")).getName() + " to " + Float.valueOf(e.getAttribute("value")));
            } catch (IllegalArgumentException ex) {
            }
        }
    } else {
        extraLevelUpPoints = (Integer.valueOf(((Element) element.getElementsByTagName("level").item(0)).getAttribute("value")) * 5);
        CharacterUtils.appendToImportLog(log, "</br>Old character version. Extra LevelUpPoints set to: " + (Integer.valueOf(((Element) element.getElementsByTagName("level").item(0)).getAttribute("value")) * 5));
    }
    if (element.getElementsByTagName("health").getLength() != 0) {
        character.setHealth(Float.valueOf(((Element) element.getElementsByTagName("health").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set health: " + character.getHealth());
    }
    if (element.getElementsByTagName("mana").getLength() != 0) {
        character.setMana(Float.valueOf(((Element) element.getElementsByTagName("mana").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set mana: " + character.getMana());
    }
    nodes = parentElement.getElementsByTagName("playerKnowsAreas");
    Element knowsElement = (Element) nodes.item(0);
    if (knowsElement != null) {
        for (int i = 0; i < knowsElement.getElementsByTagName("area").getLength(); i++) {
            Element e = ((Element) knowsElement.getElementsByTagName("area").item(i));
            try {
                character.getPlayerKnowsAreas().add(CoverableArea.valueOf(e.getAttribute("type")));
                CharacterUtils.appendToImportLog(log, "</br>Added knows area: " + CoverableArea.valueOf(e.getAttribute("type")).getName());
            } catch (IllegalArgumentException ex) {
            }
        }
    }
    nodes = parentElement.getElementsByTagName("playerCore");
    if (nodes.getLength() > 0) {
        // Old version support:
        character.setPerkPoints((Integer.valueOf(((Element) element.getElementsByTagName("level").item(0)).getAttribute("value"))) - 1);
        CharacterUtils.appendToImportLog(log, "</br>Set perkPoints: (TEMP FIX) " + (Integer.valueOf(((Element) element.getElementsByTagName("level").item(0)).getAttribute("value")) - 1));
        element = (Element) nodes.item(0);
        character.incrementExperience(Integer.valueOf(((Element) element.getElementsByTagName("experience").item(0)).getAttribute("value")), false);
        CharacterUtils.appendToImportLog(log, "</br>Set experience: " + Integer.valueOf(((Element) element.getElementsByTagName("experience").item(0)).getAttribute("value")));
    } else {
        character.incrementExperience(Integer.valueOf(((Element) element.getElementsByTagName("experience").item(0)).getAttribute("value")), false);
        CharacterUtils.appendToImportLog(log, "</br>Set experience: " + Integer.valueOf(((Element) element.getElementsByTagName("experience").item(0)).getAttribute("value")));
        try {
            character.setPerkPoints(Integer.valueOf(((Element) element.getElementsByTagName("perkPoints").item(0)).getAttribute("value")));
            CharacterUtils.appendToImportLog(log, "</br>Set perkPoints: " + (Integer.valueOf(((Element) element.getElementsByTagName("perkPoints").item(0)).getAttribute("value")) + extraLevelUpPoints));
        } catch (Exception ex) {
        }
    }
    // ************** Location Information **************//
    nodes = parentElement.getElementsByTagName("locationInformation");
    element = (Element) nodes.item(0);
    if (element != null) {
        WorldType worldType = WorldType.valueOf(((Element) element.getElementsByTagName("worldLocation").item(0)).getAttribute("value"));
        if ((worldType == WorldType.DOMINION || worldType == WorldType.SUBMISSION || worldType == WorldType.HARPY_NEST) && Main.isVersionOlderThan(version, "0.2.1.5")) {
            PlaceType placeType = PlaceType.DOMINION_BACK_ALLEYS;
            if (character.isPlayer()) {
                if (worldType == WorldType.DOMINION) {
                    placeType = PlaceType.DOMINION_AUNTS_HOME;
                } else if (worldType == WorldType.SUBMISSION) {
                    placeType = PlaceType.SUBMISSION_ENTRANCE;
                } else {
                    placeType = PlaceType.HARPY_NESTS_ENTRANCE_ENFORCER_POST;
                }
            } else {
                if (character instanceof DominionAlleywayAttacker) {
                    placeType = PlaceType.DOMINION_BACK_ALLEYS;
                } else if (character instanceof DominionSuccubusAttacker) {
                    placeType = PlaceType.DOMINION_DARK_ALLEYS;
                } else if (character instanceof Cultist) {
                    placeType = PlaceType.DOMINION_STREET;
                } else if (character instanceof ReindeerOverseer) {
                    placeType = PlaceType.DOMINION_STREET;
                } else if (character instanceof SubmissionAttacker) {
                    placeType = PlaceType.SUBMISSION_TUNNELS;
                } else if (character instanceof HarpyNestsAttacker) {
                    placeType = PlaceType.HARPY_NESTS_WALKWAYS;
                } else if (character instanceof HarpyBimbo || character instanceof HarpyBimboCompanion) {
                    placeType = PlaceType.HARPY_NESTS_HARPY_NEST_YELLOW;
                } else if (character instanceof HarpyDominant || character instanceof HarpyDominantCompanion) {
                    placeType = PlaceType.HARPY_NESTS_HARPY_NEST_RED;
                } else if (character instanceof HarpyNympho || character instanceof HarpyNymphoCompanion) {
                    placeType = PlaceType.HARPY_NESTS_HARPY_NEST_PINK;
                } else if (character instanceof Scarlett || character instanceof Alexa) {
                    placeType = PlaceType.HARPY_NESTS_ALEXAS_NEST;
                }
            }
            character.setLocation(worldType, Main.game.getWorlds().get(worldType).getRandomUnoccupiedCell(placeType).getLocation(), true);
        } else {
            character.setLocation(worldType, new Vector2i(Integer.valueOf(((Element) element.getElementsByTagName("location").item(0)).getAttribute("x")), Integer.valueOf(((Element) element.getElementsByTagName("location").item(0)).getAttribute("y"))), false);
            character.setHomeLocation(WorldType.valueOf(((Element) element.getElementsByTagName("homeWorldLocation").item(0)).getAttribute("value")), new Vector2i(Integer.valueOf(((Element) element.getElementsByTagName("homeLocation").item(0)).getAttribute("x")), Integer.valueOf(((Element) element.getElementsByTagName("homeLocation").item(0)).getAttribute("y"))));
        }
    } else {
        character.setLocation(new Vector2i(0, 0));
    }
    // ************** Body **************//
    character.body = Body.loadFromXML(log, (Element) parentElement.getElementsByTagName("body").item(0), doc);
    if (!setGenderIdentity) {
        character.setGenderIdentity(character.getGender());
    }
    // ************** Inventory **************//
    character.resetInventory();
    nodes = parentElement.getElementsByTagName("characterInventory");
    element = (Element) nodes.item(0);
    if (element != null) {
        character.inventory = CharacterInventory.loadFromXML(element, doc);
        for (AbstractClothing clothing : character.getClothingCurrentlyEquipped()) {
            character.applyEquipClothingEffects(clothing);
        }
        if (character.getMainWeapon() != null) {
            for (Entry<Attribute, Integer> e : character.getMainWeapon().getAttributeModifiers().entrySet()) {
                character.incrementBonusAttribute(e.getKey(), e.getValue());
            }
        }
        if (character.getOffhandWeapon() != null) {
            for (Entry<Attribute, Integer> e : character.getOffhandWeapon().getAttributeModifiers().entrySet()) {
                character.incrementBonusAttribute(e.getKey(), e.getValue());
            }
        }
    } else {
        CharacterCreation.getDressed(character, false);
    }
    // ************** Attributes **************//
    // Core attributes are set in the first section.
    // Potion attributes:
    nodes = parentElement.getElementsByTagName("potionAttributes");
    Element attElement = (Element) nodes.item(0);
    if (attElement != null) {
        for (int i = 0; i < attElement.getElementsByTagName("attribute").getLength(); i++) {
            Element e = ((Element) attElement.getElementsByTagName("attribute").item(i));
            try {
                character.addPotionEffect(Attribute.valueOf(e.getAttribute("type")), Float.valueOf(e.getAttribute("value")));
                CharacterUtils.appendToImportLog(log, "</br>Set Potion Attribute: " + Attribute.valueOf(e.getAttribute("type")).getName() + " to " + Float.valueOf(e.getAttribute("value")));
            } catch (IllegalArgumentException ex) {
            }
        }
    }
    // Perks:
    nodes = parentElement.getElementsByTagName("traits");
    element = (Element) nodes.item(0);
    if (element != null) {
        for (int i = 0; i < element.getElementsByTagName("perk").getLength(); i++) {
            Element e = ((Element) element.getElementsByTagName("perk").item(i));
            character.addTrait(Perk.valueOf(e.getAttribute("type")));
            CharacterUtils.appendToImportLog(log, "</br>Added Equipped Perk: " + Perk.valueOf(e.getAttribute("type")).getName(character));
        }
    }
    nodes = parentElement.getElementsByTagName("perks");
    element = (Element) nodes.item(0);
    if (element != null) {
        if (!version.isEmpty() && Main.isVersionOlderThan(version, "0.2.0.2")) {
            int points = character.getPerkPointsAtLevel(character.getLevel());
            character.setPerkPoints(points);
            character.clearTraits();
            CharacterUtils.appendToImportLog(log, "</br>Added Perk Points: " + points);
        } else {
            for (int i = 0; i < element.getElementsByTagName("perk").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("perk").item(i));
                String type = e.getAttribute("type");
                type = type.replaceAll("STRENGTH_", "PHYSIQUE_");
                try {
                    character.addPerk(Integer.valueOf(e.getAttribute("row")), Perk.valueOf(type));
                    CharacterUtils.appendToImportLog(log, "</br>Added Perk: " + Perk.valueOf(type).getName(character));
                } catch (Exception ex) {
                }
            }
        }
    }
    // Fetishes:
    nodes = parentElement.getElementsByTagName("fetishes");
    element = (Element) nodes.item(0);
    if (element != null) {
        if (element.getElementsByTagName("fetish").item(0) != null && !((Element) element.getElementsByTagName("fetish").item(0)).getAttribute("value").isEmpty()) {
            for (int i = 0; i < element.getElementsByTagName("fetish").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("fetish").item(i));
                try {
                    if (e.getAttribute("type").equals("FETISH_NON_CON")) {
                        // Support for old non-con fetish:
                        character.incrementEssenceCount(TFEssence.ARCANE, 5);
                        CharacterUtils.appendToImportLog(log, "</br>Added refund for old non-con fetish. (+5 arcane essences)");
                    } else if (Fetish.valueOf(e.getAttribute("type")) != null) {
                        if (Boolean.valueOf(((Element) element.getElementsByTagName("fetish").item(0)).getAttribute("value"))) {
                            character.addFetish(Fetish.valueOf(e.getAttribute("type")));
                            CharacterUtils.appendToImportLog(log, "</br>Added Fetish: " + Fetish.valueOf(e.getAttribute("type")).getName(character));
                        }
                    }
                } catch (IllegalArgumentException ex) {
                }
            }
        } else {
            for (int i = 0; i < element.getElementsByTagName("fetish").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("fetish").item(i));
                try {
                    if (e.getAttribute("type").equals("FETISH_NON_CON")) {
                        // Support for old non-con fetish:
                        character.incrementEssenceCount(TFEssence.ARCANE, 5);
                        CharacterUtils.appendToImportLog(log, "</br>Added refund for old non-con fetish. (+5 arcane essences)");
                    } else if (Fetish.valueOf(e.getAttribute("type")) != null) {
                        character.addFetish(Fetish.valueOf(e.getAttribute("type")));
                        CharacterUtils.appendToImportLog(log, "</br>Added Fetish: " + Fetish.valueOf(e.getAttribute("type")).getName(character));
                    }
                } catch (IllegalArgumentException ex) {
                }
            }
        }
    }
    nodes = parentElement.getElementsByTagName("fetishDesire");
    element = (Element) nodes.item(0);
    if (element != null) {
        for (int i = 0; i < element.getElementsByTagName("entry").getLength(); i++) {
            Element e = ((Element) element.getElementsByTagName("entry").item(i));
            try {
                character.setFetishDesire(Fetish.valueOf(e.getAttribute("fetish")), FetishDesire.valueOf(e.getAttribute("desire")));
                CharacterUtils.appendToImportLog(log, "</br>Set fetish desire: " + e.getAttribute("fetish") + " , " + e.getAttribute("desire"));
            } catch (IllegalArgumentException ex) {
            }
        }
    }
    nodes = parentElement.getElementsByTagName("fetishExperience");
    element = (Element) nodes.item(0);
    if (element != null) {
        for (int i = 0; i < element.getElementsByTagName("entry").getLength(); i++) {
            Element e = ((Element) element.getElementsByTagName("entry").item(i));
            try {
                character.setFetishExperience(Fetish.valueOf(e.getAttribute("fetish")), Integer.valueOf(e.getAttribute("experience")));
                CharacterUtils.appendToImportLog(log, "</br>Set fetish experience: " + e.getAttribute("fetish") + " , " + e.getAttribute("experience"));
            } catch (IllegalArgumentException ex) {
            }
        }
    }
    // Status Effects:
    nodes = parentElement.getElementsByTagName("statusEffects");
    element = (Element) nodes.item(0);
    for (int i = 0; i < element.getElementsByTagName("statusEffect").getLength(); i++) {
        Element e = ((Element) element.getElementsByTagName("statusEffect").item(i));
        try {
            if (Integer.valueOf(e.getAttribute("value")) != -1) {
                StatusEffect effect = StatusEffect.valueOf(e.getAttribute("type"));
                if (!noPregnancy || (effect != StatusEffect.PREGNANT_0 && effect != StatusEffect.PREGNANT_1 && effect != StatusEffect.PREGNANT_2 && effect != StatusEffect.PREGNANT_3)) {
                    character.addStatusEffect(effect, Integer.valueOf(e.getAttribute("value")));
                    CharacterUtils.appendToImportLog(log, "</br>Added Status Effect: " + StatusEffect.valueOf(e.getAttribute("type")).getName(character) + " (" + Integer.valueOf(e.getAttribute("value")) + " minutes)");
                }
            }
        } catch (IllegalArgumentException ex) {
        }
    }
    // ************** Relationships **************//
    nodes = parentElement.getElementsByTagName("characterRelationships");
    element = (Element) nodes.item(0);
    if (element != null) {
        for (int i = 0; i < element.getElementsByTagName("relationship").getLength(); i++) {
            Element e = ((Element) element.getElementsByTagName("relationship").item(i));
            character.setAffection(e.getAttribute("character"), Float.valueOf(e.getAttribute("value")));
            CharacterUtils.appendToImportLog(log, "</br>Set Relationship: " + e.getAttribute("character") + " , " + Float.valueOf(e.getAttribute("value")));
        }
    }
    if (!noPregnancy) {
        nodes = parentElement.getElementsByTagName("pregnancy");
        Element pregnancyElement = (Element) nodes.item(0);
        if (pregnancyElement != null) {
            CharacterUtils.appendToImportLog(log, "</br></br>Pregnancies:");
            character.setTimeProgressedToFinalPregnancyStage(Integer.valueOf(pregnancyElement.getAttribute("timeProgressedToFinalPregnancyStage")));
            nodes = pregnancyElement.getElementsByTagName("potentialPartnersAsMother");
            element = (Element) nodes.item(0);
            if (element != null) {
                for (int i = 0; i < element.getElementsByTagName("pregnancyPossibility").getLength(); i++) {
                    Element e = ((Element) element.getElementsByTagName("pregnancyPossibility").item(i));
                    character.getPotentialPartnersAsMother().add(PregnancyPossibility.loadFromXML(e, doc));
                    CharacterUtils.appendToImportLog(log, "</br>Added Pregnancy Possibility as mother.");
                }
            }
            nodes = pregnancyElement.getElementsByTagName("potentialPartnersAsFather");
            element = (Element) nodes.item(0);
            if (element != null) {
                for (int i = 0; i < element.getElementsByTagName("pregnancyPossibility").getLength(); i++) {
                    Element e = ((Element) element.getElementsByTagName("pregnancyPossibility").item(i));
                    character.getPotentialPartnersAsFather().add(PregnancyPossibility.loadFromXML(e, doc));
                    CharacterUtils.appendToImportLog(log, "</br>Added Pregnancy Possibility as father.");
                }
            }
            nodes = pregnancyElement.getElementsByTagName("pregnantLitter");
            element = (Element) ((Element) nodes.item(0)).getElementsByTagName("litter").item(0);
            if (element != null) {
                character.setPregnantLitter(Litter.loadFromXML(element, doc));
                CharacterUtils.appendToImportLog(log, "</br>Added Pregnant litter.");
            }
            nodes = pregnancyElement.getElementsByTagName("birthedLitters");
            element = (Element) nodes.item(0);
            if (element != null) {
                for (int i = 0; i < element.getElementsByTagName("litter").getLength(); i++) {
                    Element e = ((Element) element.getElementsByTagName("litter").item(i));
                    character.getLittersBirthed().add(Litter.loadFromXML(e, doc));
                    CharacterUtils.appendToImportLog(log, "</br>Added litter birthed.");
                }
            }
            nodes = pregnancyElement.getElementsByTagName("littersFathered");
            element = (Element) nodes.item(0);
            if (element != null) {
                for (int i = 0; i < element.getElementsByTagName("litter").getLength(); i++) {
                    Element e = ((Element) element.getElementsByTagName("litter").item(i));
                    character.getLittersFathered().add(Litter.loadFromXML(e, doc));
                    CharacterUtils.appendToImportLog(log, "</br>Added litter fathered.");
                }
            }
        }
    }
    // ************** Family **************//
    nodes = parentElement.getElementsByTagName("family");
    Element familyElement = (Element) nodes.item(0);
    if (familyElement != null) {
        character.setMother(((Element) familyElement.getElementsByTagName("motherId").item(0)).getAttribute("value"));
        character.setFather(((Element) familyElement.getElementsByTagName("fatherId").item(0)).getAttribute("value"));
        character.setDayOfConception(Integer.valueOf(((Element) familyElement.getElementsByTagName("dayOfConception").item(0)).getAttribute("value")));
        character.setDayOfBirth(Integer.valueOf(((Element) familyElement.getElementsByTagName("dayOfBirth").item(0)).getAttribute("value")));
    }
    // ************** Slavery **************//
    nodes = parentElement.getElementsByTagName("slavery");
    Element slaveryElement = (Element) nodes.item(0);
    if (slaveryElement != null) {
        for (int i = 0; i < ((Element) slaveryElement.getElementsByTagName("slavesOwned").item(0)).getElementsByTagName("slave").getLength(); i++) {
            Element e = ((Element) slaveryElement.getElementsByTagName("slave").item(i));
            if (!e.getAttribute("id").equals("NOT_SET")) {
                character.getSlavesOwned().add(e.getAttribute("id"));
                CharacterUtils.appendToImportLog(log, "</br>Added owned slave: " + e.getAttribute("id"));
            }
        }
        character.setOwner(((Element) slaveryElement.getElementsByTagName("owner").item(0)).getAttribute("value"));
        CharacterUtils.appendToImportLog(log, "</br>Set owner: " + character.getOwnerId());
        character.setSlaveJob(SlaveJob.valueOf(((Element) slaveryElement.getElementsByTagName("slaveJob").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set slave job: " + character.getSlaveJob());
        for (int i = 0; i < ((Element) slaveryElement.getElementsByTagName("slaveJobSettings").item(0)).getElementsByTagName("setting").getLength(); i++) {
            Element e = ((Element) slaveryElement.getElementsByTagName("setting").item(i));
            SlaveJobSetting setting = SlaveJobSetting.valueOf(e.getAttribute("value"));
            character.addSlaveJobSettings(setting);
            CharacterUtils.appendToImportLog(log, "</br>Added slave job setting: " + setting);
        }
        // Clear settings first:
        for (SlavePermission key : character.getSlavePermissionSettings().keySet()) {
            character.getSlavePermissionSettings().get(key).clear();
        }
        for (int i = 0; i < ((Element) slaveryElement.getElementsByTagName("slavePermissionSettings").item(0)).getElementsByTagName("permission").getLength(); i++) {
            Element e = ((Element) slaveryElement.getElementsByTagName("permission").item(i));
            SlavePermission slavePermission = SlavePermission.valueOf(e.getAttribute("type"));
            for (int j = 0; j < e.getElementsByTagName("setting").getLength(); j++) {
                Element e2 = ((Element) e.getElementsByTagName("setting").item(j));
                SlavePermissionSetting setting = SlavePermissionSetting.valueOf(e2.getAttribute("value"));
                character.addSlavePermissionSetting(slavePermission, setting);
                CharacterUtils.appendToImportLog(log, "</br>Added slave permission setting: " + slavePermission + ", " + setting);
            }
        }
        Element workHourElement = ((Element) slaveryElement.getElementsByTagName("slaveWorkHours").item(0));
        for (int i = 0; i < character.workHours.length; i++) {
            character.workHours[i] = Boolean.valueOf(workHourElement.getAttribute("hour" + String.valueOf(i)));
            CharacterUtils.appendToImportLog(log, "</br>Set work hour: " + i + ", " + character.workHours[i]);
        }
    }
    // ************** Sex Stats **************//
    nodes = parentElement.getElementsByTagName("sexStats");
    Element sexStatsElement = (Element) nodes.item(0);
    if (sexStatsElement.getElementsByTagName("sexConsensualCount").getLength() != 0) {
        character.setSexConsensualCount(Integer.valueOf(((Element) sexStatsElement.getElementsByTagName("sexConsensualCount").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set consensual sex count: " + character.getSexConsensualCount());
    }
    if (sexStatsElement.getElementsByTagName("sexAsSubCount").getLength() != 0) {
        character.setSexAsSubCount(Integer.valueOf(((Element) sexStatsElement.getElementsByTagName("sexAsSubCount").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set sub sex count: " + character.getSexAsSubCount());
    }
    if (sexStatsElement.getElementsByTagName("sexAsDomCount").getLength() != 0) {
        character.setSexAsDomCount(Integer.valueOf(((Element) sexStatsElement.getElementsByTagName("sexAsDomCount").item(0)).getAttribute("value")));
        CharacterUtils.appendToImportLog(log, "</br>Set dom sex count: " + character.getSexAsDomCount());
    }
    // Cummed in areas:
    element = (Element) ((Element) nodes.item(0)).getElementsByTagName("cummedInAreas").item(0);
    if (element != null) {
        for (int i = 0; i < element.getElementsByTagName("entry").getLength(); i++) {
            Element e = ((Element) element.getElementsByTagName("entry").item(i));
            try {
                character.setCummedInArea(OrificeType.valueOf(e.getAttribute("orifice")), Integer.valueOf(e.getAttribute("cumQuantity")));
                CharacterUtils.appendToImportLog(log, "</br>Added cummed in area: " + e.getAttribute("orifice") + ", " + Integer.valueOf(e.getAttribute("cumQuantity")) + "ml");
            } catch (Exception ex) {
            }
        }
    }
    // Cum counts:
    element = (Element) ((Element) nodes.item(0)).getElementsByTagName("cumCounts").item(0);
    for (int i = 0; i < element.getElementsByTagName("cumCount").getLength(); i++) {
        Element e = ((Element) element.getElementsByTagName("cumCount").item(i));
        try {
            for (int it = 0; it < Integer.valueOf(e.getAttribute("count")); it++) {
                character.incrementCumCount(new SexType(SexParticipantType.valueOf(e.getAttribute("participantType")), PenetrationType.valueOf(e.getAttribute("penetrationType")), OrificeType.valueOf(e.getAttribute("orificeType"))));
            }
            CharacterUtils.appendToImportLog(log, "</br>Added cum count:" + e.getAttribute("penetrationType") + " " + e.getAttribute("orificeType") + " x " + Integer.valueOf(e.getAttribute("count")));
        } catch (Exception ex) {
        }
    }
    // Sex counts:
    element = (Element) ((Element) nodes.item(0)).getElementsByTagName("sexCounts").item(0);
    for (int i = 0; i < element.getElementsByTagName("sexCount").getLength(); i++) {
        Element e = ((Element) element.getElementsByTagName("sexCount").item(i));
        try {
            for (int it = 0; it < Integer.valueOf(e.getAttribute("count")); it++) {
                character.incrementSexCount(new SexType(SexParticipantType.valueOf(e.getAttribute("participantType")), PenetrationType.valueOf(e.getAttribute("penetrationType")), OrificeType.valueOf(e.getAttribute("orificeType"))));
            }
            CharacterUtils.appendToImportLog(log, "</br>Added sex count:" + e.getAttribute("penetrationType") + " " + e.getAttribute("orificeType") + " x " + Integer.valueOf(e.getAttribute("count")));
        } catch (Exception ex) {
        }
    }
    // Virginity losses:
    element = (Element) ((Element) nodes.item(0)).getElementsByTagName("virginityTakenBy").item(0);
    for (int i = 0; i < element.getElementsByTagName("virginity").getLength(); i++) {
        Element e = ((Element) element.getElementsByTagName("virginity").item(i));
        try {
            character.setVirginityLoss(new SexType(SexParticipantType.valueOf(e.getAttribute("participantType")), PenetrationType.valueOf(e.getAttribute("penetrationType")), OrificeType.valueOf(e.getAttribute("orificeType"))), e.getAttribute("takenBy"));
            CharacterUtils.appendToImportLog(log, "</br>Added virginity loss:" + e.getAttribute("penetrationType") + " " + e.getAttribute("orificeType") + " (taken by:" + e.getAttribute("takenBy") + ")");
        } catch (Exception ex) {
        }
    }
    element = (Element) ((Element) nodes.item(0)).getElementsByTagName("sexPartnerMap").item(0);
    if (element != null) {
        for (int i = 0; i < element.getElementsByTagName("id").getLength(); i++) {
            Element e = ((Element) element.getElementsByTagName("id").item(i));
            character.sexPartnerMap.put(e.getAttribute("value"), new HashMap<>());
            for (int j = 0; j < element.getElementsByTagName("entry").getLength(); j++) {
                Element e2 = ((Element) element.getElementsByTagName("entry").item(j));
                try {
                    character.sexPartnerMap.get(e.getAttribute("value")).put(new SexType(SexParticipantType.valueOf(e.getAttribute("participantType")), PenetrationType.valueOf(e2.getAttribute("penetrationType")), OrificeType.valueOf(e2.getAttribute("orificeType"))), Integer.valueOf(e2.getAttribute("count")));
                    CharacterUtils.appendToImportLog(log, "</br>Added sex tracking: " + e.getAttribute("value") + " " + e2.getAttribute("penetrationType") + "/" + e2.getAttribute("orificeType") + " " + Integer.valueOf(e2.getAttribute("count")));
                } catch (Exception ex) {
                }
            }
        }
    }
    // ************** Addictions **************//
    // Element characterAddictions = doc.createElement("addictions");
    // properties.appendChild(characterAddictions);
    // for(Addiction add : addictions) {
    // add.saveAsXML(characterAddictions, doc);
    // }
    // 
    // CharacterUtils.addAttribute(doc, characterAddictions, "alcoholLevel", String.valueOf(alcoholLevel));
    // 
    // Element psychoactives = doc.createElement("psychoactiveFluids");
    // properties.appendChild(psychoactives);
    // for(FluidType ft : this.getPsychoactiveFluidsIngested()) {
    // Element element = doc.createElement("fluid");
    // psychoactives.appendChild(element);
    // CharacterUtils.addAttribute(doc, element, "value", ft.toString());
    // }
    nodes = parentElement.getElementsByTagName("addictionsCore");
    Element addictionsElement = (Element) nodes.item(0);
    if (addictionsElement != null) {
        if (!addictionsElement.getAttribute("alcoholLevel").isEmpty()) {
            try {
                character.alcoholLevel = (Float.valueOf(addictionsElement.getAttribute("alcoholLevel")));
            } catch (Exception ex) {
            }
        }
        element = (Element) addictionsElement.getElementsByTagName("psychoactiveFluids").item(0);
        if (element != null) {
            for (int i = 0; i < element.getElementsByTagName("fluid").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("fluid").item(i));
                character.addPsychoactiveFluidIngested(FluidType.valueOf(e.getAttribute("value")));
                CharacterUtils.appendToImportLog(log, "</br>Added psychoactive fluid:" + e.getAttribute("value"));
            }
        }
        // Old addiction support: //TODO test
        element = (Element) addictionsElement.getElementsByTagName("addictionSatisfiedMap").item(0);
        if (element != null) {
            for (int i = 0; i < element.getElementsByTagName("addiction").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("addiction").item(i));
                character.setLastTimeSatisfiedAddiction(FluidType.valueOf(e.getAttribute("type")), Long.valueOf(e.getAttribute("value")));
                CharacterUtils.appendToImportLog(log, "</br>Set satisfied time:" + e.getAttribute("type") + " " + e.getAttribute("value"));
            }
        }
        // New addiction:
        element = (Element) addictionsElement.getElementsByTagName("addictions").item(0);
        if (element != null) {
            for (int i = 0; i < element.getElementsByTagName("addiction").getLength(); i++) {
                try {
                    character.addAddiction(Addiction.loadFromXML(log, ((Element) element.getElementsByTagName("addiction").item(i)), doc));
                } catch (Exception ex) {
                }
            }
        }
    }
}
Also used : SlaveJobSetting(com.lilithsthrone.game.slavery.SlaveJobSetting) PlaceType(com.lilithsthrone.world.places.PlaceType) Attribute(com.lilithsthrone.game.character.attributes.Attribute) Element(org.w3c.dom.Element) SlavePermission(com.lilithsthrone.game.slavery.SlavePermission) DominionSuccubusAttacker(com.lilithsthrone.game.character.npc.dominion.DominionSuccubusAttacker) ReindeerOverseer(com.lilithsthrone.game.character.npc.dominion.ReindeerOverseer) HarpyNymphoCompanion(com.lilithsthrone.game.character.npc.dominion.HarpyNymphoCompanion) HarpyBimbo(com.lilithsthrone.game.character.npc.dominion.HarpyBimbo) WorldType(com.lilithsthrone.world.WorldType) Scarlett(com.lilithsthrone.game.character.npc.dominion.Scarlett) SubmissionAttacker(com.lilithsthrone.game.character.npc.submission.SubmissionAttacker) HarpyBimboCompanion(com.lilithsthrone.game.character.npc.dominion.HarpyBimboCompanion) HarpyDominant(com.lilithsthrone.game.character.npc.dominion.HarpyDominant) DominionAlleywayAttacker(com.lilithsthrone.game.character.npc.dominion.DominionAlleywayAttacker) Vector2i(com.lilithsthrone.utils.Vector2i) Cultist(com.lilithsthrone.game.character.npc.dominion.Cultist) SexType(com.lilithsthrone.game.sex.SexType) HarpyDominantCompanion(com.lilithsthrone.game.character.npc.dominion.HarpyDominantCompanion) Alexa(com.lilithsthrone.game.character.npc.dominion.Alexa) NodeList(org.w3c.dom.NodeList) HarpyNestsAttacker(com.lilithsthrone.game.character.npc.dominion.HarpyNestsAttacker) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) SlavePermissionSetting(com.lilithsthrone.game.slavery.SlavePermissionSetting) HarpyNympho(com.lilithsthrone.game.character.npc.dominion.HarpyNympho)

Example 8 with SexType

use of com.lilithsthrone.game.sex.SexType in project liliths-throne-public by Innoxia.

the class NPC method getMainSexPositionPreferences.

public Set<SexPositionSlot> getMainSexPositionPreferences() {
    sexPositionPreferences.clear();
    // Main sex:
    if (mainSexPreference != null) {
        if (mainSexPreference.equals(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.MOUTH)) || mainSexPreference.equals(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.VAGINA))) {
            sexPositionPreferences.add(SexPositionSlot.SIXTY_NINE_TOP);
            sexPositionPreferences.add(SexPositionSlot.KNEELING_RECEIVING_ORAL);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.MOUTH)) || mainSexPreference.equals(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.VAGINA))) {
            sexPositionPreferences.add(SexPositionSlot.SIXTY_NINE_TOP);
            sexPositionPreferences.add(SexPositionSlot.KNEELING_PERFORMING_ORAL);
            sexPositionPreferences.add(SexPositionSlot.DOGGY_BEHIND_ORAL);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.ANUS))) {
            sexPositionPreferences.add(SexPositionSlot.FACE_TO_WALL_FACING_TARGET);
            sexPositionPreferences.add(SexPositionSlot.DOGGY_BEHIND);
            sexPositionPreferences.add(SexPositionSlot.MISSIONARY_KNEELING_BETWEEN_LEGS);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.VAGINA))) {
            sexPositionPreferences.add(SexPositionSlot.FACE_TO_WALL_FACING_TARGET);
            sexPositionPreferences.add(SexPositionSlot.BACK_TO_WALL_FACING_TARGET);
            sexPositionPreferences.add(SexPositionSlot.DOGGY_BEHIND);
            sexPositionPreferences.add(SexPositionSlot.MISSIONARY_KNEELING_BETWEEN_LEGS);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.ANUS))) {
            sexPositionPreferences.add(SexPositionSlot.COWGIRL_RIDING);
            sexPositionPreferences.add(SexPositionSlot.DOGGY_ON_ALL_FOURS);
            sexPositionPreferences.add(SexPositionSlot.MISSIONARY_ON_BACK);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.VAGINA))) {
            sexPositionPreferences.add(SexPositionSlot.COWGIRL_RIDING);
            sexPositionPreferences.add(SexPositionSlot.BACK_TO_WALL_FACING_TARGET);
            sexPositionPreferences.add(SexPositionSlot.DOGGY_ON_ALL_FOURS);
            sexPositionPreferences.add(SexPositionSlot.MISSIONARY_ON_BACK);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.BREAST)) || mainSexPreference.equals(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.NIPPLE))) {
            sexPositionPreferences.add(SexPositionSlot.KNEELING_RECEIVING_ORAL);
        } else if (mainSexPreference.equals(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.BREAST)) || mainSexPreference.equals(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.NIPPLE))) {
            sexPositionPreferences.add(SexPositionSlot.KNEELING_PERFORMING_ORAL);
        }
    }
    if (sexPositionPreferences.isEmpty()) {
        // If no preferences found, add 'standard' positions:
        sexPositionPreferences.add(SexPositionSlot.BACK_TO_WALL_FACING_TARGET);
        sexPositionPreferences.add(SexPositionSlot.DOGGY_BEHIND);
        sexPositionPreferences.add(SexPositionSlot.FACE_TO_WALL_FACING_TARGET);
        sexPositionPreferences.add(SexPositionSlot.KNEELING_RECEIVING_ORAL);
        sexPositionPreferences.add(SexPositionSlot.SIXTY_NINE_TOP);
        sexPositionPreferences.add(SexPositionSlot.COWGIRL_RIDING);
        sexPositionPreferences.add(SexPositionSlot.MISSIONARY_ON_BACK);
        sexPositionPreferences.add(SexPositionSlot.MISSIONARY_KNEELING_BETWEEN_LEGS);
    }
    return sexPositionPreferences;
}
Also used : SexType(com.lilithsthrone.game.sex.SexType)

Example 9 with SexType

use of com.lilithsthrone.game.sex.SexType in project liliths-throne-public by Innoxia.

the class NPC method generateSexChoices.

public void generateSexChoices(GameCharacter target) {
    List<SexType> foreplaySexTypes = new ArrayList<>();
    List<SexType> mainSexTypes = new ArrayList<>();
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_BREASTS_OTHERS)) {
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.BREAST));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.BREAST));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.NIPPLE));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.NIPPLE));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.BREAST));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.BREAST));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TAIL, OrificeType.BREAST));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.NIPPLE));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TAIL, OrificeType.NIPPLE));
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_BREASTS_SELF)) {
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.BREAST));
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.BREAST));
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.NIPPLE));
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.NIPPLE));
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.BREAST));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.BREAST));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TAIL, OrificeType.BREAST));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.NIPPLE));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TAIL, OrificeType.NIPPLE));
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_ANAL_GIVING)) {
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.ANUS));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.ANUS));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.ANUS));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TAIL, OrificeType.ANUS));
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_ANAL_RECEIVING)) {
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.ANUS));
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.ANUS));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.ANUS));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TAIL, OrificeType.ANUS));
    }
    if ((isKeenToPerformFetishAction(target, Fetish.FETISH_DEFLOWERING) && target.isVaginaVirgin()) || isKeenToPerformFetishAction(target, Fetish.FETISH_IMPREGNATION) || isKeenToPerformFetishAction(target, Fetish.FETISH_SEEDER)) {
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.VAGINA));
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_PREGNANCY) || isKeenToPerformFetishAction(target, Fetish.FETISH_BROODMOTHER)) {
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.VAGINA));
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_ORAL_RECEIVING)) {
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.VAGINA));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.MOUTH));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.VAGINA));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.MOUTH));
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_ORAL_GIVING)) {
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.VAGINA));
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.MOUTH));
        mainSexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.VAGINA));
        mainSexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.MOUTH));
    }
    // If no preferences from fetishes, add all common foreplay actions:
    if (foreplaySexTypes.isEmpty()) {
        // Player penetrates:
        List<PenetrationType> penTypes = Util.newArrayListOfValues(new ListValue<>(PenetrationType.FINGER), new ListValue<>(PenetrationType.TONGUE));
        List<OrificeType> orificeTypes = Util.newArrayListOfValues(new ListValue<>(OrificeType.BREAST), new ListValue<>(OrificeType.NIPPLE), new ListValue<>(OrificeType.VAGINA));
        for (PenetrationType pen : penTypes) {
            for (OrificeType orifice : orificeTypes) {
                foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, pen, orifice));
                foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, pen, orifice));
            }
        }
        foreplaySexTypes.add(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.MOUTH));
        foreplaySexTypes.add(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.MOUTH));
    }
    // If no preferences from fetishes, add all common sex actions:
    if (mainSexTypes.isEmpty()) {
        // TODO make a better weighting method, rather than just adding multiple entries
        // Player penetrates:
        List<PenetrationType> penTypes = Util.newArrayListOfValues(new ListValue<>(PenetrationType.PENIS), new ListValue<>(PenetrationType.PENIS), new ListValue<>(PenetrationType.PENIS), new ListValue<>(PenetrationType.TAIL));
        List<OrificeType> orificeTypes = Util.newArrayListOfValues(new ListValue<>(OrificeType.BREAST), new ListValue<>(OrificeType.VAGINA), new ListValue<>(OrificeType.VAGINA), new ListValue<>(OrificeType.VAGINA));
        for (PenetrationType pen : penTypes) {
            for (OrificeType orifice : orificeTypes) {
                mainSexTypes.add(new SexType(SexParticipantType.CATCHER, pen, orifice));
                mainSexTypes.add(new SexType(SexParticipantType.PITCHER, pen, orifice));
            }
        }
    }
    // Penis:
    if (!target.hasPenis() || !target.isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.PENIS && !sexType.getAsParticipant().isUsingSelfPenetrationType());
        mainSexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.PENIS && !sexType.getAsParticipant().isUsingSelfPenetrationType());
    }
    if (!this.hasPenis() || !this.isAbleToAccessCoverableArea(CoverableArea.PENIS, true)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.PENIS && sexType.getAsParticipant().isUsingSelfPenetrationType());
        mainSexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.PENIS && sexType.getAsParticipant().isUsingSelfPenetrationType());
    }
    // Vagina:
    if (!target.hasVagina() || !target.isAbleToAccessCoverableArea(CoverableArea.VAGINA, true) || isKeenToAvoidFetishAction(target, Fetish.FETISH_VAGINAL_GIVING)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.VAGINA && !sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.VAGINA && !sexType.getAsParticipant().isUsingSelfOrificeType());
    }
    if (isKeenToPerformFetishAction(target, Fetish.FETISH_PURE_VIRGIN) || !this.hasVagina() || !this.isAbleToAccessCoverableArea(CoverableArea.VAGINA, true) || isKeenToAvoidFetishAction(target, Fetish.FETISH_VAGINAL_RECEIVING)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.VAGINA && sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.VAGINA && sexType.getAsParticipant().isUsingSelfOrificeType());
    }
    // Anus:
    if (!target.isAbleToAccessCoverableArea(CoverableArea.ANUS, true) || isKeenToAvoidFetishAction(target, Fetish.FETISH_ANAL_GIVING)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.ANUS && !sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.ANUS && !sexType.getAsParticipant().isUsingSelfOrificeType());
    }
    if (!this.isAbleToAccessCoverableArea(CoverableArea.ANUS, true) || isKeenToAvoidFetishAction(target, Fetish.FETISH_VAGINAL_RECEIVING)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.ANUS && sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.ANUS && sexType.getAsParticipant().isUsingSelfOrificeType());
    }
    // Oral:
    if (!target.isAbleToAccessCoverableArea(CoverableArea.MOUTH, true) || isKeenToAvoidFetishAction(target, Fetish.FETISH_ORAL_GIVING)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.MOUTH && !sexType.getAsParticipant().isUsingSelfOrificeType());
        foreplaySexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TONGUE && !sexType.getAsParticipant().isUsingSelfPenetrationType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.MOUTH && !sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TONGUE && !sexType.getAsParticipant().isUsingSelfPenetrationType());
    }
    if (!this.isAbleToAccessCoverableArea(CoverableArea.MOUTH, true) || isKeenToAvoidFetishAction(target, Fetish.FETISH_ORAL_RECEIVING)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.MOUTH && sexType.getAsParticipant().isUsingSelfOrificeType());
        foreplaySexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TONGUE && sexType.getAsParticipant().isUsingSelfPenetrationType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.MOUTH && sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TONGUE && sexType.getAsParticipant().isUsingSelfPenetrationType());
    }
    // Breasts:
    if (!target.isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true) || (!target.hasBreasts() && !target.isBreastFuckableNipplePenetration()) || isKeenToAvoidFetishAction(target, Fetish.FETISH_BREASTS_OTHERS)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.NIPPLE && !sexType.getAsParticipant().isUsingSelfOrificeType());
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.BREAST && !sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.NIPPLE && !sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.BREAST && !sexType.getAsParticipant().isUsingSelfOrificeType());
    }
    if (!this.isAbleToAccessCoverableArea(CoverableArea.NIPPLES, true) || (!this.hasBreasts() && !this.isBreastFuckableNipplePenetration()) || isKeenToAvoidFetishAction(target, Fetish.FETISH_BREASTS_SELF)) {
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.NIPPLE && sexType.getAsParticipant().isUsingSelfOrificeType());
        foreplaySexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.BREAST && sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.NIPPLE && sexType.getAsParticipant().isUsingSelfOrificeType());
        mainSexTypes.removeIf(sexType -> sexType.getOrificeType() == OrificeType.BREAST && sexType.getAsParticipant().isUsingSelfOrificeType());
    }
    // Tail:
    if (!target.getTailType().isSuitableForPenetration()) {
        foreplaySexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TAIL && !sexType.getAsParticipant().isUsingSelfPenetrationType());
        mainSexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TAIL && !sexType.getAsParticipant().isUsingSelfPenetrationType());
    }
    if (!this.getTailType().isSuitableForPenetration()) {
        foreplaySexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TAIL && sexType.getAsParticipant().isUsingSelfPenetrationType());
        mainSexTypes.removeIf(sexType -> sexType.getPenetrationType() == PenetrationType.TAIL && sexType.getAsParticipant().isUsingSelfPenetrationType());
    }
    if (foreplaySexTypes.isEmpty()) {
        foreplayPreference = null;
    } else {
        foreplayPreference = foreplaySexTypes.get(Util.random.nextInt(foreplaySexTypes.size()));
    // System.out.println("Foreplay: "+foreplayPreference.getPenetrationType().toString()+" "+foreplayPreference.getOrificeType().toString());
    }
    if (mainSexTypes.isEmpty()) {
        mainSexPreference = null;
    } else {
        mainSexPreference = mainSexTypes.get(Util.random.nextInt(mainSexTypes.size()));
    // System.out.println("Main: "+mainSexPreference.getPenetrationType().toString()+" "+mainSexPreference.getOrificeType().toString());
    }
}
Also used : SexType(com.lilithsthrone.game.sex.SexType) OrificeType(com.lilithsthrone.game.sex.OrificeType) ArrayList(java.util.ArrayList) PenetrationType(com.lilithsthrone.game.sex.PenetrationType)

Example 10 with SexType

use of com.lilithsthrone.game.sex.SexType in project liliths-throne-public by Innoxia.

the class CharacterModificationUtils method getSexualExperienceDiv.

// public static String[] virginityLossesGynephilic = new String[] {"your girlfriend", "", "some girl in your apartment", "some girl in a club's restroom"};
// public static String[] virginityLossesAmbiphilic = new String[] {"your girlfriend in her apartment", "your girlfriend in your apartment", "some girl in her apartment", "some girl in your apartment", "some girl in a club's restroom",
// "your boyfriend in his apartment", "your boyfriend in your apartment", "some guy in his apartment", "some guy in your apartment", "some guy in a club's restroom"};
// public static String[] virginityLossesAndrophilic = new String[] {"your boyfriend in his apartment", "your boyfriend in your apartment", "some guy in his apartment", "some guy in your apartment", "some guy in a club's restroom"};
// 
public static String getSexualExperienceDiv() {
    contentSB.setLength(0);
    contentSB.append("<div class='container-full-width'>" + "<div class='container-full-width' style='text-align:center;'><h6>Sex Actions Performed</h6></div>");
    contentSB.append(getSexExperienceEntry("HANDJOBS_GIVEN", "Handjobs Given", new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.URETHRA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) + getSexExperienceEntry("FINGERINGS_GIVEN", "Fingerings Performed", new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.VAGINA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) + getSexExperienceEntry("BLOWJOBS_GIVEN", "Blowjobs Given", new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.MOUTH), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) + getSexExperienceEntry("CUNNILINGUS_GIVEN", "Cunnilingus Performed", new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.VAGINA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) + getSexExperienceEntry("VAGINAL_GIVEN", "Vaginal Sex Performed", new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.VAGINA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) + getSexExperienceEntry("ANAL_GIVEN", "Anal Sex Performed", new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.ANUS), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames));
    contentSB.append("</div>");
    contentSB.append("<div class='container-full-width'>" + "<div class='container-full-width' style='text-align:center;'><h6>Sex Actions Received</h6></div>");
    contentSB.append((Main.game.getPlayer().hasVagina() ? "" : getSexExperienceEntry("HANDJOBS_TAKEN", "Handjobs Received", new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.URETHRA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames)) + (Main.game.getPlayer().hasVagina() ? getSexExperienceEntry("FINGERINGS_TAKEN", "Fingerings Received", new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.VAGINA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) : "") + (Main.game.getPlayer().hasVagina() ? "" : getSexExperienceEntry("BLOWJOBS_TAKEN", "Blowjobs Received", new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.MOUTH), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames)) + (Main.game.getPlayer().hasVagina() ? getSexExperienceEntry("CUNNILINGUS_TAKEN", "Cunnilingus Received", new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.VAGINA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) : "") + (Main.game.getPlayer().hasVagina() ? getSexExperienceEntry("VAGINAL_TAKEN", "Vaginal Sex Received", new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.VAGINA), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames) : "") + getSexExperienceEntry("ANAL_TAKEN", "Anal Sex Received", new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.ANUS), normalSexExperienceValues, Main.game.getPlayer().isFeminine() ? feminineNames : masculineNames));
    contentSB.append("</div>");
    return contentSB.toString();
}
Also used : SexType(com.lilithsthrone.game.sex.SexType)

Aggregations

SexType (com.lilithsthrone.game.sex.SexType)12 PenetrationType (com.lilithsthrone.game.sex.PenetrationType)8 OrificeModifier (com.lilithsthrone.game.character.body.valueEnums.OrificeModifier)6 OrificeType (com.lilithsthrone.game.sex.OrificeType)4 Attribute (com.lilithsthrone.game.character.attributes.Attribute)3 FluidModifier (com.lilithsthrone.game.character.body.valueEnums.FluidModifier)2 PenisModifier (com.lilithsthrone.game.character.body.valueEnums.PenisModifier)2 StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)2 SlaveJobSetting (com.lilithsthrone.game.slavery.SlaveJobSetting)2 SlavePermission (com.lilithsthrone.game.slavery.SlavePermission)2 SlavePermissionSetting (com.lilithsthrone.game.slavery.SlavePermissionSetting)2 Element (org.w3c.dom.Element)2 EnchantmentEventListener (com.lilithsthrone.controller.eventListeners.EnchantmentEventListener)1 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)1 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)1 SetContentEventListener (com.lilithsthrone.controller.eventListeners.SetContentEventListener)1 TooltipHideEventListener (com.lilithsthrone.controller.eventListeners.TooltipHideEventListener)1 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)1 TooltipMoveEventListener (com.lilithsthrone.controller.eventListeners.TooltipMoveEventListener)1 TooltipResponseDescriptionEventListener (com.lilithsthrone.controller.eventListeners.TooltipResponseDescriptionEventListener)1