Search in sources :

Example 1 with Race

use of com.lilithsthrone.game.character.race.Race in project liliths-throne-public by Innoxia.

the class Body method getRaceFromPartWeighting.

public Race getRaceFromPartWeighting() {
    Race race = Race.HUMAN;
    addRaceWeight(raceWeightMap, skin.getType().getRace(), 3);
    addRaceWeight(raceWeightMap, face.getType().getRace(), 3);
    addRaceWeight(raceWeightMap, arm.getType().getRace(), 2);
    addRaceWeight(raceWeightMap, leg.getType().getRace(), 2);
    addRaceWeight(raceWeightMap, antenna.getType().getRace(), 1);
    addRaceWeight(raceWeightMap, eye.getType().getRace(), 1);
    addRaceWeight(raceWeightMap, ear.getType().getRace(), 1);
    addRaceWeight(raceWeightMap, hair.getType().getRace(), 1);
    addRaceWeight(raceWeightMap, horn.getType().getRace(), 1);
    addRaceWeight(raceWeightMap, tail.getType().getRace(), 1);
    addRaceWeight(raceWeightMap, wing.getType().getRace(), 1);
    // Not using breast, ass, penis, or vagina
    int max = 0;
    for (Entry<Race, Integer> e : raceWeightMap.entrySet()) {
        if (e.getKey() != null && e.getKey() != Race.HUMAN && e.getValue() > max) {
            race = e.getKey();
            max = e.getValue();
        }
    }
    return race;
}
Also used : Race(com.lilithsthrone.game.character.race.Race)

Example 2 with Race

use of com.lilithsthrone.game.character.race.Race in project liliths-throne-public by Innoxia.

the class Properties method savePropertiesAsXML.

public void savePropertiesAsXML() {
    try {
        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
        Document doc = docBuilder.newDocument();
        Element properties = doc.createElement("properties");
        doc.appendChild(properties);
        // Previous save information:
        Element previousSave = doc.createElement("previousSave");
        properties.appendChild(previousSave);
        createXMLElementWithValue(doc, previousSave, "location", lastSaveLocation);
        createXMLElementWithValue(doc, previousSave, "nameColour", nameColour);
        createXMLElementWithValue(doc, previousSave, "name", name);
        createXMLElementWithValue(doc, previousSave, "race", race);
        createXMLElementWithValue(doc, previousSave, "quest", quest);
        createXMLElementWithValue(doc, previousSave, "level", String.valueOf(level));
        createXMLElementWithValue(doc, previousSave, "money", String.valueOf(money));
        createXMLElementWithValue(doc, previousSave, "arcaneEssences", String.valueOf(arcaneEssences));
        createXMLElementWithValue(doc, previousSave, "versionNumber", Main.VERSION_NUMBER);
        createXMLElementWithValue(doc, previousSave, "lastQuickSaveName", lastQuickSaveName);
        // Game settings:
        Element settings = doc.createElement("settings");
        properties.appendChild(settings);
        createXMLElementWithValue(doc, settings, "fontSize", String.valueOf(fontSize));
        createXMLElementWithValue(doc, settings, "lightTheme", String.valueOf(lightTheme));
        createXMLElementWithValue(doc, settings, "furryTailPenetrationContent", String.valueOf(furryTailPenetrationContent));
        createXMLElementWithValue(doc, settings, "nonConContent", String.valueOf(nonConContent));
        createXMLElementWithValue(doc, settings, "incestContent", String.valueOf(incestContent));
        createXMLElementWithValue(doc, settings, "inflationContent", String.valueOf(inflationContent));
        createXMLElementWithValue(doc, settings, "facialHairContent", String.valueOf(facialHairContent));
        createXMLElementWithValue(doc, settings, "pubicHairContent", String.valueOf(pubicHairContent));
        createXMLElementWithValue(doc, settings, "bodyHairContent", String.valueOf(bodyHairContent));
        createXMLElementWithValue(doc, settings, "feminineBeardsContent", String.valueOf(feminineBeardsContent));
        createXMLElementWithValue(doc, settings, "overwriteWarning", String.valueOf(overwriteWarning));
        createXMLElementWithValue(doc, settings, "fadeInText", String.valueOf(fadeInText));
        createXMLElementWithValue(doc, settings, "calendarDisplay", String.valueOf(calendarDisplay));
        createXMLElementWithValue(doc, settings, "twentyFourHourTime", String.valueOf(twentyFourHourTime));
        createXMLElementWithValue(doc, settings, "androgynousIdentification", String.valueOf(androgynousIdentification));
        createXMLElementWithValue(doc, settings, "humanEncountersLevel", String.valueOf(humanEncountersLevel));
        createXMLElementWithValue(doc, settings, "multiBreasts", String.valueOf(multiBreasts));
        createXMLElementWithValue(doc, settings, "forcedTFPercentage", String.valueOf(forcedTFPercentage));
        createXMLElementWithValue(doc, settings, "pregnancyBreastGrowthVariance", String.valueOf(pregnancyBreastGrowthVariance));
        createXMLElementWithValue(doc, settings, "pregnancyBreastGrowth", String.valueOf(pregnancyBreastGrowth));
        createXMLElementWithValue(doc, settings, "pregnancyBreastGrowthLimit", String.valueOf(pregnancyBreastGrowthLimit));
        createXMLElementWithValue(doc, settings, "pregnancyLactationIncreaseVariance", String.valueOf(pregnancyLactationIncreaseVariance));
        createXMLElementWithValue(doc, settings, "pregnancyLactationIncrease", String.valueOf(pregnancyLactationIncrease));
        createXMLElementWithValue(doc, settings, "pregnancyLactationLimit", String.valueOf(pregnancyLactationLimit));
        createXMLElementWithValue(doc, settings, "forcedFetishPercentage", String.valueOf(forcedFetishPercentage));
        createXMLElementWithValue(doc, settings, "newWeaponDiscovered", String.valueOf(newWeaponDiscovered));
        createXMLElementWithValue(doc, settings, "newClothingDiscovered", String.valueOf(newClothingDiscovered));
        createXMLElementWithValue(doc, settings, "newItemDiscovered", String.valueOf(newItemDiscovered));
        createXMLElementWithValue(doc, settings, "newRaceDiscovered", String.valueOf(newRaceDiscovered));
        createXMLElementWithValue(doc, settings, "difficultyLevel", difficultyLevel.toString());
        // Game key binds:
        Element keyBinds = doc.createElement("keyBinds");
        properties.appendChild(keyBinds);
        for (KeyboardAction ka : KeyboardAction.values()) {
            Element element = doc.createElement("binding");
            keyBinds.appendChild(element);
            Attr bindName = doc.createAttribute("bindName");
            bindName.setValue(ka.toString());
            element.setAttributeNode(bindName);
            Attr primaryBind = doc.createAttribute("primaryBind");
            if (hotkeyMapPrimary.get(ka) != null)
                primaryBind.setValue(hotkeyMapPrimary.get(ka).toString());
            else
                primaryBind.setValue("");
            element.setAttributeNode(primaryBind);
            Attr secondaryBind = doc.createAttribute("secondaryBind");
            if (hotkeyMapSecondary.get(ka) != null)
                secondaryBind.setValue(hotkeyMapSecondary.get(ka).toString());
            else
                secondaryBind.setValue("");
            element.setAttributeNode(secondaryBind);
        }
        // Gender names:
        Element genderNames = doc.createElement("genderNames");
        properties.appendChild(genderNames);
        for (GenderNames gp : GenderNames.values()) {
            Element element = doc.createElement("genderName");
            genderNames.appendChild(element);
            Attr pronounName = doc.createAttribute("name");
            pronounName.setValue(gp.toString());
            element.setAttributeNode(pronounName);
            Attr feminineValue = doc.createAttribute("feminineValue");
            if (genderNameFemale.get(gp) != null) {
                feminineValue.setValue(genderNameFemale.get(gp));
            } else {
                feminineValue.setValue(gp.getFeminine());
            }
            element.setAttributeNode(feminineValue);
            Attr masculineValue = doc.createAttribute("masculineValue");
            if (genderNameMale.get(gp) != null) {
                masculineValue.setValue(genderNameMale.get(gp));
            } else {
                masculineValue.setValue(gp.getMasculine());
            }
            element.setAttributeNode(masculineValue);
            Attr neutralValue = doc.createAttribute("neutralValue");
            if (genderNameNeutral.get(gp) != null) {
                neutralValue.setValue(genderNameNeutral.get(gp));
            } else {
                neutralValue.setValue(gp.getNeutral());
            }
            element.setAttributeNode(neutralValue);
        }
        // Gender pronouns:
        Element pronouns = doc.createElement("genderPronouns");
        properties.appendChild(pronouns);
        for (GenderPronoun gp : GenderPronoun.values()) {
            Element element = doc.createElement("pronoun");
            pronouns.appendChild(element);
            Attr pronounName = doc.createAttribute("pronounName");
            pronounName.setValue(gp.toString());
            element.setAttributeNode(pronounName);
            Attr feminineValue = doc.createAttribute("feminineValue");
            if (genderPronounFemale.get(gp) != null)
                feminineValue.setValue(genderPronounFemale.get(gp));
            else
                feminineValue.setValue(gp.getFeminine());
            element.setAttributeNode(feminineValue);
            Attr masculineValue = doc.createAttribute("masculineValue");
            if (genderPronounMale.get(gp) != null)
                masculineValue.setValue(genderPronounMale.get(gp));
            else
                masculineValue.setValue(gp.getMasculine());
            element.setAttributeNode(masculineValue);
        }
        // Gender preferences:
        Element genderPreferences = doc.createElement("genderPreferences");
        properties.appendChild(genderPreferences);
        for (Gender g : Gender.values()) {
            Element element = doc.createElement("preference");
            genderPreferences.appendChild(element);
            Attr gender = doc.createAttribute("gender");
            gender.setValue(g.toString());
            element.setAttributeNode(gender);
            Attr value = doc.createAttribute("value");
            value.setValue(String.valueOf(genderPreferencesMap.get(g).intValue()));
            element.setAttributeNode(value);
        }
        // Forced TF settings:
        createXMLElementWithValue(doc, settings, "forcedTFPreference", String.valueOf(forcedTFPreference));
        createXMLElementWithValue(doc, settings, "forcedTFTendency", String.valueOf(forcedTFTendency));
        createXMLElementWithValue(doc, settings, "forcedFetishTendency", String.valueOf(forcedFetishTendency));
        // Race preferences:
        Element racePreferences = doc.createElement("subspeciesPreferences");
        properties.appendChild(racePreferences);
        for (Subspecies s : Subspecies.values()) {
            Element element = doc.createElement("preferenceFeminine");
            racePreferences.appendChild(element);
            Attr race = doc.createAttribute("subspecies");
            race.setValue(s.toString());
            element.setAttributeNode(race);
            Attr preference = doc.createAttribute("preference");
            preference.setValue(subspeciesFemininePreferencesMap.get(s).toString());
            element.setAttributeNode(preference);
            preference = doc.createAttribute("furryPreference");
            preference.setValue(subspeciesFeminineFurryPreferencesMap.get(s).toString());
            element.setAttributeNode(preference);
            element = doc.createElement("preferenceMasculine");
            racePreferences.appendChild(element);
            race = doc.createAttribute("subspecies");
            race.setValue(s.toString());
            element.setAttributeNode(race);
            preference = doc.createAttribute("preference");
            preference.setValue(subspeciesMasculinePreferencesMap.get(s).toString());
            element.setAttributeNode(preference);
            preference = doc.createAttribute("furryPreference");
            preference.setValue(subspeciesMasculineFurryPreferencesMap.get(s).toString());
            element.setAttributeNode(preference);
        }
        // Discoveries:
        Element itemsDiscovered = doc.createElement("itemsDiscovered");
        properties.appendChild(itemsDiscovered);
        for (AbstractItemType itemType : this.itemsDiscovered) {
            Element element = doc.createElement("itemType");
            itemsDiscovered.appendChild(element);
            Attr hash = doc.createAttribute("id");
            hash.setValue(itemType.getId());
            element.setAttributeNode(hash);
        }
        Element weaponsDiscovered = doc.createElement("weaponsDiscovered");
        properties.appendChild(weaponsDiscovered);
        for (AbstractWeaponType weaponType : this.weaponsDiscovered) {
            Element element = doc.createElement("weaponType");
            weaponsDiscovered.appendChild(element);
            Attr hash = doc.createAttribute("id");
            hash.setValue(weaponType.getId());
            element.setAttributeNode(hash);
        }
        Element clothingDiscovered = doc.createElement("clothingDiscovered");
        properties.appendChild(clothingDiscovered);
        for (AbstractClothingType clothingType : this.clothingDiscovered) {
            Element element = doc.createElement("clothingType");
            clothingDiscovered.appendChild(element);
            Attr hash = doc.createAttribute("id");
            if (clothingType != null)
                hash.setValue(clothingType.getId());
            element.setAttributeNode(hash);
        }
        Element racesDiscovered = doc.createElement("racesDiscovered");
        properties.appendChild(racesDiscovered);
        for (Race race : Race.values()) {
            Element element = doc.createElement("raceDiscovery");
            racesDiscovered.appendChild(element);
            Attr discovered = doc.createAttribute("race");
            discovered.setValue(race.toString());
            element.setAttributeNode(discovered);
            discovered = doc.createAttribute("discovered");
            discovered.setValue(String.valueOf(this.racesDiscovered.contains(race)));
            element.setAttributeNode(discovered);
            discovered = doc.createAttribute("advancedKnowledge");
            discovered.setValue(String.valueOf(this.racesAdvancedKnowledge.contains(race)));
            element.setAttributeNode(discovered);
        }
        // Write out to properties.xml:
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer();
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
        DOMSource source = new DOMSource(doc);
        StreamResult result = new StreamResult(new File("data/properties.xml"));
        transformer.transform(source, result);
    } catch (ParserConfigurationException | TransformerException e) {
        e.printStackTrace();
    }
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) KeyboardAction(com.lilithsthrone.game.settings.KeyboardAction) TransformerFactory(javax.xml.transform.TransformerFactory) Transformer(javax.xml.transform.Transformer) StreamResult(javax.xml.transform.stream.StreamResult) Element(org.w3c.dom.Element) Gender(com.lilithsthrone.game.character.gender.Gender) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr) Subspecies(com.lilithsthrone.game.character.race.Subspecies) AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) GenderPronoun(com.lilithsthrone.game.character.gender.GenderPronoun) DocumentBuilder(javax.xml.parsers.DocumentBuilder) AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) Race(com.lilithsthrone.game.character.race.Race) AbstractWeaponType(com.lilithsthrone.game.inventory.weapon.AbstractWeaponType) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) GenderNames(com.lilithsthrone.game.character.gender.GenderNames) File(java.io.File) TransformerException(javax.xml.transform.TransformerException)

Example 3 with Race

use of com.lilithsthrone.game.character.race.Race in project liliths-throne-public by Innoxia.

the class PlayerCharacter method saveAsXML.

@Override
public Element saveAsXML(Element parentElement, Document doc) {
    Element properties = super.saveAsXML(parentElement, doc);
    Element playerSpecific = doc.createElement("playerSpecific");
    properties.appendChild(playerSpecific);
    CharacterUtils.createXMLElementWithValue(doc, playerSpecific, "title", this.getTitle());
    CharacterUtils.createXMLElementWithValue(doc, playerSpecific, "karma", String.valueOf(this.getKarma()));
    Element questUpdatesElement = doc.createElement("questUpdates");
    playerSpecific.appendChild(questUpdatesElement);
    CharacterUtils.createXMLElementWithValue(doc, playerSpecific, "mainQuestUpdated", String.valueOf(this.mainQuestUpdated));
    CharacterUtils.createXMLElementWithValue(doc, playerSpecific, "sideQuestUpdated", String.valueOf(this.sideQuestUpdated));
    CharacterUtils.createXMLElementWithValue(doc, playerSpecific, "romanceQuestUpdated", String.valueOf(this.romanceQuestUpdated));
    Element innerElement = doc.createElement("racesDiscovered");
    playerSpecific.appendChild(innerElement);
    for (Race race : racesDiscoveredFromBook) {
        if (race != null) {
            CharacterUtils.createXMLElementWithValue(doc, innerElement, "race", race.toString());
        }
    }
    Element charactersEncounteredElement = doc.createElement("charactersEncountered");
    playerSpecific.appendChild(charactersEncounteredElement);
    for (String id : charactersEncountered) {
        CharacterUtils.createXMLElementWithValue(doc, charactersEncounteredElement, "id", id);
    }
    innerElement = doc.createElement("questMap");
    playerSpecific.appendChild(innerElement);
    for (Entry<QuestLine, Quest> entry : quests.entrySet()) {
        Element e = doc.createElement("entry");
        innerElement.appendChild(e);
        CharacterUtils.addAttribute(doc, e, "questLine", entry.getKey().toString());
        CharacterUtils.addAttribute(doc, e, "quest", String.valueOf(entry.getValue()));
    }
    return properties;
}
Also used : Element(org.w3c.dom.Element) Race(com.lilithsthrone.game.character.race.Race) QuestLine(com.lilithsthrone.game.character.quests.QuestLine) Quest(com.lilithsthrone.game.character.quests.Quest)

Example 4 with Race

use of com.lilithsthrone.game.character.race.Race in project liliths-throne-public by Innoxia.

the class PhoneDialogue method resetContentForRaces.

public static void resetContentForRaces() {
    title = "Races";
    StringBuilder contentSB = new StringBuilder("<p style='text-align:center;'>You have encountered the following races in your travels:</p>");
    racesDiscovered.clear();
    for (Race r : Race.values()) {
        if (Main.getProperties().isRaceDiscovered(r)) {
            racesDiscovered.add(r);
            contentSB.append("<p style='text-align:center;'><b style='color:" + r.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(r.getName()) + "</b></p>");
        }
    }
    racesDiscovered.sort(Comparator.comparing(Race::getName));
    content = contentSB.toString();
}
Also used : Race(com.lilithsthrone.game.character.race.Race)

Example 5 with Race

use of com.lilithsthrone.game.character.race.Race in project liliths-throne-public by Innoxia.

the class Body method calculateRace.

/**
 * To be called after every transformation. Returns the body's race.
 */
public void calculateRace() {
    raceWeightMap.clear();
    Race race = Race.HUMAN;
    if (this.getBodyMaterial() == BodyMaterial.SLIME) {
        race = Race.SLIME;
        this.raceStage = RaceStage.GREATER;
    } else {
        race = getRaceFromPartWeighting();
        if (raceWeightMap.size() == 1) {
            if (raceWeightMap.containsKey(Race.HUMAN)) {
                this.raceStage = RaceStage.HUMAN;
            } else {
                this.raceStage = RaceStage.GREATER;
            }
        } else {
            this.raceStage = RaceStage.LESSER;
        }
    }
    subspecies = Subspecies.getSubspeciesFromBody(this, race);
}
Also used : Race(com.lilithsthrone.game.character.race.Race)

Aggregations

Race (com.lilithsthrone.game.character.race.Race)6 Element (org.w3c.dom.Element)2 Gender (com.lilithsthrone.game.character.gender.Gender)1 GenderNames (com.lilithsthrone.game.character.gender.GenderNames)1 GenderPronoun (com.lilithsthrone.game.character.gender.GenderPronoun)1 Quest (com.lilithsthrone.game.character.quests.Quest)1 QuestLine (com.lilithsthrone.game.character.quests.QuestLine)1 Subspecies (com.lilithsthrone.game.character.race.Subspecies)1 AbstractClothingType (com.lilithsthrone.game.inventory.clothing.AbstractClothingType)1 AbstractItemType (com.lilithsthrone.game.inventory.item.AbstractItemType)1 AbstractWeaponType (com.lilithsthrone.game.inventory.weapon.AbstractWeaponType)1 KeyboardAction (com.lilithsthrone.game.settings.KeyboardAction)1 File (java.io.File)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 Transformer (javax.xml.transform.Transformer)1 TransformerException (javax.xml.transform.TransformerException)1 TransformerFactory (javax.xml.transform.TransformerFactory)1 DOMSource (javax.xml.transform.dom.DOMSource)1