Search in sources :

Example 1 with TFPotency

use of com.lilithsthrone.game.inventory.enchanting.TFPotency in project liliths-throne-public by Innoxia.

the class MainController method manageMainListeners.

private void manageMainListeners() {
    document = (Document) webEngine.executeScript("document");
    EventListenerDataMap.put(document, new ArrayList<>());
    String id = "";
    if (flashMessageColour != null && flashMessageText != null) {
        Main.game.flashMessage(flashMessageColour, flashMessageText);
        flashMessageColour = null;
        flashMessageText = null;
    }
    if (((EventTarget) document.getElementById("copy-content-button")) != null) {
        addEventListener(document, "copy-content-button", "click", copyDialogueButtonListener, false);
        addEventListener(document, "copy-content-button", "mousemove", moveTooltipListener, false);
        addEventListener(document, "copy-content-button", "mouseleave", hideTooltipListener, false);
        addEventListener(document, "copy-content-button", "mouseenter", copyInfoListener, false);
    }
    if (((EventTarget) document.getElementById("export-character-button")) != null) {
        addEventListener(document, "export-character-button", "click", e -> {
            if (Main.game.getCurrentDialogueNode().equals(CharactersPresentDialogue.MENU)) {
                Game.exportCharacter(CharactersPresentDialogue.characterViewed);
            } else {
                Game.exportCharacter(Main.game.getPlayer());
            }
            Main.game.flashMessage(Colour.GENERIC_EXCELLENT, "Character Exported!");
        }, false);
        addEventListener(document, "export-character-button", "mousemove", moveTooltipListener, false);
        addEventListener(document, "export-character-button", "mouseleave", hideTooltipListener, false);
        addEventListener(document, "export-character-button", "mouseenter", new TooltipInformationEventListener().setInformation("Export Character", "Export the currently displayed character to the 'data/characters' folder. Exported characters can be imported at the auction block in Slaver Alley."), false);
    }
    if (Main.game.getCurrentDialogueNode().equals(DebugDialogue.SPAWN_MENU)) {
        id = "";
        for (AbstractClothingType clothingType : DebugDialogue.clothingTotal) {
            id = clothingType.getId() + "_SPAWN";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getInventory().addClothing(AbstractClothingType.generateClothing(clothingType));
                    this.updateUIRightPanel();
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el = new InventoryTooltipEventListener().setGenericClothing(clothingType, clothingType.getAvailablePrimaryColours().get(0));
                addEventListener(document, id, "mouseenter", el, false);
            }
        }
        for (AbstractWeaponType weaponType : DebugDialogue.weaponsTotal) {
            id = weaponType.getId() + "_SPAWN";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getInventory().addWeapon(AbstractWeaponType.generateWeapon(weaponType));
                    this.updateUIRightPanel();
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el = new InventoryTooltipEventListener().setGenericWeapon(weaponType, weaponType.getAvailableDamageTypes().get(0));
                addEventListener(document, id, "mouseenter", el, false);
            }
        }
        for (AbstractItemType itemType : DebugDialogue.itemsTotal) {
            id = itemType.getId() + "_SPAWN";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getInventory().addItem(AbstractItemType.generateItem(itemType));
                    this.updateUIRightPanel();
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el = new InventoryTooltipEventListener().setGenericItem(itemType);
                addEventListener(document, id, "mouseenter", el, false);
            }
        }
        for (InventorySlot slot : InventorySlot.values()) {
            id = slot + "_SPAWN_SELECT";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    DebugDialogue.activeSlot = slot;
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
        }
        id = "ITEM_SPAWN_SELECT";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                DebugDialogue.activeSlot = null;
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
    }
    if (Main.game.getCurrentDialogueNode() == CharacterCreation.BACKGROUND_SELECTION_MENU) {
        for (History history : History.values()) {
            id = "HISTORY_" + history;
            if (((EventTarget) document.getElementById(id)) != null) {
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setPerk(history.getAssociatedPerk(), Main.game.getPlayer()), false);
                ((EventTarget) document.getElementById(id)).addEventListener("click", event -> {
                    Main.game.getPlayer().setHistory(history);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
        }
    }
    if (Main.game.isStarted()) {
        id = "";
        // Equipped inventory:
        // For weapons:
        InventorySlot[] inventorySlots = { InventorySlot.WEAPON_MAIN, InventorySlot.WEAPON_OFFHAND };
        for (InventorySlot invSlot : inventorySlots) {
            id = "PLAYER_" + invSlot.toString() + "Slot";
            if (((EventTarget) document.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponEquipped(Main.game.getPlayer(), invSlot);
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
                addEventListener(document, id, "mouseenter", el2, false);
            }
            id = "NPC_" + invSlot.toString() + "Slot";
            if (((EventTarget) document.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponEquipped(InventoryDialogue.getInventoryNPC(), invSlot);
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, InventoryDialogue.getInventoryNPC());
                addEventListener(document, id, "mouseenter", el2, false);
            }
            id = "NPC_VIEW_" + invSlot.toString() + "Slot";
            if (((EventTarget) document.getElementById(id)) != null) {
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, CharactersPresentDialogue.characterViewed);
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        // For all equipped clothing slots:
        for (InventorySlot invSlot : InventorySlot.values()) {
            id = "PLAYER_" + invSlot.toString() + "Slot";
            if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingEquipped(Main.game.getPlayer(), invSlot);
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            id = "NPC_" + invSlot.toString() + "Slot";
            if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingEquipped(InventoryDialogue.getInventoryNPC(), invSlot);
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, InventoryDialogue.getInventoryNPC());
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            id = "NPC_VIEW_" + invSlot.toString() + "Slot";
            if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, CharactersPresentDialogue.characterViewed);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
        }
        // Gifts:
        if (Main.game.getCurrentDialogueNode().equals(GiftDialogue.GIFT_DIALOGUE)) {
            for (Entry<AbstractWeapon, Integer> entry : Main.game.getPlayer().getMapOfDuplicateWeapons().entrySet()) {
                id = "GIFT_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("Give Gift", ":3", GiftDialogue.getDialogueToProceedTo()) {

                            @Override
                            public void effects() {
                                Main.game.getTextStartStringBuilder().append(GiftDialogue.getReceiver().getGiftReaction(entry.getKey(), true));
                                Main.game.getPlayer().removeWeapon(entry.getKey());
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setWeapon(entry.getKey(), Main.game.getPlayer());
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            for (Entry<AbstractItem, Integer> entry : Main.game.getPlayer().getMapOfDuplicateItems().entrySet()) {
                id = "GIFT_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("Give Gift", ":3", GiftDialogue.getDialogueToProceedTo()) {

                            @Override
                            public void effects() {
                                Main.game.getTextStartStringBuilder().append(GiftDialogue.getReceiver().getGiftReaction(entry.getKey(), true));
                                Main.game.getPlayer().removeItem(entry.getKey());
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setItem(entry.getKey(), Main.game.getPlayer(), null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            for (Entry<AbstractClothing, Integer> entry : Main.game.getPlayer().getMapOfDuplicateClothing().entrySet()) {
                id = "GIFT_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("Give Gift", ":3", GiftDialogue.getDialogueToProceedTo()) {

                            @Override
                            public void effects() {
                                Main.game.getTextStartStringBuilder().append(GiftDialogue.getReceiver().getGiftReaction(entry.getKey(), true));
                                Main.game.getPlayer().removeClothing(entry.getKey());
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setClothing(entry.getKey(), Main.game.getPlayer(), null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
        }
        // Player:
        for (Entry<AbstractWeapon, Integer> entry : Main.game.getPlayer().getMapOfDuplicateWeapons().entrySet()) {
            id = "PLAYER_WEAPON_" + entry.getKey().hashCode();
            if (((EventTarget) document.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponInventory(entry.getKey(), Main.game.getPlayer());
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setWeapon(entry.getKey(), Main.game.getPlayer());
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        for (Entry<AbstractItem, Integer> entry : Main.game.getPlayer().getMapOfDuplicateItems().entrySet()) {
            id = "PLAYER_ITEM_" + entry.getKey().hashCode();
            if (((EventTarget) document.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setItemInventory(entry.getKey(), Main.game.getPlayer());
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setItem(entry.getKey(), Main.game.getPlayer(), null);
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        for (Entry<AbstractClothing, Integer> entry : Main.game.getPlayer().getMapOfDuplicateClothing().entrySet()) {
            id = "PLAYER_CLOTHING_" + entry.getKey().hashCode();
            if (((EventTarget) document.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingInventory(entry.getKey(), Main.game.getPlayer());
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setClothing(entry.getKey(), Main.game.getPlayer(), null);
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        // Partner:
        if (InventoryDialogue.getInventoryNPC() != null) {
            String idModifier = "NPC_" + InventoryDialogue.getInventoryNPC().getId() + "_";
            for (Entry<AbstractWeapon, Integer> entry : InventoryDialogue.getInventoryNPC().getMapOfDuplicateWeapons().entrySet()) {
                id = idModifier + "WEAPON_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponInventory(entry.getKey(), InventoryDialogue.getInventoryNPC());
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setWeapon(entry.getKey(), InventoryDialogue.getInventoryNPC());
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            for (Entry<AbstractClothing, Integer> entry : InventoryDialogue.getInventoryNPC().getMapOfDuplicateClothing().entrySet()) {
                id = idModifier + "CLOTHING_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingInventory(entry.getKey(), InventoryDialogue.getInventoryNPC());
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setClothing(entry.getKey(), InventoryDialogue.getInventoryNPC(), null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            for (Entry<AbstractItem, Integer> entry : InventoryDialogue.getInventoryNPC().getMapOfDuplicateItems().entrySet()) {
                id = idModifier + "ITEM_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setItemInventory(entry.getKey(), InventoryDialogue.getInventoryNPC());
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setItem(entry.getKey(), InventoryDialogue.getInventoryNPC(), null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
        // Floor:
        } else {
            // Weapons on floor:
            for (Entry<AbstractWeapon, Integer> entry : Main.game.getPlayerCell().getInventory().getMapOfDuplicateWeapons().entrySet()) {
                id = "WEAPON_FLOOR_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponInventory(entry.getKey(), null);
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setWeapon(entry.getKey(), null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            // Clothing on floor:
            for (Entry<AbstractClothing, Integer> entry : Main.game.getPlayerCell().getInventory().getMapOfDuplicateClothing().entrySet()) {
                id = "CLOTHING_FLOOR_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingInventory(entry.getKey(), null);
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setClothing(entry.getKey(), null, null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            // Items on floor:
            for (Entry<AbstractItem, Integer> entry : Main.game.getPlayerCell().getInventory().getMapOfDuplicateItems().entrySet()) {
                id = "ITEM_FLOOR_" + entry.getKey().hashCode();
                if (((EventTarget) document.getElementById(id)) != null) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setItemInventory(entry.getKey(), null);
                    addEventListener(document, id, "click", el, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setItem(entry.getKey(), null, null);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
        }
        if (InventoryDialogue.getNPCInventoryInteraction() == InventoryInteraction.TRADING) {
            if (InventoryDialogue.getInventoryNPC() != null) {
                // Buyback panel:
                for (int i = Main.game.getPlayer().getBuybackStack().size() - 1; i >= 0; i--) {
                    if (((EventTarget) document.getElementById("WEAPON_" + i)) != null) {
                        InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponInventory((AbstractWeapon) Main.game.getPlayer().getBuybackStack().get(i).getAbstractItemSold(), InventoryDialogue.getInventoryNPC(), i);
                        ((EventTarget) document.getElementById("WEAPON_" + i)).addEventListener("click", el, false);
                        addEventListener(document, "WEAPON_" + i, "mousemove", moveTooltipListener, false);
                        addEventListener(document, "WEAPON_" + i, "mouseleave", hideTooltipListener, false);
                        InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setWeapon((AbstractWeapon) Main.game.getPlayer().getBuybackStack().get(i).getAbstractItemSold(), InventoryDialogue.getInventoryNPC());
                        ((EventTarget) document.getElementById("WEAPON_" + i)).addEventListener("mouseenter", el2, false);
                    }
                    if (((EventTarget) document.getElementById("CLOTHING_" + i)) != null) {
                        InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingInventory((AbstractClothing) Main.game.getPlayer().getBuybackStack().get(i).getAbstractItemSold(), InventoryDialogue.getInventoryNPC(), i);
                        addEventListener(document, "CLOTHING_" + i, "click", el, false);
                        addEventListener(document, "CLOTHING_" + i, "mousemove", moveTooltipListener, false);
                        addEventListener(document, "CLOTHING_" + i, "mouseleave", hideTooltipListener, false);
                        InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setClothing((AbstractClothing) Main.game.getPlayer().getBuybackStack().get(i).getAbstractItemSold(), InventoryDialogue.getInventoryNPC(), null);
                        addEventListener(document, "CLOTHING_" + i, "mouseenter", el2, false);
                    }
                    if (((EventTarget) document.getElementById("ITEM_" + i)) != null) {
                        InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setItemInventory((AbstractItem) Main.game.getPlayer().getBuybackStack().get(i).getAbstractItemSold(), InventoryDialogue.getInventoryNPC(), i);
                        addEventListener(document, "ITEM_" + i, "click", el, false);
                        addEventListener(document, "ITEM_" + i, "mousemove", moveTooltipListener, false);
                        addEventListener(document, "ITEM_" + i, "mouseleave", hideTooltipListener, false);
                        InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setItem((AbstractItem) Main.game.getPlayer().getBuybackStack().get(i).getAbstractItemSold(), InventoryDialogue.getInventoryNPC(), null);
                        addEventListener(document, "ITEM_" + i, "mouseenter", el2, false);
                    }
                }
            }
        }
        for (TFEssence essence : TFEssence.values()) {
            if (((EventTarget) document.getElementById("ESSENCE_" + essence.hashCode())) != null) {
                addEventListener(document, "ESSENCE_" + essence.hashCode(), "mousemove", moveTooltipListener, false);
                addEventListener(document, "ESSENCE_" + essence.hashCode(), "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setEssence(essence);
                addEventListener(document, "ESSENCE_" + essence.hashCode(), "mouseenter", el2, false);
            }
            if (((EventTarget) document.getElementById("ESSENCE_COST_" + essence.hashCode())) != null) {
                addEventListener(document, "ESSENCE_COST_" + essence.hashCode(), "mousemove", moveTooltipListener, false);
                addEventListener(document, "ESSENCE_COST_" + essence.hashCode(), "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setEssence(essence);
                addEventListener(document, "ESSENCE_COST_" + essence.hashCode(), "mouseenter", el2, false);
            }
        }
        // Tooltips:
        if (((EventTarget) document.getElementById("MOD_PRIMARY_ENCHANTING")) != null) {
            EnchantmentEventListener el = new EnchantmentEventListener().setPrimaryModifier(TFModifier.NONE);
            addEventListener(document, "MOD_PRIMARY_ENCHANTING", "click", el, false);
            addEventListener(document, "MOD_PRIMARY_ENCHANTING", "mousemove", moveTooltipListener, false);
            addEventListener(document, "MOD_PRIMARY_ENCHANTING", "mouseleave", hideTooltipListener, false);
            InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setTFModifier(EnchantmentDialogue.primaryMod);
            addEventListener(document, "MOD_PRIMARY_ENCHANTING", "mouseenter", el2, false);
        }
        if (((EventTarget) document.getElementById("MOD_SECONDARY_ENCHANTING")) != null) {
            EnchantmentEventListener el = new EnchantmentEventListener().setSecondaryModifier(TFModifier.NONE);
            addEventListener(document, "MOD_SECONDARY_ENCHANTING", "click", el, false);
            addEventListener(document, "MOD_SECONDARY_ENCHANTING", "mousemove", moveTooltipListener, false);
            addEventListener(document, "MOD_SECONDARY_ENCHANTING", "mouseleave", hideTooltipListener, false);
            InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setTFModifier(EnchantmentDialogue.secondaryMod);
            addEventListener(document, "MOD_SECONDARY_ENCHANTING", "mouseenter", el2, false);
        }
        for (TFPotency potency : TFPotency.values()) {
            id = "POTENCY_" + potency;
            if (((EventTarget) document.getElementById(id)) != null) {
                EnchantmentEventListener el = new EnchantmentEventListener().setPotency(potency);
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setTFPotency(potency);
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        for (int effectCount = 0; effectCount < EnchantmentDialogue.effects.size(); effectCount++) {
            id = "DELETE_EFFECT_" + effectCount;
            if (((EventTarget) document.getElementById(id)) != null) {
                EnchantmentEventListener el = new EnchantmentEventListener().removeEffect(effectCount);
                addEventListener(document, id, "click", el, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Delete Effect", "");
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        id = "LIMIT_MINIMUM";
        if (((EventTarget) document.getElementById(id)) != null) {
            if (EnchantmentDialogue.limit > 0) {
                EnchantmentEventListener el = new EnchantmentEventListener().setLimit(0);
                addEventListener(document, id, "click", el, false);
            }
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation((EnchantmentDialogue.limit == 0 ? "Minimum Limit Reached" : "Limit Minimum"), "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "LIMIT_DECREASE_LARGE";
        if (((EventTarget) document.getElementById(id)) != null) {
            if (EnchantmentDialogue.limit > 0) {
                EnchantmentEventListener el = new EnchantmentEventListener().setLimit(Math.max(0, EnchantmentDialogue.limit - (EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod) / 10)));
                addEventListener(document, id, "click", el, false);
            }
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation((EnchantmentDialogue.limit == 0 ? "Minimum Limit Reached" : "Large Limit Decrease"), "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "LIMIT_DECREASE";
        if (((EventTarget) document.getElementById(id)) != null) {
            if (EnchantmentDialogue.limit > 0) {
                EnchantmentEventListener el = new EnchantmentEventListener().setLimit(EnchantmentDialogue.limit - 1);
                addEventListener(document, id, "click", el, false);
            }
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation((EnchantmentDialogue.limit == 0 ? "Minimum Limit Reached" : "Limit Decrease"), "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "LIMIT_INCREASE";
        if (((EventTarget) document.getElementById(id)) != null) {
            if (EnchantmentDialogue.limit < EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod)) {
                EnchantmentEventListener el = new EnchantmentEventListener().setLimit(EnchantmentDialogue.limit + 1);
                addEventListener(document, id, "click", el, false);
            }
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation((EnchantmentDialogue.limit < EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod) ? "Limit Increase" : "Maximum Limit Reached"), "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "LIMIT_INCREASE_LARGE";
        if (((EventTarget) document.getElementById(id)) != null) {
            int limit = EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod);
            if (EnchantmentDialogue.limit < limit) {
                EnchantmentEventListener el = new EnchantmentEventListener().setLimit(Math.min(limit, EnchantmentDialogue.limit + (limit / 10)));
                addEventListener(document, id, "click", el, false);
            }
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation((EnchantmentDialogue.limit < EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod) ? "Large Limit Increase" : "Maximum Limit Reached"), "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "LIMIT_MAXIMUM";
        if (((EventTarget) document.getElementById(id)) != null) {
            if (EnchantmentDialogue.limit < EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod)) {
                EnchantmentEventListener el = new EnchantmentEventListener().setLimit(EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod));
                addEventListener(document, id, "click", el, false);
            }
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation((EnchantmentDialogue.limit < EnchantmentDialogue.ingredient.getEnchantmentEffect().getLimits(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod) ? "Set Limit To Maximum" : "Maximum Limit Reached"), "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        // Ingredient icon:
        if (((EventTarget) document.getElementById("INGREDIENT_ENCHANTING")) != null) {
            ((EventTarget) document.getElementById("INGREDIENT_ENCHANTING")).addEventListener("click", e -> {
                Main.game.setResponseTab(1);
                if (EnchantmentDialogue.ingredient instanceof AbstractItem) {
                    Main.game.setContent(new Response("Back", "Stop enchanting.", InventoryDialogue.ITEM_INVENTORY) {

                        @Override
                        public void effects() {
                            EnchantmentDialogue.resetEnchantmentVariables();
                        }
                    });
                } else if (EnchantmentDialogue.ingredient instanceof AbstractClothing) {
                    Main.game.setContent(new Response("Back", "Stop enchanting.", InventoryDialogue.CLOTHING_INVENTORY) {

                        @Override
                        public void effects() {
                            EnchantmentDialogue.resetEnchantmentVariables();
                        }
                    });
                } else {
                    Main.game.setContent(new Response("Back", "Stop enchanting.", InventoryDialogue.WEAPON_INVENTORY) {

                        @Override
                        public void effects() {
                            EnchantmentDialogue.resetEnchantmentVariables();
                        }
                    });
                }
            }, false);
            addEventListener(document, "INGREDIENT_ENCHANTING", "mousemove", moveTooltipListener, false);
            addEventListener(document, "INGREDIENT_ENCHANTING", "mouseleave", hideTooltipListener, false);
            InventoryTooltipEventListener el2;
            if (EnchantmentDialogue.ingredient instanceof AbstractItem) {
                el2 = new InventoryTooltipEventListener().setItem((AbstractItem) EnchantmentDialogue.ingredient, Main.game.getPlayer(), null);
            } else if (EnchantmentDialogue.ingredient instanceof AbstractClothing) {
                el2 = new InventoryTooltipEventListener().setClothing((AbstractClothing) EnchantmentDialogue.ingredient, Main.game.getPlayer(), null);
            } else {
                el2 = new InventoryTooltipEventListener().setWeapon((AbstractWeapon) EnchantmentDialogue.ingredient, Main.game.getPlayer());
            }
            addEventListener(document, "INGREDIENT_ENCHANTING", "mouseenter", el2, false);
        }
        // Output icon:
        if (((EventTarget) document.getElementById("OUTPUT_ENCHANTING")) != null) {
            ((EventTarget) document.getElementById("OUTPUT_ENCHANTING")).addEventListener("click", e -> {
                if (EnchantmentDialogue.effects.isEmpty()) {
                } else if (EnchantmentDialogue.canAffordCost(EnchantmentDialogue.ingredient, EnchantmentDialogue.effects)) {
                    Main.game.setContent(new ResponseEffectsOnly("Craft", "Craft '" + EnchantingUtils.getPotionName(EnchantmentDialogue.ingredient, EnchantmentDialogue.effects) + "'.") {

                        @Override
                        public void effects() {
                            EnchantmentDialogue.craftItem(EnchantmentDialogue.ingredient, EnchantmentDialogue.effects);
                            if ((EnchantmentDialogue.previousIngredient instanceof AbstractItem ? Main.game.getPlayer().hasItem((AbstractItem) EnchantmentDialogue.previousIngredient) : true) && (EnchantmentDialogue.previousIngredient instanceof AbstractClothing ? Main.game.getPlayer().hasClothing((AbstractClothing) EnchantmentDialogue.previousIngredient) : true) && (EnchantmentDialogue.previousIngredient instanceof AbstractWeapon ? Main.game.getPlayer().hasWeapon((AbstractWeapon) EnchantmentDialogue.previousIngredient) : true)) {
                                EnchantmentDialogue.ingredient = EnchantmentDialogue.previousIngredient;
                                Main.game.setContent(new Response("", "", EnchantmentDialogue.ENCHANTMENT_MENU));
                            } else {
                                Main.game.setContent(new Response("", "", InventoryDialogue.INVENTORY_MENU));
                            }
                        // EnchantmentDialogue.craftItem(EnchantmentDialogue.ingredient, EnchantmentDialogue.effects);
                        // 
                        // if(EnchantmentDialogue.ingredient instanceof AbstractItem) {
                        // if(Main.game.getPlayer().hasItem((AbstractItem) EnchantmentDialogue.previousIngredient)) {
                        // EnchantmentDialogue.ingredient = EnchantmentDialogue.previousIngredient;
                        // Main.game.setContent(new Response("", "", EnchantmentDialogue.ENCHANTMENT_MENU));
                        // } else {
                        // Main.game.setContent(new Response("", "", InventoryDialogue.INVENTORY_MENU));
                        // }
                        // 
                        // } else if(EnchantmentDialogue.ingredient instanceof AbstractClothing) {
                        // if(Main.game.getPlayer().hasClothing((AbstractClothing) EnchantmentDialogue.previousIngredient)) {
                        // EnchantmentDialogue.ingredient = EnchantmentDialogue.previousIngredient;
                        // Main.game.setContent(new Response("", "", EnchantmentDialogue.ENCHANTMENT_MENU));
                        // } else {
                        // Main.game.setContent(new Response("", "", InventoryDialogue.INVENTORY_MENU));
                        // }
                        // 
                        // } else if(EnchantmentDialogue.ingredient instanceof AbstractWeapon) {
                        // if(Main.game.getPlayer().hasWeapon((AbstractWeapon) EnchantmentDialogue.previousIngredient)) {
                        // EnchantmentDialogue.ingredient = EnchantmentDialogue.previousIngredient;
                        // Main.game.setContent(new Response("", "", EnchantmentDialogue.ENCHANTMENT_MENU));
                        // } else {
                        // Main.game.setContent(new Response("", "", InventoryDialogue.INVENTORY_MENU));
                        // }
                        // }
                        }
                    });
                }
            }, false);
            addEventListener(document, "OUTPUT_ENCHANTING", "mousemove", moveTooltipListener, false);
            addEventListener(document, "OUTPUT_ENCHANTING", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Craft", "Click to craft this item!");
            addEventListener(document, "OUTPUT_ENCHANTING", "mouseenter", el2, false);
        }
        // Adding an effect:
        id = "ENCHANT_ADD_BUTTON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                if (EnchantmentDialogue.ingredient.getEnchantmentEffect().getEffectsDescription(EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod, EnchantmentDialogue.potency, EnchantmentDialogue.limit, Main.game.getPlayer(), Main.game.getPlayer()) == null) {
                } else {
                    Main.game.setContent(new Response("Add", "Add the effect.", EnchantmentDialogue.ENCHANTMENT_MENU) {

                        @Override
                        public void effects() {
                            EnchantmentDialogue.effects.add(new ItemEffect(EnchantmentDialogue.ingredient.getEnchantmentEffect(), EnchantmentDialogue.primaryMod, EnchantmentDialogue.secondaryMod, EnchantmentDialogue.potency, EnchantmentDialogue.limit));
                        }
                    });
                }
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Add Effect", "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "ENCHANT_ADD_BUTTON_DISABLED";
        if (((EventTarget) document.getElementById(id)) != null) {
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Add Effect", EnchantmentDialogue.effects.size() >= EnchantmentDialogue.ingredient.getEnchantmentLimit() ? "You have already added the maximum number of effects for this item!" : "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        // Choosing a primary modifier:
        if (EnchantmentDialogue.ingredient != null) {
            for (TFModifier tfMod : EnchantmentDialogue.ingredient.getEnchantmentEffect().getPrimaryModifiers()) {
                if (((EventTarget) document.getElementById("MOD_PRIMARY_" + tfMod.hashCode())) != null) {
                    EnchantmentEventListener el = new EnchantmentEventListener().setPrimaryModifier(tfMod);
                    addEventListener(document, "MOD_PRIMARY_" + tfMod.hashCode(), "click", el, false);
                    addEventListener(document, "MOD_PRIMARY_" + tfMod.hashCode(), "mousemove", moveTooltipListener, false);
                    addEventListener(document, "MOD_PRIMARY_" + tfMod.hashCode(), "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setTFModifier(tfMod);
                    addEventListener(document, "MOD_PRIMARY_" + tfMod.hashCode(), "mouseenter", el2, false);
                }
            }
        }
        // Choosing a secondary modifier:
        if (EnchantmentDialogue.ingredient != null) {
            for (TFModifier tfMod : EnchantmentDialogue.ingredient.getEnchantmentEffect().getSecondaryModifiers(EnchantmentDialogue.primaryMod)) {
                if (((EventTarget) document.getElementById("MOD_SECONDARY_" + tfMod.hashCode())) != null) {
                    EnchantmentEventListener el = new EnchantmentEventListener().setSecondaryModifier(tfMod);
                    addEventListener(document, "MOD_SECONDARY_" + tfMod.hashCode(), "click", el, false);
                    addEventListener(document, "MOD_SECONDARY_" + tfMod.hashCode(), "mousemove", moveTooltipListener, false);
                    addEventListener(document, "MOD_SECONDARY_" + tfMod.hashCode(), "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setTFModifier(tfMod);
                    addEventListener(document, "MOD_SECONDARY_" + tfMod.hashCode(), "mouseenter", el2, false);
                }
            }
        }
        if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.ROOM_MANAGEMENT) {
            for (Cell c : SlaveryManagementDialogue.importantCells) {
                id = c.getId();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                SlaveryManagementDialogue.cellToInspect = c;
                            }

                            @Override
                            public DialogueNodeOld getNextDialogue() {
                                return SlaveryManagementDialogue.ROOM_UPGRADES;
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Room", "Open this room's management screen.");
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = c.getId() + "_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Room", "You are not able to manage this room!");
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = c.getId() + "_PRESENT";
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                SlaveryManagementDialogue.cellToInspect = c;
                            }

                            @Override
                            public DialogueNodeOld getNextDialogue() {
                                return SlaveryManagementDialogue.ROOM_UPGRADES;
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Room", "Open this room's management screen.");
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = c.getId() + "_PRESENT_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Room", "You are not able to manage this room!");
                    addEventListener(document, id, "mouseenter", el, false);
                }
            }
        }
        if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.ROOM_UPGRADES) {
            for (PlaceUpgrade placeUpgrade : PlaceUpgrade.values()) {
                id = placeUpgrade + "_BUY";
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (placeUpgrade != PlaceUpgrade.LILAYA_ARTHUR_ROOM) {
                            Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                                @Override
                                public void effects() {
                                    SlaveryManagementDialogue.cellToInspect.getPlace().addPlaceUpgrade(placeUpgrade);
                                    Main.game.getPlayer().incrementMoney(-placeUpgrade.getInstallCost());
                                }
                            });
                        } else {
                            Main.game.setContent(new Response("", "", LilayaHomeGeneric.ROOM_ARTHUR_INSTALLATION) {

                                @Override
                                public void effects() {
                                    Main.game.getArthur().setLocation(Main.game.getPlayer().getWorldLocation(), Main.game.getPlayer().getLocation(), true);
                                    SlaveryManagementDialogue.cellToInspect.getPlace().addPlaceUpgrade(placeUpgrade);
                                    Main.game.getDialogueFlags().setFlag(DialogueFlagValue.arthursRoomInstalled, true);
                                }
                            });
                        }
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Purchase Modification", "This will cost: " + UtilText.formatAsMoney(placeUpgrade.getInstallCost()) + "</br>" + SlaveryManagementDialogue.getPurchaseAvailabilityTooltipText(SlaveryManagementDialogue.cellToInspect.getPlace(), placeUpgrade));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = placeUpgrade + "_BUY_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Purchase Modification", "This will cost: " + UtilText.formatAsMoney(placeUpgrade.getInstallCost()) + "</br>" + SlaveryManagementDialogue.getPurchaseAvailabilityTooltipText(SlaveryManagementDialogue.cellToInspect.getPlace(), placeUpgrade));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = placeUpgrade + "_SELL";
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                SlaveryManagementDialogue.cellToInspect.getPlace().removePlaceUpgrade(placeUpgrade);
                                Main.game.getPlayer().incrementMoney(-placeUpgrade.getRemovalCost());
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Remove Modification", "This will cost: " + UtilText.formatAsMoney(placeUpgrade.getRemovalCost()) + "</br>" + SlaveryManagementDialogue.getPurchaseAvailabilityTooltipText(SlaveryManagementDialogue.cellToInspect.getPlace(), placeUpgrade));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = placeUpgrade + "_SELL_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Remove Modification", (placeUpgrade.isCoreRoomUpgrade() ? "You cannot directly remove core upgrades. Instead, you'll have to purchase a different core modification in order to remove the current one." : "This will cost: " + UtilText.formatAsMoney(placeUpgrade.getRemovalCost()) + "</br>" + SlaveryManagementDialogue.getPurchaseAvailabilityTooltipText(SlaveryManagementDialogue.cellToInspect.getPlace(), placeUpgrade)));
                    addEventListener(document, id, "mouseenter", el, false);
                }
            }
            id = "rename_room_button";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    boolean unsuitableName = false;
                    if (Main.mainController.getWebEngine().executeScript("document.getElementById('nameInput')") != null) {
                        Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenFieldName').innerHTML=document.getElementById('nameInput').value;");
                        if (Main.mainController.getWebEngine().getDocument() != null) {
                            unsuitableName = Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() > 32;
                        }
                        if (!unsuitableName) {
                            Main.game.setContent(new Response("Rename Room", "Rename this room to whatever you've entered in the text box.", Main.game.getCurrentDialogueNode()) {

                                @Override
                                public void effects() {
                                    SlaveryManagementDialogue.cellToInspect.getPlace().setName(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent());
                                }
                            });
                        }
                    }
                }, false);
            }
        }
        if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVERY_OVERVIEW) {
            id = "PREVIOUS_DAY";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    SlaveryManagementDialogue.incrementDayNumber(-1);
                    Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "NEXT_DAY";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    SlaveryManagementDialogue.incrementDayNumber(1);
                    Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
        }
        if (Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected() != null) {
            id = Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().getId() + "_RENAME";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    boolean unsuitableName = false;
                    if (Main.mainController.getWebEngine().executeScript("document.getElementById('slaveNameInput')") != null) {
                        Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenFieldName').innerHTML=document.getElementById('slaveNameInput').value;");
                        if (Main.mainController.getWebEngine().getDocument() != null) {
                            if (Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() > 32)
                                unsuitableName = true;
                            else {
                                unsuitableName = false;
                            }
                        }
                        if (!unsuitableName) {
                            Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()) {

                                @Override
                                public void effects() {
                                    Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setName(new NameTriplet(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent()));
                                }
                            });
                        }
                    }
                }, false);
            }
            id = Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().getId() + "_CALLS_PLAYER";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    boolean unsuitableName = false;
                    if (Main.mainController.getWebEngine().executeScript("document.getElementById('slaveToPlayerNameInput')") != null) {
                        Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenFieldName').innerHTML=document.getElementById('slaveToPlayerNameInput').value;");
                        if (Main.mainController.getWebEngine().getDocument() != null) {
                            unsuitableName = Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() > 32;
                        }
                        if (!unsuitableName) {
                            Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()) {

                                @Override
                                public void effects() {
                                    Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setPlayerPetName(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent());
                                }
                            });
                        }
                    }
                }, false);
            }
            id = "GLOBAL_CALLS_PLAYER";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    boolean unsuitableName = false;
                    if (Main.mainController.getWebEngine().executeScript("document.getElementById('slaveToPlayerNameInput')") != null) {
                        Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenFieldName').innerHTML=document.getElementById('slaveToPlayerNameInput').value;");
                        if (Main.mainController.getWebEngine().getDocument() != null) {
                            unsuitableName = Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() < 1 || Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() > 32;
                        }
                        if (!unsuitableName) {
                            Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()) {

                                @Override
                                public void effects() {
                                    for (String id : Main.game.getPlayer().getSlavesOwned()) {
                                        Main.game.getNPCById(id).setPlayerPetName(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent());
                                    }
                                }
                            });
                        }
                    }
                }, false);
            }
            // Job hours:
            for (int i = 0; i < 24; i++) {
                allocateWorkTime(i);
            }
            for (SlaveJobHours preset : SlaveJobHours.values()) {
                id = preset + "_TIME";
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().resetWorkHours();
                        for (int hour = preset.getStartHour(); hour < preset.getStartHour() + preset.getLength(); hour++) {
                            if (hour >= 24) {
                                Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setWorkHour(hour - 24, true);
                            } else {
                                Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setWorkHour(hour, true);
                            }
                        }
                        Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlaveJobsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Set Preset Work Hours", preset.getDescription());
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = preset + "_TIME_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Set Preset Work Hours", "You can't assign hours to a slave who is idle. Assign them a job first.");
                    addEventListener(document, id, "mouseenter", el, false);
                }
            }
            // Jobs:
            for (SlaveJob job : SlaveJob.values()) {
                id = job + "_ASSIGN";
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().setSlaveJob(job);
                        Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlaveJobsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Assign Job", job.getDescription());
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = job + "_ASSIGN_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Assign Job", UtilText.parse(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected(), job.getAvailabilityText(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                for (SlaveJobSetting setting : job.getMutualSettings()) {
                    id = setting + "_ADD";
                    if (((EventTarget) document.getElementById(id)) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().addSlaveJobSettings(setting);
                            Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlaveJobsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Apply Setting", setting.getDescription());
                        addEventListener(document, id, "mouseenter", el, false);
                    }
                    id = setting + "_REMOVE";
                    if (((EventTarget) document.getElementById(id)) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().removeSlaveJobSettings(setting);
                            Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlaveJobsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Remove Setting", setting.getDescription());
                        addEventListener(document, id, "mouseenter", el, false);
                    }
                    id = setting + "_DISABLED";
                    if (((EventTarget) document.getElementById(id)) != null) {
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Apply Setting", UtilText.parse(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected(), "You'll need to assign this job to [npc.name] before you can apply any settings."));
                        addEventListener(document, id, "mouseenter", el, false);
                    }
                }
                for (Entry<String, List<SlaveJobSetting>> entry : job.getMutuallyExclusiveSettings().entrySet()) {
                    for (SlaveJobSetting setting : entry.getValue()) {
                        id = setting + "_TOGGLE_ADD";
                        if (((EventTarget) document.getElementById(id)) != null) {
                            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                                for (SlaveJobSetting settingRem : entry.getValue()) {
                                    Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().removeSlaveJobSettings(settingRem);
                                }
                                Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().addSlaveJobSettings(setting);
                                Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlaveJobsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                            }, false);
                            addEventListener(document, id, "mousemove", moveTooltipListener, false);
                            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Apply Setting", setting.getDescription());
                            addEventListener(document, id, "mouseenter", el, false);
                        }
                        id = setting + "_DISABLED";
                        if (((EventTarget) document.getElementById(id)) != null) {
                            addEventListener(document, id, "mousemove", moveTooltipListener, false);
                            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Setting Applied", setting.getDescription());
                            addEventListener(document, id, "mouseenter", el, false);
                        }
                    }
                }
            }
            // Permissions:
            for (SlavePermission permission : SlavePermission.values()) {
                for (SlavePermissionSetting setting : permission.getSettings()) {
                    id = setting + "_ADD";
                    if (((EventTarget) document.getElementById(id)) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().addSlavePermissionSetting(permission, setting);
                            Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlavePermissionsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Apply Setting", setting.getDescription());
                        addEventListener(document, id, "mouseenter", el, false);
                    }
                    id = setting + "_REMOVE";
                    if (((EventTarget) document.getElementById(id)) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected().removeSlavePermissionSetting(permission, setting);
                            Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlavePermissionsDialogue(Main.game.getDialogueFlags().getSlaveryManagerSlaveSelected())));
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Remove Setting", setting.getDescription());
                        addEventListener(document, id, "mouseenter", el, false);
                    }
                    id = setting + "_REMOVE_ME";
                    if (((EventTarget) document.getElementById(id)) != null) {
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Remove Setting", "You cannot remove mutually exclusive settings! Choose a different option instead.");
                        addEventListener(document, id, "mouseenter", el, false);
                    }
                }
            }
        }
        for (String slaveId : Main.game.getPlayer().getSlavesOwned()) {
            id = slaveId;
            NPC slave = (NPC) Main.game.getNPCById(slaveId);
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementInspectSlaveDialogue(slave)));
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Inspect Slave", UtilText.parse(slave, "Inspect [npc.name]."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            // TODO
            id = slaveId + "_JOB";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlaveJobsDialogue(slave)));
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Slave's Job", UtilText.parse(slave, "Set [npc.name]'s job and work hours."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            // TODO
            id = slaveId + "_PERMISSIONS";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementSlavePermissionsDialogue(slave)));
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Slave's Permissions", UtilText.parse(slave, "Manage [npc.name]'s permissions."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_INVENTORY";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.mainController.openInventory(slave, InventoryInteraction.FULL_MANAGEMENT);
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Slave's Inventory", UtilText.parse(slave, "Manage [npc.name]'s inventory."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_TRANSFER";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            slave.setHomeLocation(Main.game.getPlayer().getWorldLocation(), Main.game.getPlayer().getLocation());
                            slave.returnToHome();
                        }
                    });
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Move Slave Here", UtilText.parse(slave, "Move [npc.name] to your current location."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_TRANSFER_DISABLED";
            if (((EventTarget) document.getElementById(id)) != null) {
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Move Slave Here", UtilText.parse(slave, "You cannot move [npc.name] to this location, as there's no room for [npc.herHim] here."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_SELL";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            Main.game.getPlayer().incrementMoney((int) (slave.getValueAsSlave() * Main.game.getDialogueFlags().getSlaveTrader().getBuyModifier()));
                            Main.game.getDialogueFlags().getSlaveTrader().addSlave(slave);
                            slave.setLocation(Main.game.getDialogueFlags().getSlaveTrader().getWorldLocation(), Main.game.getDialogueFlags().getSlaveTrader().getLocation(), true);
                        }
                    });
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Sell Slave", UtilText.parse(slave, "[npc.Name] has a value of " + UtilText.formatAsMoney(slave.getValueAsSlave(), "b", Colour.GENERIC_GOOD) + "</br>" + "However, " + Main.game.getDialogueFlags().getSlaveTrader().getName() + " will buy [npc.herHim] for " + UtilText.formatAsMoney((int) (slave.getValueAsSlave() * Main.game.getDialogueFlags().getSlaveTrader().getBuyModifier()), "b", Colour.GENERIC_ARCANE) + "."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_SELL_DISABLED";
            if (((EventTarget) document.getElementById(id)) != null) {
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Sell Slave", UtilText.parse(slave, "You cannot sell [npc.name], as there's nobody here to sell [npc.herHim] to."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_COSMETICS";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", SlaveryManagementDialogue.SLAVE_MANAGEMENT_COSMETICS_HAIR) {

                        @Override
                        public void effects() {
                            Main.game.getDialogueFlags().setSlaveryManagerSlaveSelected(slave);
                            BodyChanging.setTarget(slave);
                        }
                    });
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Send Slave to Kate", UtilText.parse(slave, "Send [npc.name] to Kate's beauty salon, 'Succubi's Secrets', to get [npc.her] appearance changed."));
                addEventListener(document, id, "mouseenter", el, false);
            }
            id = slaveId + "_COSMETICS_DISABLED";
            if (((EventTarget) document.getElementById(id)) != null) {
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Send Slave to Kate", UtilText.parse(slave, "You haven't met Kate yet!"));
                addEventListener(document, id, "mouseenter", el, false);
            }
        }
        if (Main.game.getDialogueFlags().getSlaveTrader() != null) {
            for (String slaveId : Main.game.getDialogueFlags().getSlaveTrader().getSlavesOwned()) {
                id = slaveId + "_TRADER";
                NPC slave = (NPC) Main.game.getNPCById(slaveId);
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", SlaveryManagementDialogue.getSlaveryManagementInspectSlaveDialogue(slave)));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Inspect Slave", UtilText.parse(slave, "Take a detailed look at [npc.name]."));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_TRADER_JOB";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Slave's Job", UtilText.parse(slave, "You cannot manage [npc.name]'s job, as you don't own [npc.herHim]!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_TRADER_PERMISSIONS";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Slave's Permissions", UtilText.parse(slave, "You cannot manage [npc.name]'s permissions, as you don't own [npc.herHim]!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_TRADER_INVENTORY";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Manage Slave's Inventory", UtilText.parse(slave, "You cannot manage [npc.name]'s inventory, as you don't own [npc.herHim]!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_TRADER_TRANSFER";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Move Slave To Here", UtilText.parse(slave, "You cannot move [npc.name] to this location, as you don't own [npc.herHim], as well as due to the fact that [npc.she]'s already here!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_BUY";
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                Main.game.getPlayer().incrementMoney(-(int) (slave.getValueAsSlave() * Main.game.getDialogueFlags().getSlaveTrader().getSellModifier()));
                                Main.game.getPlayer().addSlave(slave);
                                slave.setLocation(WorldType.SLAVER_ALLEY, PlaceType.SLAVER_ALLEY_SLAVERY_ADMINISTRATION, true);
                            }
                        });
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Buy Slave", UtilText.parse(slave, "[npc.Name] has a value of " + UtilText.formatAsMoney(slave.getValueAsSlave(), "b", Colour.GENERIC_GOOD) + "</br>" + "However, " + Main.game.getDialogueFlags().getSlaveTrader().getName() + " will sell [npc.herHim] for " + UtilText.formatAsMoney((int) (slave.getValueAsSlave() * Main.game.getDialogueFlags().getSlaveTrader().getSellModifier()), "b", Colour.GENERIC_ARCANE) + "."));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_BUY_DISABLED";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Buy Slave", UtilText.parse(slave, "You cannot buy [npc.name], as you don't have enough money!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = slaveId + "_TRADER_COSMETICS";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Send Slave to Kate", UtilText.parse(slave, "You can't send a slave you don't own to Kate!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
            }
        }
        if (Main.game.getActiveNPC() != null) {
            id = Main.game.getActiveNPC().getId() + "_PET_NAME";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    boolean unsuitableName = false;
                    if (Main.mainController.getWebEngine().executeScript("document.getElementById('offspringPetNameInput')") != null) {
                        Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenFieldName').innerHTML=document.getElementById('offspringPetNameInput').value;");
                        if (Main.mainController.getWebEngine().getDocument() != null) {
                            if (Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() < 2 || Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent().length() > 32)
                                unsuitableName = true;
                            else {
                                unsuitableName = false;
                            }
                        }
                        if (!unsuitableName) {
                            Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()) {

                                @Override
                                public void effects() {
                                    Main.game.getActiveNPC().setPlayerPetName(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent());
                                }
                            });
                        }
                    }
                }, false);
            }
        }
        if (!Main.game.isInNewWorld()) {
            for (Month month : Month.values()) {
                id = "STARTING_MONTH_" + month;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setStartingDateMonth(month);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Sex experiences:
            for (int i : CharacterModificationUtils.soSilly) {
                // Given:
                id = "HANDJOBS_GIVEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.URETHRA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "FINGERINGS_GIVEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.PITCHER, PenetrationType.FINGER, OrificeType.VAGINA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "BLOWJOBS_GIVEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.MOUTH), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "CUNNILINGUS_GIVEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.PITCHER, PenetrationType.TONGUE, OrificeType.VAGINA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "VAGINAL_GIVEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.VAGINA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "ANAL_GIVEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.ANUS), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                // Received:
                id = "HANDJOBS_TAKEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.URETHRA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "FINGERINGS_TAKEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.CATCHER, PenetrationType.FINGER, OrificeType.VAGINA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "BLOWJOBS_TAKEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.PITCHER, PenetrationType.PENIS, OrificeType.MOUTH), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "CUNNILINGUS_TAKEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.CATCHER, PenetrationType.TONGUE, OrificeType.VAGINA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "VAGINAL_TAKEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.VAGINA), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "ANAL_TAKEN_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        CharacterModificationUtils.setSexExperience(new SexType(SexParticipantType.CATCHER, PenetrationType.PENIS, OrificeType.ANUS), i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
        }
        if (!Main.game.isInNewWorld() || Main.game.getCurrentDialogueNode().equals(BodyChanging.BODY_CHANGING_CORE) || Main.game.getCurrentDialogueNode().equals(BodyChanging.BODY_CHANGING_FACE) || Main.game.getCurrentDialogueNode().equals(BodyChanging.BODY_CHANGING_ASS) || Main.game.getCurrentDialogueNode().equals(BodyChanging.BODY_CHANGING_BREASTS) || Main.game.getCurrentDialogueNode().equals(BodyChanging.BODY_CHANGING_VAGINA) || Main.game.getCurrentDialogueNode().equals(BodyChanging.BODY_CHANGING_PENIS)) {
            // Gender:
            id = "CHOOSE_GENDER_MALE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    CharacterCreation.setGenderMale();
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "CHOOSE_GENDER_FEMALE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    CharacterCreation.setGenderFemale();
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            // Femininity
            id = "CHOOSE_FEM_MASCULINE_STRONG";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setFemininity(Femininity.MASCULINE_STRONG.getMedianFemininity());
                    if (!Main.game.isInNewWorld()) {
                        CharacterCreation.getDressed();
                    }
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "CHOOSE_FEM_MASCULINE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setFemininity(Femininity.MASCULINE.getMedianFemininity());
                    if (!Main.game.isInNewWorld()) {
                        CharacterCreation.getDressed();
                    }
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "CHOOSE_FEM_ANDROGYNOUS";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setFemininity(Femininity.ANDROGYNOUS.getMedianFemininity());
                    if (!Main.game.isInNewWorld()) {
                        CharacterCreation.getDressed();
                    }
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "CHOOSE_FEM_FEMININE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setFemininity(Femininity.FEMININE.getMedianFemininity());
                    if (!Main.game.isInNewWorld()) {
                        CharacterCreation.getDressed();
                    }
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "CHOOSE_FEM_FEMININE_STRONG";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setFemininity(Femininity.FEMININE_STRONG.getMedianFemininity());
                    if (!Main.game.isInNewWorld()) {
                        CharacterCreation.getDressed();
                    }
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            // Personality:
            for (Personality personality : Personality.values()) {
                id = "PERSONALITY_" + personality;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPersonality(personality);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Orientation:
            for (SexualOrientation orientation : SexualOrientation.values()) {
                id = "SEXUAL_ORIENTATION_" + orientation;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setSexualOrientation(orientation);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Height:
            id = "HEIGHT_INCREASE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().incrementHeight(1);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "HEIGHT_INCREASE_LARGE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().incrementHeight(5);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "HEIGHT_DECREASE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().incrementHeight(-1);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "HEIGHT_DECREASE_LARGE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().incrementHeight(-5);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            // Body size:
            for (BodySize bs : BodySize.values()) {
                id = "BODY_SIZE_" + bs;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setBodySize(bs.getMedianValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Muscles:
            for (Muscle muscle : Muscle.values()) {
                id = "MUSCLE_" + muscle;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setMuscle(muscle.getMedianValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Lip Size:
            for (LipSize ls : LipSize.values()) {
                id = "LIP_SIZE_" + ls;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setLipSize(ls.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Lip puffiness:
            id = "LIP_PUFFY_ON";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().addFaceOrificeModifier(OrificeModifier.PUFFY);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "LIP_PUFFY_OFF";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().removeFaceOrificeModifier(OrificeModifier.PUFFY);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            // Breast size:
            for (CupSize cs : CupSize.values()) {
                id = "BREAST_SIZE_" + cs;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setBreastSize(cs.getMeasurement());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Breast Shape:
            for (BreastShape bs : BreastShape.values()) {
                id = "BREAST_SHAPE_" + bs;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setBreastShape(bs);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Nipple size:
            for (NippleSize ns : NippleSize.values()) {
                id = "NIPPLE_SIZE_" + ns;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setNippleSize(ns.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Areolae size:
            for (AreolaeSize as : AreolaeSize.values()) {
                id = "AREOLAE_SIZE_" + as;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAreolaeSize(as.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Nipple puffiness:
            id = "NIPPLE_PUFFY_ON";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().addNippleOrificeModifier(OrificeModifier.PUFFY);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "NIPPLE_PUFFY_OFF";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().removeNippleOrificeModifier(OrificeModifier.PUFFY);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            // Lactation:
            for (int i : CharacterModificationUtils.getLactationQuantitiesAvailable()) {
                id = "LACTATION_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setBreastMilkStorage(i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Ass size:
            for (AssSize as : CharacterModificationUtils.getAssSizesAvailable()) {
                id = "ASS_SIZE_" + as;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssSize(as.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Hip size:
            for (HipSize hs : CharacterModificationUtils.getHipSizesAvailable()) {
                id = "HIP_SIZE_" + hs;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setHipSize(hs.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Bleached anus:
            id = "ANUS_BLEACHED_ON";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setAssBleached(true);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            id = "ANUS_BLEACHED_OFF";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    BodyChanging.getTarget().setAssBleached(false);
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            }
            // Penis size:
            for (int ps : CharacterModificationUtils.getPenisSizesAvailable()) {
                id = "PENIS_SIZE_" + ps;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPenisSize(ps);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Penis girth:
            for (PenisGirth girth : PenisGirth.values()) {
                id = "PENIS_GIRTH_" + girth;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPenisGirth(girth.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Testicle size:
            for (TesticleSize ts : CharacterModificationUtils.getTesticleSizesAvailable()) {
                id = "TESTICLE_SIZE_" + ts;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setTesticleSize(ts.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Cum production:
            for (CumProduction cp : CharacterModificationUtils.getCumProductionAvailable()) {
                id = "CUM_PRODUCTION_" + cp;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setCumProduction(cp.getMedianValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Vagina capacity:
            for (Capacity capacity : Capacity.values()) {
                id = "VAGINA_CAPACITY_" + capacity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaCapacity(capacity.getMedianValue(), true);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Vagina wetness:
            for (Wetness wetness : Wetness.values()) {
                id = "VAGINA_WETNESS_" + wetness;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaWetness(wetness.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Vagina elastcity:
            for (OrificeElasticity elasticity : OrificeElasticity.values()) {
                id = "VAGINA_ELASTICITY_" + elasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaElasticity(elasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Vagina plasticity:
            for (OrificePlasticity plasticity : OrificePlasticity.values()) {
                id = "VAGINA_PLASTICITY_" + plasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaPlasticity(plasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Clit size:
            for (ClitorisSize cs : ClitorisSize.values()) {
                id = "CLITORIS_SIZE_" + cs;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaClitorisSize(cs.getMedianValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Labia size:
            for (LabiaSize ls : LabiaSize.values()) {
                id = "LABIA_SIZE_" + ls;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaLabiaSize(ls.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (ArmType armType : ArmType.values()) {
                id = "CHANGE_ARM_" + armType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setArmType(armType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (EyeType eyeType : EyeType.values()) {
                id = "CHANGE_EYE_" + eyeType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setEyeType(eyeType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (EarType earType : EarType.values()) {
                id = "CHANGE_EAR_" + earType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setEarType(earType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (HornType hornType : HornType.values()) {
                id = "CHANGE_HORN_" + hornType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setHornType(hornType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (AntennaType antennaType : AntennaType.values()) {
                id = "CHANGE_ANTENNA_" + antennaType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAntennaType(antennaType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (HairType hairType : HairType.values()) {
                id = "CHANGE_HAIR_" + hairType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setHairType(hairType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (LegType legType : LegType.values()) {
                id = "CHANGE_LEG_" + legType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setLegType(legType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (FaceType faceType : FaceType.values()) {
                id = "CHANGE_FACE_" + faceType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setFaceType(faceType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (SkinType skinType : SkinType.values()) {
                id = "CHANGE_SKIN_" + skinType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setSkinType(skinType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (TailType tailType : TailType.values()) {
                id = "CHANGE_TAIL_" + tailType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setTailType(tailType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (WingType wingType : WingType.values()) {
                id = "CHANGE_WING_" + wingType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setWingType(wingType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (AssType assType : AssType.values()) {
                id = "CHANGE_ASS_" + assType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssType(assType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (BreastType breastType : BreastType.values()) {
                id = "CHANGE_BREAST_" + breastType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setBreastType(breastType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (EyeShape eyeShape : EyeShape.values()) {
                id = "CHANGE_IRIS_SHAPE_" + eyeShape;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setIrisShape(eyeShape);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "CHANGE_PUPIL_SHAPE_" + eyeShape;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPupilShape(eyeShape);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (LipSize lipSize : LipSize.values()) {
                id = "CHANGE_LIP_SIZE_" + lipSize;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setLipSize(lipSize.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeModifier orificeMod : OrificeModifier.values()) {
                id = "CHANGE_MOUTH_MOD_" + orificeMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasFaceOrificeModifier(orificeMod)) {
                            BodyChanging.getTarget().removeFaceOrificeModifier(orificeMod);
                        } else {
                            BodyChanging.getTarget().addFaceOrificeModifier(orificeMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (TongueModifier tongueMod : TongueModifier.values()) {
                id = "CHANGE_TONGUE_MOD_" + tongueMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasTongueModifier(tongueMod)) {
                            BodyChanging.getTarget().removeTongueModifier(tongueMod);
                        } else {
                            BodyChanging.getTarget().addTongueModifier(tongueMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeModifier orificeMod : OrificeModifier.values()) {
                id = "CHANGE_ANUS_MOD_" + orificeMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasAssOrificeModifier(orificeMod)) {
                            BodyChanging.getTarget().removeAssOrificeModifier(orificeMod);
                        } else {
                            BodyChanging.getTarget().addAssOrificeModifier(orificeMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Ass size:
            for (AssSize as : AssSize.values()) {
                id = "CHANGE_ASS_SIZE_" + as;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssSize(as.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (HipSize hs : HipSize.values()) {
                id = "CHANGE_HIP_SIZE_" + hs;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setHipSize(hs.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (Capacity capacity : Capacity.values()) {
                id = "ANUS_CAPACITY_" + capacity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssCapacity(capacity.getMedianValue(), true);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (Wetness wetness : Wetness.values()) {
                id = "ANUS_WETNESS_" + wetness;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssWetness(wetness.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeElasticity elasticity : OrificeElasticity.values()) {
                id = "ANUS_ELASTICITY_" + elasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssElasticity(elasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificePlasticity plasticity : OrificePlasticity.values()) {
                id = "ANUS_PLASTICITY_" + plasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setAssPlasticity(plasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (int i = 1; i <= Breast.MAXIMUM_BREAST_ROWS; i++) {
                setBreastCountListener(i);
            }
            for (int i = 1; i <= Breast.MAXIMUM_NIPPLES_PER_BREAST; i++) {
                setNippleCountListener(i);
            }
            // Nipple capacity:
            for (Capacity capacity : Capacity.values()) {
                id = "NIPPLE_CAPACITY_" + capacity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setNippleCapacity(capacity.getMedianValue(), true);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Nipple elastcity:
            for (OrificeElasticity elasticity : OrificeElasticity.values()) {
                id = "NIPPLE_ELASTICITY_" + elasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setNippleElasticity(elasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            // Nipple plasticity:
            for (OrificePlasticity plasticity : OrificePlasticity.values()) {
                id = "NIPPLE_PLASTICITY_" + plasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setNipplePlasticity(plasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (int i : CharacterModificationUtils.demonLactationValues) {
                id = "LACTATION_" + i;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setBreastMilkStorage(i);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeModifier orificeMod : OrificeModifier.values()) {
                id = "CHANGE_NIPPLE_MOD_" + orificeMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasNippleOrificeModifier(orificeMod)) {
                            BodyChanging.getTarget().removeNippleOrificeModifier(orificeMod);
                        } else {
                            BodyChanging.getTarget().addNippleOrificeModifier(orificeMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (VaginaType vaginaType : VaginaType.values()) {
                id = "CHANGE_VAGINA_" + vaginaType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setVaginaType(vaginaType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeModifier orificeMod : OrificeModifier.values()) {
                id = "CHANGE_VAGINA_MOD_" + orificeMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasVaginaOrificeModifier(orificeMod)) {
                            BodyChanging.getTarget().removeVaginaOrificeModifier(orificeMod);
                        } else {
                            BodyChanging.getTarget().addVaginaOrificeModifier(orificeMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (PenisType penisType : PenisType.values()) {
                id = "CHANGE_PENIS_" + penisType;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPenisType(penisType);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (PenisSize ps : PenisSize.values()) {
                id = "PENIS_SIZE_" + ps.getMinimumValue();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPenisSize(ps.getMinimumValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "PENIS_SIZE_" + ps.getMedianValue();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPenisSize(ps.getMedianValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (TesticleSize size : TesticleSize.values()) {
                id = "TESTICLE_SIZE_" + size;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setTesticleSize(size.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (int i = Testicle.MIN_TESTICLE_COUNT; i <= Testicle.MAX_TESTICLE_COUNT; i += 2) {
                setTesticleCountListener(i);
            }
            for (Capacity capacity : Capacity.values()) {
                id = "URETHRA_CAPACITY_" + capacity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setPenisCapacity(capacity.getMedianValue(), true);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (CumProduction cumProduction : CumProduction.values()) {
                id = "CUM_PRODUCTION_" + cumProduction.getMinimumValue();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setCumProduction(cumProduction.getMinimumValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
                id = "CUM_PRODUCTION_" + cumProduction.getMedianValue();
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setCumProduction(cumProduction.getMedianValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeElasticity elasticity : OrificeElasticity.values()) {
                id = "URETHRA_ELASTICITY_" + elasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setUrethraElasticity(elasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificePlasticity plasticity : OrificePlasticity.values()) {
                id = "URETHRA_PLASTICITY_" + plasticity;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        BodyChanging.getTarget().setUrethraPlasticity(plasticity.getValue());
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (PenisModifier orificeMod : PenisModifier.values()) {
                id = "CHANGE_PENIS_MOD_" + orificeMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasPenisModifier(orificeMod)) {
                            BodyChanging.getTarget().removePenisModifier(orificeMod);
                        } else {
                            BodyChanging.getTarget().addPenisModifier(orificeMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
            for (OrificeModifier orificeMod : OrificeModifier.values()) {
                id = "CHANGE_URETHRA_MOD_" + orificeMod;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (BodyChanging.getTarget().hasUrethraOrificeModifier(orificeMod)) {
                            BodyChanging.getTarget().removeUrethraOrificeModifier(orificeMod);
                        } else {
                            BodyChanging.getTarget().addUrethraOrificeModifier(orificeMod);
                        }
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
        }
        // -------------------- Cosmetics -------------------- //
        boolean noCost = !Main.game.isInNewWorld() || Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE;
        for (BodyCoveringType bct : BodyCoveringType.values()) {
            id = "APPLY_COVERING_" + bct;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.getBodyCoveringTypeCost(bct) || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (CharacterModificationUtils.getCoveringsToBeApplied().containsKey(bct)) {
                                    if (!noCost) {
                                        Main.game.getPlayer().incrementMoney(-SuccubisSecrets.getBodyCoveringTypeCost(bct));
                                    }
                                    BodyChanging.getTarget().setSkinCovering(new Covering(CharacterModificationUtils.getCoveringsToBeApplied().get(bct)), false);
                                    if (noCost) {
                                        if (bct == BodyCoveringType.HUMAN) {
                                            BodyChanging.getTarget().getBody().updateCoverings(false, false, false, true);
                                        }
                                    }
                                }
                            }
                        });
                    }
                }, false);
            }
            id = bct + "_PRIMARY_GLOW_OFF";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                            CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setPrimaryGlowing(false);
                        }
                    });
                }, false);
            }
            id = bct + "_PRIMARY_GLOW_ON";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                            CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setPrimaryGlowing(true);
                        }
                    });
                }, false);
            }
            id = bct + "_SECONDARY_GLOW_OFF";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                            CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setSecondaryGlowing(false);
                        }
                    });
                }, false);
            }
            id = bct + "_SECONDARY_GLOW_ON";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                            CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setSecondaryGlowing(true);
                        }
                    });
                }, false);
            }
            for (CoveringPattern pattern : CoveringPattern.values()) {
                id = bct + "_PATTERN_" + pattern;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                                CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setPattern(pattern);
                            }
                        });
                    }, false);
                }
            }
            for (CoveringModifier modifier : CoveringModifier.values()) {
                id = bct + "_MODIFIER_" + modifier;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                                CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setModifier(modifier);
                            }
                        });
                    }, false);
                }
            }
            for (Colour colour : bct.getAllPrimaryColours()) {
                id = bct + "_PRIMARY_" + colour;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                                CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setPrimaryColour(colour);
                                CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setPrimaryGlowing((colour != Colour.COVERING_NONE && BodyChanging.getTarget().getCovering(bct).isPrimaryGlowing()));
                            }
                        });
                    }, false);
                }
            }
            for (Colour colour : bct.getAllSecondaryColours()) {
                id = bct + "_SECONDARY_" + colour;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                CharacterModificationUtils.getCoveringsToBeApplied().putIfAbsent(bct, new Covering(BodyChanging.getTarget().getCovering(bct)));
                                CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setSecondaryColour(colour);
                                CharacterModificationUtils.getCoveringsToBeApplied().get(bct).setSecondaryGlowing(colour != Colour.COVERING_NONE && BodyChanging.getTarget().getCovering(bct).isSecondaryGlowing());
                            }
                        });
                    }, false);
                }
            }
        }
        for (HairLength hairLength : HairLength.values()) {
            id = "HAIR_LENGTH_" + hairLength;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_HAIR_LENGTH_COST || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_HAIR_LENGTH_COST);
                                }
                                BodyChanging.getTarget().setHairLength(hairLength.getMedianValue());
                            }
                        });
                    }
                }, false);
            }
        }
        for (HairStyle hairStyle : HairStyle.values()) {
            id = "HAIR_STYLE_" + hairStyle;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_HAIR_STYLE_COST || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_HAIR_STYLE_COST);
                                }
                                BodyChanging.getTarget().setHairStyle(hairStyle);
                            }
                        });
                    }
                }, false);
            }
        }
        for (PiercingType piercingType : PiercingType.values()) {
            id = piercingType + "_PIERCE_REMOVE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.getPiercingCost(piercingType) || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.getPiercingCost(piercingType));
                                }
                                switch(piercingType) {
                                    case EAR:
                                        BodyChanging.getTarget().setPiercedEar(false);
                                        break;
                                    case LIP:
                                        BodyChanging.getTarget().setPiercedLip(false);
                                        break;
                                    case NAVEL:
                                        BodyChanging.getTarget().setPiercedNavel(false);
                                        break;
                                    case NIPPLE:
                                        BodyChanging.getTarget().setPiercedNipples(false);
                                        break;
                                    case NOSE:
                                        BodyChanging.getTarget().setPiercedNose(false);
                                        break;
                                    case PENIS:
                                        BodyChanging.getTarget().setPiercedPenis(false);
                                        break;
                                    case TONGUE:
                                        BodyChanging.getTarget().setPiercedTongue(false);
                                        break;
                                    case VAGINA:
                                        BodyChanging.getTarget().setPiercedVagina(false);
                                        break;
                                }
                            }
                        });
                    }
                }, false);
            }
            id = piercingType + "_PIERCE";
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.getPiercingCost(piercingType) || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.getPiercingCost(piercingType));
                                }
                                switch(piercingType) {
                                    case EAR:
                                        BodyChanging.getTarget().setPiercedEar(true);
                                        break;
                                    case LIP:
                                        BodyChanging.getTarget().setPiercedLip(true);
                                        break;
                                    case NAVEL:
                                        BodyChanging.getTarget().setPiercedNavel(true);
                                        break;
                                    case NIPPLE:
                                        BodyChanging.getTarget().setPiercedNipples(true);
                                        break;
                                    case NOSE:
                                        BodyChanging.getTarget().setPiercedNose(true);
                                        break;
                                    case PENIS:
                                        BodyChanging.getTarget().setPiercedPenis(true);
                                        break;
                                    case TONGUE:
                                        BodyChanging.getTarget().setPiercedTongue(true);
                                        break;
                                    case VAGINA:
                                        BodyChanging.getTarget().setPiercedVagina(true);
                                        break;
                                }
                            }
                        });
                    }
                }, false);
            }
        }
        if (((EventTarget) document.getElementById("BLEACHING_OFF")) != null) {
            ((EventTarget) document.getElementById("BLEACHING_OFF")).addEventListener("click", e -> {
                if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_ANAL_BLEACHING_COST || noCost) {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            if (!noCost) {
                                Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_ANAL_BLEACHING_COST);
                            }
                            BodyChanging.getTarget().setAssBleached(false);
                        }
                    });
                }
            }, false);
        }
        if (((EventTarget) document.getElementById("BLEACHING_ON")) != null) {
            ((EventTarget) document.getElementById("BLEACHING_ON")).addEventListener("click", e -> {
                if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_ANAL_BLEACHING_COST || noCost) {
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                        @Override
                        public void effects() {
                            if (!noCost) {
                                Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_ANAL_BLEACHING_COST);
                            }
                            BodyChanging.getTarget().setAssBleached(true);
                        }
                    });
                }
            }, false);
        }
        for (BodyHair bodyHair : BodyHair.values()) {
            id = "ASS_HAIR_" + bodyHair;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_BODY_HAIR_COST || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_BODY_HAIR_COST);
                                }
                                BodyChanging.getTarget().setAssHair(bodyHair);
                            }
                        });
                    }
                }, false);
            }
            id = "UNDERARM_HAIR_" + bodyHair;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_BODY_HAIR_COST || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_BODY_HAIR_COST);
                                }
                                BodyChanging.getTarget().setUnderarmHair(bodyHair);
                            }
                        });
                    }
                }, false);
            }
            id = "PUBIC_HAIR_" + bodyHair;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_BODY_HAIR_COST || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_BODY_HAIR_COST);
                                }
                                BodyChanging.getTarget().setPubicHair(bodyHair);
                            }
                        });
                    }
                }, false);
            }
            id = "FACIAL_HAIR_" + bodyHair;
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (Main.game.getPlayer().getMoney() >= SuccubisSecrets.BASE_BODY_HAIR_COST || noCost) {
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()) {

                            @Override
                            public void effects() {
                                if (!noCost) {
                                    Main.game.getPlayer().incrementMoney(-SuccubisSecrets.BASE_BODY_HAIR_COST);
                                }
                                BodyChanging.getTarget().setFacialHair(bodyHair);
                            }
                        });
                    }
                }, false);
            }
        }
        // Phone item viewer:
        for (AbstractClothingType clothing : ClothingType.getAllClothing()) {
            for (Colour c : clothing.getAllAvailablePrimaryColours()) {
                id = "PRIMARY_" + clothing.hashCode() + "_" + c.toString();
                if ((EventTarget) document.getElementById(id) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        InventoryDialogue.dyePreviewPrimary = c;
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setDyeClothingPrimary(InventoryDialogue.getClothing(), c);
                    addEventListener(document, id, "mouseenter", el2, false);
                }
            }
            if (!clothing.getAllAvailableSecondaryColours().isEmpty()) {
                for (Colour c : clothing.getAllAvailableSecondaryColours()) {
                    id = "SECONDARY_" + clothing.hashCode() + "_" + c.toString();
                    if ((EventTarget) document.getElementById(id) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            InventoryDialogue.dyePreviewSecondary = c;
                            Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setDyeClothingSecondary(InventoryDialogue.getClothing(), c);
                        addEventListener(document, id, "mouseenter", el2, false);
                    }
                }
            }
            if (!clothing.getAllAvailableTertiaryColours().isEmpty()) {
                for (Colour c : clothing.getAllAvailableTertiaryColours()) {
                    id = "TERTIARY_" + clothing.hashCode() + "_" + c.toString();
                    if ((EventTarget) document.getElementById(id) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            InventoryDialogue.dyePreviewTertiary = c;
                            Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setDyeClothingTertiary(InventoryDialogue.getClothing(), c);
                        addEventListener(document, id, "mouseenter", el2, false);
                    }
                }
            }
        }
        for (AbstractClothingType clothing : ClothingType.getAllClothing()) {
            for (Colour colour : clothing.getAllAvailablePrimaryColours()) {
                if ((EventTarget) document.getElementById(clothing.hashCode() + "_" + colour.toString()) != null) {
                    addEventListener(document, clothing.hashCode() + "_" + colour.toString(), "mousemove", moveTooltipListener, false);
                    addEventListener(document, clothing.hashCode() + "_" + colour.toString(), "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setGenericClothing(clothing, colour);
                    addEventListener(document, clothing.hashCode() + "_" + colour.toString(), "mouseenter", el2, false);
                }
            }
        }
        for (AbstractWeaponType weapon : WeaponType.allweapons) {
            for (DamageType dt : weapon.getAvailableDamageTypes()) {
                if ((EventTarget) document.getElementById(weapon.hashCode() + "_" + dt.toString()) != null) {
                    addEventListener(document, weapon.hashCode() + "_" + dt.toString(), "mousemove", moveTooltipListener, false);
                    addEventListener(document, weapon.hashCode() + "_" + dt.toString(), "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setGenericWeapon(weapon, dt);
                    addEventListener(document, weapon.hashCode() + "_" + dt.toString(), "mouseenter", el2, false);
                }
            }
        }
        for (Perk perk : Perk.values()) {
            // TODO
            if (perk.getPerkCategory() == PerkCategory.JOB) {
                id = "HISTORY_" + perk;
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setLevelUpPerk(0, perk, Main.game.getPlayer()), false);
                }
            } else {
                id = "TRAIT_" + perk;
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setLevelUpPerk(PerkManager.MANAGER.getPerkRow(perk), perk, Main.game.getPlayer()), false);
                    ((EventTarget) document.getElementById(id)).addEventListener("click", event -> {
                        Main.game.getPlayer().removeTrait(perk);
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
        }
        // Level up dialogue:
        if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_LEVEL_UP) {
            for (int i = 0; i < PerkManager.ROWS; i++) {
                for (Entry<PerkCategory, List<PerkEntry>> entry : PerkManager.MANAGER.getPerkTree().get(i).entrySet()) {
                    for (PerkEntry e : entry.getValue()) {
                        id = i + "_" + e.getPerk();
                        if (((EventTarget) document.getElementById(id)) != null) {
                            addEventListener(document, id, "mousemove", moveTooltipListener, false);
                            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                            addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setLevelUpPerk(i, e.getPerk(), Main.game.getPlayer()), false);
                            ((EventTarget) document.getElementById(id)).addEventListener("click", event -> {
                                if (e.getPerk().isMajor() && PerkManager.MANAGER.isPerkOwned(e)) {
                                    if (!Main.game.getPlayer().hasTraitActivated(e.getPerk())) {
                                        Main.game.getPlayer().addTrait(e.getPerk());
                                    } else {
                                        Main.game.getPlayer().removeTrait(e.getPerk());
                                    }
                                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                                } else if (Main.game.getPlayer().getPerkPoints() >= 1 && PerkManager.MANAGER.isPerkAvailable(e)) {
                                    if (Main.game.getPlayer().addPerk(e.getRow(), e.getPerk())) {
                                        Main.game.getPlayer().incrementPerkPoints(-1);
                                        if (e.getPerk().isMajor() && Main.game.getPlayer().getTraits().size() < GameCharacter.MAX_TRAITS) {
                                            Main.game.getPlayer().addTrait(e.getPerk());
                                        }
                                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                                    }
                                }
                            }, false);
                        }
                    }
                }
            }
        }
        if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_FETISHES) {
            for (Fetish f : Fetish.values()) {
                id = "fetishUnlock" + f;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        if (Main.game.getPlayer().getEssenceCount(TFEssence.ARCANE) >= f.getCost()) {
                            if (Main.game.getPlayer().addFetish(f)) {
                                Main.game.getPlayer().incrementEssenceCount(TFEssence.ARCANE, -f.getCost());
                                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                            }
                        }
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setFetish(f, Main.game.getPlayer()), false);
                }
                id = f + "_EXPERIENCE";
                if (((EventTarget) document.getElementById(id)) != null) {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setFetishExperience(f, Main.game.getPlayer()), false);
                }
                for (FetishDesire desire : FetishDesire.values()) {
                    id = f + "_" + desire;
                    if (((EventTarget) document.getElementById(id)) != null) {
                        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                            if (Main.game.getPlayer().getEssenceCount(TFEssence.ARCANE) >= FetishDesire.getCostToChange()) {
                                if (Main.game.getPlayer().setFetishDesire(f, desire)) {
                                    Main.game.getPlayer().incrementEssenceCount(TFEssence.ARCANE, -FetishDesire.getCostToChange());
                                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                                }
                            }
                        }, false);
                        addEventListener(document, id, "mousemove", moveTooltipListener, false);
                        addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                        addEventListener(document, id, "mouseenter", new TooltipInformationEventListener().setFetishDesire(f, desire, Main.game.getPlayer()), false);
                    }
                }
            }
        }
    }
    // Hotkey bindings:
    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.KEYBINDS) {
        for (KeyboardAction ka : KeyboardAction.values()) {
            if (((EventTarget) document.getElementById("primary_" + ka)) != null)
                ((EventTarget) document.getElementById("primary_" + ka)).addEventListener("click", e -> {
                    actionToBind = ka;
                    primaryBinding = true;
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            if (((EventTarget) document.getElementById("primaryClear_" + ka)) != null)
                ((EventTarget) document.getElementById("primaryClear_" + ka)).addEventListener("click", e -> {
                    Main.getProperties().hotkeyMapPrimary.put(ka, null);
                    Main.saveProperties();
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            if (((EventTarget) document.getElementById("secondary_" + ka)) != null)
                ((EventTarget) document.getElementById("secondary_" + ka)).addEventListener("click", e -> {
                    actionToBind = ka;
                    primaryBinding = false;
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
            if (((EventTarget) document.getElementById("secondaryClear_" + ka)) != null)
                ((EventTarget) document.getElementById("secondaryClear_" + ka)).addEventListener("click", e -> {
                    Main.getProperties().hotkeyMapSecondary.put(ka, null);
                    Main.saveProperties();
                    Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                }, false);
        }
    }
    // Gender preferences:
    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.GENDER_PREFERENCE) {
        for (Gender g : Gender.values()) {
            for (GenderPreference preference : GenderPreference.values()) {
                if (((EventTarget) document.getElementById(preference + "_" + g)) != null) {
                    ((EventTarget) document.getElementById(preference + "_" + g)).addEventListener("click", e -> {
                        Main.getProperties().genderPreferencesMap.put(g, preference.getValue());
                        Main.saveProperties();
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                }
            }
        }
    }
    // Furry preferences:
    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.FURRY_PREFERENCE) {
        // Human encounter rates:
        if (((EventTarget) document.getElementById("furry_preference_human_encounter_zero")) != null) {
            ((EventTarget) document.getElementById("furry_preference_human_encounter_zero")).addEventListener("click", e -> {
                Main.getProperties().humanEncountersLevel = 0;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_human_encounter_zero", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_human_encounter_zero", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Disabled", "Randomly generated NPCs will never be fully human, unless all of the other furry preference options are set to disabled.");
            addEventListener(document, "furry_preference_human_encounter_zero", "mouseenter", el, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_human_encounter_one")) != null) {
            ((EventTarget) document.getElementById("furry_preference_human_encounter_one")).addEventListener("click", e -> {
                Main.getProperties().humanEncountersLevel = 1;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_human_encounter_one", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_human_encounter_one", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("5%", "There will be a 5% chance for any randomly generated NPC to be fully human. (It will be 100% if all of the other furry preference options are set to disabled)");
            addEventListener(document, "furry_preference_human_encounter_one", "mouseenter", el, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_human_encounter_two")) != null) {
            ((EventTarget) document.getElementById("furry_preference_human_encounter_two")).addEventListener("click", e -> {
                Main.getProperties().humanEncountersLevel = 2;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_human_encounter_two", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_human_encounter_two", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("25%", "There will be a 25% chance for any randomly generated NPC to be fully human. (It will be 100% if all of the other furry preference options are set to disabled)");
            addEventListener(document, "furry_preference_human_encounter_two", "mouseenter", el, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_human_encounter_three")) != null) {
            ((EventTarget) document.getElementById("furry_preference_human_encounter_three")).addEventListener("click", e -> {
                Main.getProperties().humanEncountersLevel = 3;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_human_encounter_three", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_human_encounter_three", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("50%", "There will be a 50% chance for any randomly generated NPC to be fully human. (It will be 100% if all of the other furry preference options are set to disabled)");
            addEventListener(document, "furry_preference_human_encounter_three", "mouseenter", el, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_human_encounter_four")) != null) {
            ((EventTarget) document.getElementById("furry_preference_human_encounter_four")).addEventListener("click", e -> {
                Main.getProperties().humanEncountersLevel = 4;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_human_encounter_four", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_human_encounter_four", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("75%", "There will be a 75% chance for any randomly generated NPC to be fully human. (It will be 100% if all of the other furry preference options are set to disabled)");
            addEventListener(document, "furry_preference_human_encounter_four", "mouseenter", el, false);
        }
        // Forced TF racial limits:
        id = "forced_tf_limit_human";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPreference = FurryPreference.HUMAN;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Human Only", "Forced transformations from NPCs will only ever affect your body's non-racial stats, and if a new part is required (such as a vagina or penis) it will always grow to be a human one.");
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "forced_tf_limit_minimum";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPreference = FurryPreference.MINIMUM;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Minimum Furry", "Forced transformations from NPCs will have the chance to give you non-human hair, ears, eyes, tails, horns, antenna, and wings. All other parts will always remain human.");
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "forced_tf_limit_reduced";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPreference = FurryPreference.REDUCED;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Lesser Furry", "Forced transformations from NPCs will have the chance to give you non-human hair, ears, eyes, tails, horns, antenna, wings, breasts, ass, genitalia, arms, and legs. Your skin and face will always remain human.");
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "forced_tf_limit_normal";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPreference = FurryPreference.NORMAL;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Greater Furry", "Forced transformations from NPCs will have the chance to give you non-human hair, ears, eyes, tails, horns, antenna, wings, breasts, ass, genitalia, arms, legs, skin, and face. (So everything can be affected.)");
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "forced_tf_limit_maximum";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPreference = FurryPreference.MAXIMUM;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Always Greater Furry", "Forced transformations from NPCs will always give you non-human hair, ears, eyes, tails, horns, antenna, wings, breasts, genitalia, ass, arms, legs, skin, and face. (So everything will be affected.)");
            addEventListener(document, id, "mouseenter", el, false);
        }
        // Multi-breast options:
        if (((EventTarget) document.getElementById("furry_preference_multi_breast_zero")) != null) {
            ((EventTarget) document.getElementById("furry_preference_multi_breast_zero")).addEventListener("click", e -> {
                Main.getProperties().multiBreasts = 0;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_multi_breast_zero", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_multi_breast_zero", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Off", "Randomly-generated NPCs will never spawn in with multiple rows of breasts.");
            addEventListener(document, "furry_preference_multi_breast_zero", "mouseenter", el, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_multi_breast_one")) != null) {
            ((EventTarget) document.getElementById("furry_preference_multi_breast_one")).addEventListener("click", e -> {
                Main.getProperties().multiBreasts = 1;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_multi_breast_one", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_multi_breast_one", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("Furry-only", "Randomly-generated NPCs will only spawn in with multiple rows of breasts if they have furry skin.");
            addEventListener(document, "furry_preference_multi_breast_one", "mouseenter", el, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_multi_breast_two")) != null) {
            ((EventTarget) document.getElementById("furry_preference_multi_breast_two")).addEventListener("click", e -> {
                Main.getProperties().multiBreasts = 2;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, "furry_preference_multi_breast_two", "mousemove", moveTooltipListener, false);
            addEventListener(document, "furry_preference_multi_breast_two", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation("On", "Randomly-generated NPCs will spawn in with multiple rows of breasts if their breast type is furry (starts at 'Minor morph' level).");
            addEventListener(document, "furry_preference_multi_breast_two", "mouseenter", el, false);
        }
        // Race preferences:
        if (((EventTarget) document.getElementById("furry_preference_female_human_all")) != null) {
            ((EventTarget) document.getElementById("furry_preference_female_human_all")).addEventListener("click", e -> {
                for (Subspecies r : Subspecies.values()) {
                    Main.getProperties().subspeciesFeminineFurryPreferencesMap.put(r, FurryPreference.HUMAN);
                    Main.getProperties().subspeciesMasculineFurryPreferencesMap.put(r, FurryPreference.HUMAN);
                }
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_female_minimum_all")) != null) {
            ((EventTarget) document.getElementById("furry_preference_female_minimum_all")).addEventListener("click", e -> {
                for (Subspecies r : Subspecies.values()) {
                    Main.getProperties().subspeciesFeminineFurryPreferencesMap.put(r, FurryPreference.MINIMUM);
                    Main.getProperties().subspeciesMasculineFurryPreferencesMap.put(r, FurryPreference.MINIMUM);
                }
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_female_reduced_all")) != null) {
            ((EventTarget) document.getElementById("furry_preference_female_reduced_all")).addEventListener("click", e -> {
                for (Subspecies r : Subspecies.values()) {
                    Main.getProperties().subspeciesFeminineFurryPreferencesMap.put(r, FurryPreference.REDUCED);
                    Main.getProperties().subspeciesMasculineFurryPreferencesMap.put(r, FurryPreference.REDUCED);
                }
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_female_normal_all")) != null) {
            ((EventTarget) document.getElementById("furry_preference_female_normal_all")).addEventListener("click", e -> {
                for (Subspecies r : Subspecies.values()) {
                    Main.getProperties().subspeciesFeminineFurryPreferencesMap.put(r, FurryPreference.NORMAL);
                    Main.getProperties().subspeciesMasculineFurryPreferencesMap.put(r, FurryPreference.NORMAL);
                }
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        if (((EventTarget) document.getElementById("furry_preference_female_maximum_all")) != null) {
            ((EventTarget) document.getElementById("furry_preference_female_maximum_all")).addEventListener("click", e -> {
                for (Subspecies r : Subspecies.values()) {
                    Main.getProperties().subspeciesFeminineFurryPreferencesMap.put(r, FurryPreference.MAXIMUM);
                    Main.getProperties().subspeciesMasculineFurryPreferencesMap.put(r, FurryPreference.MAXIMUM);
                }
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        for (Subspecies s : Subspecies.values()) {
            for (FurryPreference preference : FurryPreference.values()) {
                id = "FEMININE_" + preference + "_" + s;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.getProperties().subspeciesFeminineFurryPreferencesMap.put(s, preference);
                        Main.saveProperties();
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(preference.getName(), preference.getDescriptionFeminine(s));
                    addEventListener(document, id, "mouseenter", el, false);
                }
                id = "MASCULINE_" + preference + "_" + s;
                if (((EventTarget) document.getElementById(id)) != null) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        Main.getProperties().subspeciesMasculineFurryPreferencesMap.put(s, preference);
                        Main.saveProperties();
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(preference.getName(), preference.getDescriptionMasculine(s));
                    addEventListener(document, id, "mouseenter", el, false);
                }
            }
        }
    // for (Subspecies s : Subspecies.values()) {
    // for(SubspeciesPreference preference : SubspeciesPreference.values()) {
    // id = "FEMININE_" + preference+"_"+s;
    // if (((EventTarget) document.getElementById(id)) != null) {
    // ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
    // Main.getProperties().subspeciesFemininePreferencesMap.put(s, preference);
    // Main.saveProperties();
    // Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
    // }, false);
    // 
    // addEventListener(document, id, "mousemove", moveTooltipListener, false);
    // addEventListener(document, id, "mouseleave", hideTooltipListener, false);
    // TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(preference.getName(), "");
    // addEventListener(document, id, "mouseenter", el, false);
    // }
    // id = "MASCULINE_" + preference+"_"+s;
    // if (((EventTarget) document.getElementById(id)) != null) {
    // ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
    // Main.getProperties().subspeciesFemininePreferencesMap.put(s, preference);
    // Main.saveProperties();
    // Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
    // }, false);
    // 
    // addEventListener(document, id, "mousemove", moveTooltipListener, false);
    // addEventListener(document, id, "mouseleave", hideTooltipListener, false);
    // TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(preference.getName(), "");
    // addEventListener(document, id, "mouseenter", el, false);
    // }
    // }
    // }
    }
    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.CONTENT_PREFERENCE || Main.game.getCurrentDialogueNode() == CharacterCreation.CONTENT_PREFERENCES) {
        id = "NON_CON_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().nonConContent = true;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "NON_CON_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().nonConContent = false;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "INCEST_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().incestContent = true;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "INCEST_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().incestContent = false;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "HAIR_FACIAL_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().facialHairContent = !Main.getProperties().facialHairContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "HAIR_FACIAL_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().facialHairContent = !Main.getProperties().facialHairContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "HAIR_PUBIC_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pubicHairContent = !Main.getProperties().pubicHairContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "HAIR_PUBIC_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pubicHairContent = !Main.getProperties().pubicHairContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "HAIR_BODY_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().bodyHairContent = !Main.getProperties().bodyHairContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "HAIR_BODY_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().bodyHairContent = !Main.getProperties().bodyHairContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FEMININE_BEARD_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().feminineBeardsContent = !Main.getProperties().feminineBeardsContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FEMININE_BEARD_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().feminineBeardsContent = !Main.getProperties().feminineBeardsContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FURRY_TAIL_PENETRATION_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().furryTailPenetrationContent = !Main.getProperties().furryTailPenetrationContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FURRY_TAIL_PENETRATION_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().furryTailPenetrationContent = !Main.getProperties().furryTailPenetrationContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "INFLATION_CONTENT_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().inflationContent = !Main.getProperties().inflationContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "INFLATION_CONTENT_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().inflationContent = !Main.getProperties().inflationContent;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FORCED_TF_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPercentage = Math.min(100, Main.getProperties().forcedTFPercentage + 10);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FORCED_TF_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFPercentage = Math.max(0, Main.getProperties().forcedTFPercentage - 10);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_BREAST_GROWTH_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyBreastGrowth = Math.min(10, Main.getProperties().pregnancyBreastGrowth + 1);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_BREAST_GROWTH_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyBreastGrowth = Math.max(0, Main.getProperties().pregnancyBreastGrowth - 1);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_BREAST_GROWTH_LIMIT_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyBreastGrowthLimit = Math.min(100, Main.getProperties().pregnancyBreastGrowthLimit + 1);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_BREAST_GROWTH_LIMIT_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyBreastGrowthLimit = Math.max(0, Main.getProperties().pregnancyBreastGrowthLimit - 1);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_LACTATION_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyLactationIncrease = Math.min(1000, Main.getProperties().pregnancyLactationIncrease + 50);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_LACTATION_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyLactationIncrease = Math.max(0, Main.getProperties().pregnancyLactationIncrease - 50);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_LACTATION_LIMIT_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyLactationLimit = Math.min(Lactation.SEVEN_MONSTROUS_AMOUNT_POURING.getMaximumValue(), Main.getProperties().pregnancyLactationLimit + 250);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "PREGNANCY_LACTATION_LIMIT_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().pregnancyLactationLimit = Math.max(0, Main.getProperties().pregnancyLactationLimit - 250);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FORCED_FETISH_ON";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishPercentage = Math.min(100, Main.getProperties().forcedFetishPercentage + 10);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        id = "FORCED_FETISH_OFF";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishPercentage = Math.max(0, Main.getProperties().forcedFetishPercentage - 10);
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
        }
        // Forced TF Tendency setting events
        id = "FORCED_TF_TENDENCY_" + ForcedTFTendency.NEUTRAL;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFTendency = ForcedTFTendency.NEUTRAL;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedTFTendency.NEUTRAL.getName(), ForcedTFTendency.NEUTRAL.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_TF_TENDENCY_" + ForcedTFTendency.FEMININE;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFTendency = ForcedTFTendency.FEMININE;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedTFTendency.FEMININE.getName(), ForcedTFTendency.FEMININE.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_TF_TENDENCY_" + ForcedTFTendency.FEMININE_HEAVY;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFTendency = ForcedTFTendency.FEMININE_HEAVY;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedTFTendency.FEMININE_HEAVY.getName(), ForcedTFTendency.FEMININE_HEAVY.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_TF_TENDENCY_" + ForcedTFTendency.MASCULINE;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFTendency = ForcedTFTendency.MASCULINE;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedTFTendency.MASCULINE.getName(), ForcedTFTendency.MASCULINE.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_TF_TENDENCY_" + ForcedTFTendency.MASCULINE_HEAVY;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedTFTendency = ForcedTFTendency.MASCULINE_HEAVY;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedTFTendency.MASCULINE_HEAVY.getName(), ForcedTFTendency.MASCULINE_HEAVY.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        // Forced Fetish Tendency setting events
        id = "FORCED_FETISH_TENDENCY_" + ForcedFetishTendency.NEUTRAL;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishTendency = ForcedFetishTendency.NEUTRAL;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedFetishTendency.NEUTRAL.getName(), ForcedFetishTendency.NEUTRAL.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_FETISH_TENDENCY_" + ForcedFetishTendency.BOTTOM;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishTendency = ForcedFetishTendency.BOTTOM;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedFetishTendency.BOTTOM.getName(), ForcedFetishTendency.BOTTOM.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_FETISH_TENDENCY_" + ForcedFetishTendency.BOTTOM_HEAVY;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishTendency = ForcedFetishTendency.BOTTOM_HEAVY;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedFetishTendency.BOTTOM_HEAVY.getName(), ForcedFetishTendency.BOTTOM_HEAVY.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_FETISH_TENDENCY_" + ForcedFetishTendency.TOP;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishTendency = ForcedFetishTendency.TOP;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedFetishTendency.TOP.getName(), ForcedFetishTendency.TOP.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
        id = "FORCED_FETISH_TENDENCY_" + ForcedFetishTendency.TOP_HEAVY;
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.getProperties().forcedFetishTendency = ForcedFetishTendency.TOP_HEAVY;
                Main.saveProperties();
                Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(ForcedFetishTendency.TOP_HEAVY.getName(), ForcedFetishTendency.TOP_HEAVY.getDescription());
            addEventListener(document, id, "mouseenter", el, false);
        }
    }
    // Save/load:
    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.SAVE_LOAD) {
        for (File f : Main.getSavedGames()) {
            id = "overwrite_saved_" + f.getName().substring(0, f.getName().lastIndexOf('.'));
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (!Main.getProperties().overwriteWarning || OptionsDialogue.overwriteConfirmationName.equals(f.getName())) {
                        OptionsDialogue.overwriteConfirmationName = "";
                        Main.saveGame(f.getName().substring(0, f.getName().lastIndexOf('.')), true);
                    } else {
                        OptionsDialogue.overwriteConfirmationName = f.getName();
                        OptionsDialogue.loadConfirmationName = "";
                        OptionsDialogue.deleteConfirmationName = "";
                        Main.game.setContent(new Response("Save/Load", "Open the save/load game window.", OptionsDialogue.SAVE_LOAD));
                    }
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Overwrite", "");
                addEventListener(document, id, "mouseenter", el2, false);
            }
            id = "load_saved_" + f.getName().substring(0, f.getName().lastIndexOf('.'));
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (!Main.getProperties().overwriteWarning || OptionsDialogue.loadConfirmationName.equals(f.getName())) {
                        OptionsDialogue.loadConfirmationName = "";
                        Main.loadGame(f.getName().substring(0, f.getName().lastIndexOf('.')));
                    } else {
                        OptionsDialogue.overwriteConfirmationName = "";
                        OptionsDialogue.loadConfirmationName = f.getName();
                        OptionsDialogue.deleteConfirmationName = "";
                        Main.game.setContent(new Response("Save/Load", "Open the save/load game window.", OptionsDialogue.SAVE_LOAD));
                    }
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Load", "");
                addEventListener(document, id, "mouseenter", el2, false);
            }
            id = "delete_saved_" + f.getName().substring(0, f.getName().lastIndexOf('.'));
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (!Main.getProperties().overwriteWarning || OptionsDialogue.deleteConfirmationName.equals(f.getName())) {
                        OptionsDialogue.deleteConfirmationName = "";
                        Main.deleteGame(f.getName().substring(0, f.getName().lastIndexOf('.')));
                    } else {
                        OptionsDialogue.overwriteConfirmationName = "";
                        OptionsDialogue.loadConfirmationName = "";
                        OptionsDialogue.deleteConfirmationName = f.getName();
                        Main.game.setContent(new Response("Save/Load", "Open the save/load game window.", OptionsDialogue.SAVE_LOAD));
                    }
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Delete", "");
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        id = "new_saved";
        if (((EventTarget) document.getElementById(id)) != null) {
            ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenPField').innerHTML=document.getElementById('new_save_name').value;");
                Main.saveGame(Main.mainController.getWebEngine().getDocument().getElementById("hiddenPField").getTextContent(), false);
            }, false);
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Save", "");
            addEventListener(document, id, "mouseenter", el2, false);
        }
        id = "new_saved_disabled";
        if (((EventTarget) document.getElementById(id)) != null) {
            addEventListener(document, id, "mousemove", moveTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Save (Disabled)", (!Main.game.isStarted() ? "You need to have started a game before you can save!" : "You cannot save the game unless you are in a tile's default scene!"));
            addEventListener(document, id, "mouseenter", el2, false);
        }
    }
    // Import:
    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.IMPORT_EXPORT) {
        for (File f : Main.getCharactersForImport()) {
            id = "delete_saved_character_" + f.getName().substring(0, f.getName().lastIndexOf('.'));
            if (((EventTarget) document.getElementById(id)) != null) {
                ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                    if (!Main.getProperties().overwriteWarning || OptionsDialogue.deleteConfirmationName.equals(f.getName())) {
                        OptionsDialogue.deleteConfirmationName = "";
                        Main.deleteExportedCharacter(f.getName().substring(0, f.getName().lastIndexOf('.')));
                    } else {
                        OptionsDialogue.overwriteConfirmationName = "";
                        OptionsDialogue.loadConfirmationName = "";
                        OptionsDialogue.deleteConfirmationName = f.getName();
                        Main.game.setContent(new Response("Save/Load", "Open the save/load game window.", OptionsDialogue.SAVE_LOAD));
                    }
                }, false);
                addEventListener(document, id, "mousemove", moveTooltipListener, false);
                addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Delete", "");
                addEventListener(document, id, "mouseenter", el2, false);
            }
        }
        if (((EventTarget) document.getElementById("new_saved")) != null) {
            ((EventTarget) document.getElementById("new_saved")).addEventListener("click", e -> {
                Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenPField').innerHTML=document.getElementById('new_save_name').value;");
                Main.saveGame(Main.mainController.getWebEngine().getDocument().getElementById("hiddenPField").getTextContent(), false);
            }, false);
        }
    }
    if (Main.game.getCurrentDialogueNode() == CharacterCreation.IMPORT_CHOOSE) {
        for (File f : Main.getCharactersForImport()) {
            if (((EventTarget) document.getElementById("character_import_" + f.getName().substring(0, f.getName().lastIndexOf('.')))) != null) {
                ((EventTarget) document.getElementById("character_import_" + f.getName().substring(0, f.getName().lastIndexOf('.')))).addEventListener("click", e -> {
                    Main.importCharacter(f);
                }, false);
            }
        }
    }
    // Slave import:
    if (Main.game.getCurrentDialogueNode() == SlaverAlleyDialogue.AUCTION_IMPORT) {
        for (File f : Main.getSlavesForImport()) {
            if (((EventTarget) document.getElementById("import_slave_" + f.getName().substring(0, f.getName().lastIndexOf('.')))) != null) {
                ((EventTarget) document.getElementById("import_slave_" + f.getName().substring(0, f.getName().lastIndexOf('.')))).addEventListener("click", e -> {
                    try {
                        Game.importCharacterAsSlave(f.getName().substring(0, f.getName().lastIndexOf('.')));
                        this.updateUI();
                        Main.game.flashMessage(Colour.GENERIC_GOOD, "Imported Character!");
                    } catch (Exception ex) {
                        Main.game.flashMessage(Colour.GENERIC_BAD, "Import Failed!");
                    }
                }, false);
            }
        }
    }
    if (Main.game.getCurrentDialogueNode() == SlaverAlleyDialogue.AUCTION_BLOCK_LIST) {
        for (NPC npc : Main.game.getCharactersPresent()) {
            id = npc.getId() + "_BID";
            if (((EventTarget) document.getElementById(id)) != null) {
                if (Main.game.getPlayer().isHasSlaverLicense()) {
                    ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
                        SlaverAlleyDialogue.setupBidding(npc);
                        Main.game.setContent(new Response("", "", SlaverAlleyDialogue.AUCTION_BIDDING));
                    }, false);
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(UtilText.parse(npc, "Bid on [npc.name]"), UtilText.parse(npc, "Start bidding on [npc.name]. There's a chance that the bidding might exceed [npc.her] value, so make sure you have enough money first!"));
                    addEventListener(document, id, "mouseenter", el, false);
                } else {
                    addEventListener(document, id, "mousemove", moveTooltipListener, false);
                    addEventListener(document, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setInformation(UtilText.parse(npc, "Bid on [npc.name]"), UtilText.parse(npc, "You don't have a slaver license, so you're unable to big on any slaves!"));
                    addEventListener(document, id, "mouseenter", el, false);
                }
            }
        }
    }
    setResponseEventListeners();
}
Also used : TooltipInformationEventListener(com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener) AssSize(com.lilithsthrone.game.character.body.valueEnums.AssSize) TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) HipSize(com.lilithsthrone.game.character.body.valueEnums.HipSize) CharactersPresentDialogue(com.lilithsthrone.game.dialogue.utils.CharactersPresentDialogue) ButtonInventoryEventHandler(com.lilithsthrone.controller.eventListeners.buttons.ButtonInventoryEventHandler) PenisType(com.lilithsthrone.game.character.body.types.PenisType) OrificePlasticity(com.lilithsthrone.game.character.body.valueEnums.OrificePlasticity) ButtonCopyDialogueEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonCopyDialogueEventListener) TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) ButtonMoveSouthEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonMoveSouthEventListener) BreastShape(com.lilithsthrone.game.character.body.valueEnums.BreastShape) NPC(com.lilithsthrone.game.character.npc.NPC) GenderNames(com.lilithsthrone.game.character.gender.GenderNames) PenisSize(com.lilithsthrone.game.character.body.valueEnums.PenisSize) Document(org.w3c.dom.Document) Map(java.util.Map) NippleSize(com.lilithsthrone.game.character.body.valueEnums.NippleSize) PenisModifier(com.lilithsthrone.game.character.body.valueEnums.PenisModifier) SlaveryManagementDialogue(com.lilithsthrone.game.dialogue.SlaveryManagementDialogue) InventoryDialogue(com.lilithsthrone.game.dialogue.utils.InventoryDialogue) TooltipMoveEventListener(com.lilithsthrone.controller.eventListeners.TooltipMoveEventListener) SpecialAttack(com.lilithsthrone.game.combat.SpecialAttack) Colour(com.lilithsthrone.utils.Colour) PhoneDialogue(com.lilithsthrone.game.dialogue.utils.PhoneDialogue) SlaveJobHours(com.lilithsthrone.game.slavery.SlaveJobHours) EnchantingUtils(com.lilithsthrone.game.inventory.enchanting.EnchantingUtils) KeyEvent(javafx.scene.input.KeyEvent) TongueModifier(com.lilithsthrone.game.character.body.valueEnums.TongueModifier) CityHall(com.lilithsthrone.game.dialogue.places.dominion.CityHall) ClothingType(com.lilithsthrone.game.inventory.clothing.ClothingType) SlaverAlleyDialogue(com.lilithsthrone.game.dialogue.places.dominion.slaverAlley.SlaverAlleyDialogue) DamageType(com.lilithsthrone.game.combat.DamageType) SexParticipantType(com.lilithsthrone.game.sex.SexParticipantType) FaceType(com.lilithsthrone.game.character.body.types.FaceType) TFPotency(com.lilithsthrone.game.inventory.enchanting.TFPotency) Combat(com.lilithsthrone.game.combat.Combat) SuccubisSecrets(com.lilithsthrone.game.dialogue.places.dominion.shoppingArcade.SuccubisSecrets) Game(com.lilithsthrone.game.Game) Femininity(com.lilithsthrone.game.character.body.valueEnums.Femininity) AntennaType(com.lilithsthrone.game.character.body.types.AntennaType) SlavePermission(com.lilithsthrone.game.slavery.SlavePermission) PlaceType(com.lilithsthrone.world.places.PlaceType) WeaponType(com.lilithsthrone.game.inventory.weapon.WeaponType) Cell(com.lilithsthrone.world.Cell) SexType(com.lilithsthrone.game.sex.SexType) ButtonMoveEastEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonMoveEastEventListener) ResponseEffectsOnly(com.lilithsthrone.game.dialogue.responses.ResponseEffectsOnly) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) AbstractCoreItem(com.lilithsthrone.game.inventory.AbstractCoreItem) SetContentEventListener(com.lilithsthrone.controller.eventListeners.SetContentEventListener) BodyChanging(com.lilithsthrone.game.dialogue.utils.BodyChanging) BodyCoveringType(com.lilithsthrone.game.character.body.types.BodyCoveringType) PlaceUpgrade(com.lilithsthrone.world.places.PlaceUpgrade) ArrayList(java.util.ArrayList) CupSize(com.lilithsthrone.game.character.body.valueEnums.CupSize) NameTriplet(com.lilithsthrone.game.character.NameTriplet) FurryPreference(com.lilithsthrone.game.character.race.FurryPreference) ResourceBundle(java.util.ResourceBundle) ButtonMoveNorthEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonMoveNorthEventListener) OrificeType(com.lilithsthrone.game.sex.OrificeType) HairLength(com.lilithsthrone.game.character.body.valueEnums.HairLength) LabiaSize(com.lilithsthrone.game.character.body.valueEnums.LabiaSize) BodyHair(com.lilithsthrone.game.character.body.valueEnums.BodyHair) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot) Personality(com.lilithsthrone.game.character.Personality) KeyboardAction(com.lilithsthrone.game.settings.KeyboardAction) Sex(com.lilithsthrone.game.sex.Sex) OptionsDialogue(com.lilithsthrone.game.dialogue.utils.OptionsDialogue) GridPane(javafx.scene.layout.GridPane) KeyCodeWithModifiers(com.lilithsthrone.game.settings.KeyCodeWithModifiers) SlaveJobSetting(com.lilithsthrone.game.slavery.SlaveJobSetting) TesticleSize(com.lilithsthrone.game.character.body.valueEnums.TesticleSize) BodySize(com.lilithsthrone.game.character.body.valueEnums.BodySize) ButtonMoveWestEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonMoveWestEventListener) TooltipResponseDescriptionEventListener(com.lilithsthrone.controller.eventListeners.TooltipResponseDescriptionEventListener) Gender(com.lilithsthrone.game.character.gender.Gender) Breast(com.lilithsthrone.game.character.body.Breast) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) Rarity(com.lilithsthrone.game.inventory.Rarity) EnchantmentEventListener(com.lilithsthrone.controller.eventListeners.EnchantmentEventListener) Perk(com.lilithsthrone.game.character.effects.Perk) ClitorisSize(com.lilithsthrone.game.character.body.valueEnums.ClitorisSize) PenisGirth(com.lilithsthrone.game.character.body.valueEnums.PenisGirth) DebugDialogue(com.lilithsthrone.game.dialogue.DebugDialogue) File(java.io.File) LilayaHomeGeneric(com.lilithsthrone.game.dialogue.places.dominion.lilayashome.LilayaHomeGeneric) ButtonMainMenuEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonMainMenuEventListener) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) EventListener(org.w3c.dom.events.EventListener) PenetrationType(com.lilithsthrone.game.sex.PenetrationType) TooltipInformationEventListener(com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener) Subspecies(com.lilithsthrone.game.character.race.Subspecies) Main(com.lilithsthrone.main.Main) ObservableValue(javafx.beans.value.ObservableValue) PerkManager(com.lilithsthrone.game.character.effects.PerkManager) AssType(com.lilithsthrone.game.character.body.types.AssType) GameCharacter(com.lilithsthrone.game.character.GameCharacter) SkinType(com.lilithsthrone.game.character.body.types.SkinType) EventHandler(javafx.event.EventHandler) Initializable(javafx.fxml.Initializable) Muscle(com.lilithsthrone.game.character.body.valueEnums.Muscle) URL(java.net.URL) InventoryTooltipEventListener(com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener) SexualOrientation(com.lilithsthrone.game.character.SexualOrientation) Spell(com.lilithsthrone.game.combat.Spell) RenderingEngine(com.lilithsthrone.rendering.RenderingEngine) VBox(javafx.scene.layout.VBox) CoveringModifier(com.lilithsthrone.game.character.body.valueEnums.CoveringModifier) TooltipResponseMoveEventListener(com.lilithsthrone.controller.eventListeners.TooltipResponseMoveEventListener) LegType(com.lilithsthrone.game.character.body.types.LegType) VaginaType(com.lilithsthrone.game.character.body.types.VaginaType) EventTarget(org.w3c.dom.events.EventTarget) CumProduction(com.lilithsthrone.game.character.body.valueEnums.CumProduction) AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) TooltipHideEventListener(com.lilithsthrone.controller.eventListeners.TooltipHideEventListener) LipSize(com.lilithsthrone.game.character.body.valueEnums.LipSize) TailType(com.lilithsthrone.game.character.body.types.TailType) ListValue(com.lilithsthrone.utils.Util.ListValue) BreastType(com.lilithsthrone.game.character.body.types.BreastType) UtilText(com.lilithsthrone.game.dialogue.utils.UtilText) SlavePermissionSetting(com.lilithsthrone.game.slavery.SlavePermissionSetting) OrificeModifier(com.lilithsthrone.game.character.body.valueEnums.OrificeModifier) DialogueFlagValue(com.lilithsthrone.game.dialogue.DialogueFlagValue) CopyInfoEventListener(com.lilithsthrone.controller.eventListeners.information.CopyInfoEventListener) InventorySelectedItemEventListener(com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener) CharacterModificationUtils(com.lilithsthrone.game.dialogue.utils.CharacterModificationUtils) EarType(com.lilithsthrone.game.character.body.types.EarType) GiftDialogue(com.lilithsthrone.game.dialogue.utils.GiftDialogue) Response(com.lilithsthrone.game.dialogue.responses.Response) CharacterCreation(com.lilithsthrone.game.dialogue.story.CharacterCreation) Util(com.lilithsthrone.utils.Util) FXML(javafx.fxml.FXML) List(java.util.List) CharacterChangeEventListener(com.lilithsthrone.game.character.CharacterChangeEventListener) Covering(com.lilithsthrone.game.character.body.Covering) PerkCategory(com.lilithsthrone.game.character.effects.PerkCategory) TFEssence(com.lilithsthrone.game.inventory.enchanting.TFEssence) DialogueNodeOld(com.lilithsthrone.game.dialogue.DialogueNodeOld) InventoryInteraction(com.lilithsthrone.game.dialogue.utils.InventoryInteraction) Entry(java.util.Map.Entry) EyeType(com.lilithsthrone.game.character.body.types.EyeType) AbstractWeapon(com.lilithsthrone.game.inventory.weapon.AbstractWeapon) WorldType(com.lilithsthrone.world.WorldType) WebEngine(javafx.scene.web.WebEngine) Testicle(com.lilithsthrone.game.character.body.Testicle) ListView(javafx.scene.control.ListView) EnchantmentDialogue(com.lilithsthrone.game.dialogue.utils.EnchantmentDialogue) ButtonCharactersEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonCharactersEventListener) FetishDesire(com.lilithsthrone.game.character.fetishes.FetishDesire) HornType(com.lilithsthrone.game.character.body.types.HornType) HashMap(java.util.HashMap) WingType(com.lilithsthrone.game.character.body.types.WingType) ArmType(com.lilithsthrone.game.character.body.types.ArmType) ButtonZoomEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonZoomEventListener) AreolaeSize(com.lilithsthrone.game.character.body.valueEnums.AreolaeSize) MapDisplay(com.lilithsthrone.game.dialogue.MapDisplay) OrificeElasticity(com.lilithsthrone.game.character.body.valueEnums.OrificeElasticity) HairStyle(com.lilithsthrone.game.character.body.valueEnums.HairStyle) State(javafx.concurrent.Worker.State) ForcedFetishTendency(com.lilithsthrone.game.settings.ForcedFetishTendency) SlaveJob(com.lilithsthrone.game.slavery.SlaveJob) Tooltip(javafx.scene.control.Tooltip) Capacity(com.lilithsthrone.game.character.body.valueEnums.Capacity) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) KeyCode(javafx.scene.input.KeyCode) WebView(javafx.scene.web.WebView) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) GenderPreference(com.lilithsthrone.game.character.gender.GenderPreference) Wetness(com.lilithsthrone.game.character.body.valueEnums.Wetness) Month(java.time.Month) Lactation(com.lilithsthrone.game.character.body.valueEnums.Lactation) AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) Attribute(com.lilithsthrone.game.character.attributes.Attribute) AbstractWeaponType(com.lilithsthrone.game.inventory.weapon.AbstractWeaponType) HairType(com.lilithsthrone.game.character.body.types.HairType) PiercingType(com.lilithsthrone.game.character.body.valueEnums.PiercingType) ButtonJournalEventListener(com.lilithsthrone.controller.eventListeners.buttons.ButtonJournalEventListener) History(com.lilithsthrone.game.character.History) GenderPronoun(com.lilithsthrone.game.character.gender.GenderPronoun) ForcedTFTendency(com.lilithsthrone.game.settings.ForcedTFTendency) EyeShape(com.lilithsthrone.game.character.body.valueEnums.EyeShape) PerkEntry(com.lilithsthrone.game.character.effects.PerkEntry) CoveringPattern(com.lilithsthrone.game.character.body.valueEnums.CoveringPattern) Vector2i(com.lilithsthrone.utils.Vector2i) ContentDisplay(javafx.scene.control.ContentDisplay) BreastType(com.lilithsthrone.game.character.body.types.BreastType) CupSize(com.lilithsthrone.game.character.body.valueEnums.CupSize) Covering(com.lilithsthrone.game.character.body.Covering) Gender(com.lilithsthrone.game.character.gender.Gender) History(com.lilithsthrone.game.character.History) InventorySelectedItemEventListener(com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener) Month(java.time.Month) Capacity(com.lilithsthrone.game.character.body.valueEnums.Capacity) AssType(com.lilithsthrone.game.character.body.types.AssType) AbstractClothingType(com.lilithsthrone.game.inventory.clothing.AbstractClothingType) TFPotency(com.lilithsthrone.game.inventory.enchanting.TFPotency) SlaveJobHours(com.lilithsthrone.game.slavery.SlaveJobHours) InventoryTooltipEventListener(com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener) SexualOrientation(com.lilithsthrone.game.character.SexualOrientation) CumProduction(com.lilithsthrone.game.character.body.valueEnums.CumProduction) FaceType(com.lilithsthrone.game.character.body.types.FaceType) NameTriplet(com.lilithsthrone.game.character.NameTriplet) TFEssence(com.lilithsthrone.game.inventory.enchanting.TFEssence) BreastShape(com.lilithsthrone.game.character.body.valueEnums.BreastShape) Perk(com.lilithsthrone.game.character.effects.Perk) AssSize(com.lilithsthrone.game.character.body.valueEnums.AssSize) HipSize(com.lilithsthrone.game.character.body.valueEnums.HipSize) PiercingType(com.lilithsthrone.game.character.body.valueEnums.PiercingType) AbstractWeaponType(com.lilithsthrone.game.inventory.weapon.AbstractWeaponType) CoveringPattern(com.lilithsthrone.game.character.body.valueEnums.CoveringPattern) NippleSize(com.lilithsthrone.game.character.body.valueEnums.NippleSize) DialogueNodeOld(com.lilithsthrone.game.dialogue.DialogueNodeOld) PenisSize(com.lilithsthrone.game.character.body.valueEnums.PenisSize) Colour(com.lilithsthrone.utils.Colour) PerkEntry(com.lilithsthrone.game.character.effects.PerkEntry) AreolaeSize(com.lilithsthrone.game.character.body.valueEnums.AreolaeSize) PenisGirth(com.lilithsthrone.game.character.body.valueEnums.PenisGirth) SexType(com.lilithsthrone.game.sex.SexType) EnchantmentEventListener(com.lilithsthrone.controller.eventListeners.EnchantmentEventListener) HairLength(com.lilithsthrone.game.character.body.valueEnums.HairLength) Personality(com.lilithsthrone.game.character.Personality) PenisType(com.lilithsthrone.game.character.body.types.PenisType) DamageType(com.lilithsthrone.game.combat.DamageType) VaginaType(com.lilithsthrone.game.character.body.types.VaginaType) AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) HairType(com.lilithsthrone.game.character.body.types.HairType) OrificePlasticity(com.lilithsthrone.game.character.body.valueEnums.OrificePlasticity) WingType(com.lilithsthrone.game.character.body.types.WingType) OrificeModifier(com.lilithsthrone.game.character.body.valueEnums.OrificeModifier) CoveringModifier(com.lilithsthrone.game.character.body.valueEnums.CoveringModifier) SlavePermission(com.lilithsthrone.game.slavery.SlavePermission) BodyCoveringType(com.lilithsthrone.game.character.body.types.BodyCoveringType) TesticleSize(com.lilithsthrone.game.character.body.valueEnums.TesticleSize) ClitorisSize(com.lilithsthrone.game.character.body.valueEnums.ClitorisSize) EyeShape(com.lilithsthrone.game.character.body.valueEnums.EyeShape) PenisModifier(com.lilithsthrone.game.character.body.valueEnums.PenisModifier) Subspecies(com.lilithsthrone.game.character.race.Subspecies) TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) EarType(com.lilithsthrone.game.character.body.types.EarType) BodyHair(com.lilithsthrone.game.character.body.valueEnums.BodyHair) LabiaSize(com.lilithsthrone.game.character.body.valueEnums.LabiaSize) ArrayList(java.util.ArrayList) List(java.util.List) Muscle(com.lilithsthrone.game.character.body.valueEnums.Muscle) HornType(com.lilithsthrone.game.character.body.types.HornType) Cell(com.lilithsthrone.world.Cell) HairStyle(com.lilithsthrone.game.character.body.valueEnums.HairStyle) GenderPreference(com.lilithsthrone.game.character.gender.GenderPreference) KeyboardAction(com.lilithsthrone.game.settings.KeyboardAction) PlaceUpgrade(com.lilithsthrone.world.places.PlaceUpgrade) AntennaType(com.lilithsthrone.game.character.body.types.AntennaType) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) TailType(com.lilithsthrone.game.character.body.types.TailType) Wetness(com.lilithsthrone.game.character.body.valueEnums.Wetness) TongueModifier(com.lilithsthrone.game.character.body.valueEnums.TongueModifier) ArmType(com.lilithsthrone.game.character.body.types.ArmType) BodySize(com.lilithsthrone.game.character.body.valueEnums.BodySize) ResponseEffectsOnly(com.lilithsthrone.game.dialogue.responses.ResponseEffectsOnly) File(java.io.File) TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) NPC(com.lilithsthrone.game.character.npc.NPC) SlaveJobSetting(com.lilithsthrone.game.slavery.SlaveJobSetting) PerkCategory(com.lilithsthrone.game.character.effects.PerkCategory) LipSize(com.lilithsthrone.game.character.body.valueEnums.LipSize) LegType(com.lilithsthrone.game.character.body.types.LegType) SlaveJob(com.lilithsthrone.game.slavery.SlaveJob) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) FurryPreference(com.lilithsthrone.game.character.race.FurryPreference) EyeType(com.lilithsthrone.game.character.body.types.EyeType) AbstractWeapon(com.lilithsthrone.game.inventory.weapon.AbstractWeapon) EventTarget(org.w3c.dom.events.EventTarget) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot) SkinType(com.lilithsthrone.game.character.body.types.SkinType) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) Response(com.lilithsthrone.game.dialogue.responses.Response) SlavePermissionSetting(com.lilithsthrone.game.slavery.SlavePermissionSetting) FetishDesire(com.lilithsthrone.game.character.fetishes.FetishDesire) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) OrificeElasticity(com.lilithsthrone.game.character.body.valueEnums.OrificeElasticity)

Example 2 with TFPotency

use of com.lilithsthrone.game.inventory.enchanting.TFPotency in project liliths-throne-public by Innoxia.

the class AbstractClothing method loadFromXML.

public static AbstractClothing loadFromXML(Element parentElement, Document doc) {
    AbstractClothing clothing = null;
    try {
        clothing = AbstractClothingType.generateClothing(ClothingType.getClothingTypeFromId(parentElement.getAttribute("id")), false);
    } catch (Exception ex) {
        System.err.println("Warning: An instance of AbstractClothing was unable to be imported. (" + parentElement.getAttribute("id") + ")");
        return null;
    }
    if (clothing == null) {
        System.err.println("Warning: An instance of AbstractClothing was unable to be imported. (" + parentElement.getAttribute("id") + ")");
        return null;
    }
    // Try to load colour:
    try {
        clothing.setColour(Colour.valueOf(parentElement.getAttribute("colour")));
        if (!parentElement.getAttribute("colourSecondary").isEmpty()) {
            Colour secColour = Colour.valueOf(parentElement.getAttribute("colourSecondary"));
            if (clothing.clothingType.getAllAvailableSecondaryColours().contains(secColour)) {
                clothing.setSecondaryColour(secColour);
            }
        }
        if (!parentElement.getAttribute("colourTertiary").isEmpty()) {
            Colour terColour = Colour.valueOf(parentElement.getAttribute("colourTertiary"));
            if (clothing.clothingType.getAllAvailableTertiaryColours().contains(terColour)) {
                clothing.setTertiaryColour(terColour);
            }
        }
    } catch (Exception ex) {
    }
    // Try to load core features:
    try {
        if (!parentElement.getAttribute("sealed").isEmpty()) {
            clothing.setSealed(Boolean.valueOf(parentElement.getAttribute("sealed")));
        }
        clothing.setDirty(Boolean.valueOf(parentElement.getAttribute("isDirty")));
        clothing.setEnchantmentKnown(Boolean.valueOf(parentElement.getAttribute("enchantmentKnown")));
    } catch (Exception ex) {
    }
    if (parentElement.getElementsByTagName("attributeModifiers") != null && parentElement.getElementsByTagName("attributeModifiers").getLength() > 0) {
        if (clothing.getClothingType().getClothingSet() == null) {
            clothing.getEffects().clear();
            Element element = (Element) parentElement.getElementsByTagName("attributeModifiers").item(0);
            for (int i = 0; i < element.getElementsByTagName("modifier").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("modifier").item(i));
                try {
                    Attribute att = Attribute.valueOf(e.getAttribute("attribute"));
                    int value = Integer.valueOf(e.getAttribute("value"));
                    TFPotency pot = TFPotency.BOOST;
                    if (value <= -5) {
                        pot = TFPotency.MAJOR_DRAIN;
                    } else if (value <= -3) {
                        pot = TFPotency.DRAIN;
                    } else if (value <= -1) {
                        pot = TFPotency.MINOR_DRAIN;
                    } else if (value <= 1) {
                        pot = TFPotency.MINOR_BOOST;
                    } else if (value <= 3) {
                        pot = TFPotency.BOOST;
                    } else {
                        pot = TFPotency.MAJOR_BOOST;
                    }
                    for (TFModifier mod : TFModifier.getClothingAttributeList()) {
                        if (mod.getAssociatedAttribute() == att) {
                            clothing.addEffect(new ItemEffect(ItemEffectType.CLOTHING, TFModifier.CLOTHING_ATTRIBUTE, mod, pot, 0));
                            break;
                        }
                    }
                } catch (Exception ex) {
                }
            }
        }
    } else {
        try {
            clothing.getEffects().clear();
            Element element = (Element) parentElement.getElementsByTagName("effects").item(0);
            for (int i = 0; i < element.getElementsByTagName("effect").getLength(); i++) {
                Element e = ((Element) element.getElementsByTagName("effect").item(i));
                clothing.addEffect(ItemEffect.loadFromXML(e, doc));
            }
        } catch (Exception ex) {
        }
    }
    // Try to load displacements:
    try {
        clothing.displacedList = new ArrayList<>();
        Element displacementElement = (Element) parentElement.getElementsByTagName("displacedList").item(0);
        for (int i = 0; i < displacementElement.getElementsByTagName("displacementType").getLength(); i++) {
            Element e = ((Element) displacementElement.getElementsByTagName("displacementType").item(i));
            clothing.displacedList.add(DisplacementType.valueOf(e.getAttribute("value")));
        }
    } catch (Exception ex) {
    }
    return clothing;
}
Also used : TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) Attribute(com.lilithsthrone.game.character.attributes.Attribute) Element(org.w3c.dom.Element) TFPotency(com.lilithsthrone.game.inventory.enchanting.TFPotency) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) Colour(com.lilithsthrone.utils.Colour)

Example 3 with TFPotency

use of com.lilithsthrone.game.inventory.enchanting.TFPotency in project liliths-throne-public by Innoxia.

the class NPC method generateFetishPotion.

/**
 * Example return value: ["Let's see if you don't enjoy sucking my dick after this!", AbstractItem]
 * @return NPC's speech as a reaction to giving you this potion, along with the potion itself.
 */
public Value<String, AbstractItem> generateFetishPotion(Boolean pairedFetishesOnly) {
    // this will be the ultimately selected effect, or null if none available
    ItemEffect selectedEffect = null;
    // this will be a flavor text string paired with the effect
    String selectedEffectString;
    Map<ItemEffect, Integer> possibleEffects = new HashMap<>();
    AbstractItemType itemType = ItemType.FETISH_UNREFINED;
    Fetish currentTopFetish = null, currentBottomFetish = null;
    TFModifier currentTopModifier = null, currentBottomModifier = null;
    TFPotency currentTopPotency = null, currentBottomPotency = null, currentTopRemovePotency = null, currentBottomRemovePotency = null;
    ;
    int baseTopChance = 5, baseBottomChance = 5, baseTopRemoveChance = 0, baseBottomRemoveChance = 0;
    int currentTopChance = 0, currentBottomChance = 0, currentTopRemoveChance = 0, currentBottomRemoveChance = 0;
    int pairedFetishMultiplier = 5;
    // heavy tendency can still allow small chance giving a matched fetish, otherwise no chance at all
    int matchedFetishDecrement = 8;
    // only a modest increase in chances to matched fetish
    int matchedFetishRemoveIncrement = 1;
    // for now, keeping it simple, only modifying add chances based on desires, one increment (or decrement) per level
    int desiredFetishIncrement = 2;
    // for now, keeping it simple, only modifying add chances based on exp, one increment per level
    int expFetishIncrement = 1;
    switch(Main.getProperties().forcedFetishTendency) {
        case NEUTRAL:
            baseTopChance = 5;
            baseBottomChance = 5;
            baseTopRemoveChance = 2;
            baseBottomRemoveChance = 2;
            break;
        case BOTTOM:
            baseTopChance = 1;
            baseBottomChance = 8;
            baseTopRemoveChance = 3;
            baseBottomRemoveChance = 0;
            break;
        case BOTTOM_HEAVY:
            baseTopChance = -2;
            baseBottomChance = 10;
            baseTopRemoveChance = 4;
            baseBottomRemoveChance = -1;
            break;
        case TOP:
            baseTopChance = 8;
            baseBottomChance = 1;
            baseTopRemoveChance = 0;
            baseBottomRemoveChance = 3;
            break;
        case TOP_HEAVY:
            baseTopChance = 10;
            baseBottomChance = -2;
            baseTopRemoveChance = -1;
            baseBottomRemoveChance = 4;
            break;
    }
    // map of top -> bottom paired fetishes; NPCs with a paired fetish will greatly favor
    // giving the player it's pair, and remove that fetish if there is a match
    Map<Fetish, Fetish> pairedFetishMap = new HashMap<>();
    pairedFetishMap.put(Fetish.FETISH_ANAL_GIVING, Fetish.FETISH_ANAL_RECEIVING);
    pairedFetishMap.put(Fetish.FETISH_VAGINAL_GIVING, Fetish.FETISH_VAGINAL_RECEIVING);
    pairedFetishMap.put(Fetish.FETISH_BREASTS_OTHERS, Fetish.FETISH_BREASTS_SELF);
    pairedFetishMap.put(Fetish.FETISH_ORAL_RECEIVING, Fetish.FETISH_ORAL_GIVING);
    pairedFetishMap.put(Fetish.FETISH_LEG_LOVER, Fetish.FETISH_STRUTTER);
    pairedFetishMap.put(Fetish.FETISH_DOMINANT, Fetish.FETISH_SUBMISSIVE);
    pairedFetishMap.put(Fetish.FETISH_CUM_STUD, Fetish.FETISH_CUM_ADDICT);
    pairedFetishMap.put(Fetish.FETISH_DEFLOWERING, Fetish.FETISH_PURE_VIRGIN);
    pairedFetishMap.put(Fetish.FETISH_IMPREGNATION, Fetish.FETISH_PREGNANCY);
    pairedFetishMap.put(Fetish.FETISH_SEEDER, Fetish.FETISH_BROODMOTHER);
    pairedFetishMap.put(Fetish.FETISH_SADIST, Fetish.FETISH_MASOCHIST);
    pairedFetishMap.put(Fetish.FETISH_NON_CON_DOM, Fetish.FETISH_NON_CON_SUB);
    pairedFetishMap.put(Fetish.FETISH_DENIAL, Fetish.FETISH_DENIAL_SELF);
    pairedFetishMap.put(Fetish.FETISH_VOYEURIST, Fetish.FETISH_EXHIBITIONIST);
    // out of the list entirely, but for now let's have them in there
    if (!pairedFetishesOnly) {
        pairedFetishMap.put(Fetish.FETISH_TRANSFORMATION_GIVING, Fetish.FETISH_TRANSFORMATION_RECEIVING);
        pairedFetishMap.put(Fetish.FETISH_KINK_GIVING, Fetish.FETISH_KINK_RECEIVING);
    }
    for (Entry<Fetish, Fetish> entry : pairedFetishMap.entrySet()) {
        currentTopFetish = entry.getKey();
        currentBottomFetish = entry.getValue();
        currentTopModifier = TFModifier.valueOf("TF_MOD_" + currentTopFetish);
        currentBottomModifier = TFModifier.valueOf("TF_MOD_" + currentBottomFetish);
        currentTopPotency = TFPotency.MINOR_BOOST;
        currentBottomPotency = TFPotency.MINOR_BOOST;
        currentTopRemovePotency = TFPotency.MINOR_DRAIN;
        currentBottomRemovePotency = TFPotency.MINOR_DRAIN;
        currentTopChance = baseTopChance;
        currentBottomChance = baseBottomChance;
        currentTopRemoveChance = baseTopRemoveChance;
        currentBottomRemoveChance = baseBottomRemoveChance;
        // Increase base add chances based on NPC's desire levels for these fetishes
        switch(this.getFetishDesire(currentBottomFetish)) {
            case THREE_LIKE:
                currentTopChance += desiredFetishIncrement;
                break;
            case FOUR_LOVE:
                currentTopChance += desiredFetishIncrement * 2;
                break;
            case ONE_DISLIKE:
                currentTopChance -= desiredFetishIncrement;
                break;
            case ZERO_HATE:
                currentTopChance = 0;
                break;
            default:
        }
        switch(this.getFetishDesire(currentTopFetish)) {
            case THREE_LIKE:
                currentBottomChance += desiredFetishIncrement;
                break;
            case FOUR_LOVE:
                currentBottomChance += desiredFetishIncrement * 2;
                break;
            case ONE_DISLIKE:
                currentBottomChance -= desiredFetishIncrement;
                break;
            case ZERO_HATE:
                currentBottomChance = 0;
                break;
            default:
        }
        // Increase base add chances based on NPC's experience levels for these fetishes
        switch(this.getFetishLevel(currentBottomFetish)) {
            case ONE_AMATEUR:
                currentTopChance += expFetishIncrement;
                break;
            case TWO_EXPERIENCED:
                currentTopChance += expFetishIncrement * 2;
                break;
            case THREE_EXPERT:
                currentTopChance += expFetishIncrement * 3;
                break;
            case FOUR_MASTERFUL:
                currentTopChance += expFetishIncrement * 4;
                break;
            default:
        }
        switch(this.getFetishLevel(currentTopFetish)) {
            case ONE_AMATEUR:
                currentBottomChance += expFetishIncrement;
                break;
            case TWO_EXPERIENCED:
                currentBottomChance += expFetishIncrement * 2;
                break;
            case THREE_EXPERT:
                currentBottomChance += expFetishIncrement * 3;
                break;
            case FOUR_MASTERFUL:
                currentBottomChance += expFetishIncrement * 4;
                break;
            default:
        }
        // set chances if NPC has top fetish
        if (this.hasFetish(currentTopFetish)) {
            currentBottomChance *= pairedFetishMultiplier;
            currentTopChance -= matchedFetishDecrement;
            currentBottomRemoveChance = 0;
            if (!pairedFetishesOnly) {
                currentTopRemoveChance += matchedFetishRemoveIncrement;
            }
        } else if (pairedFetishesOnly) {
            currentBottomChance = 0;
            // in paired only mode, we're only adding fetishes
            currentTopRemoveChance = 0;
            currentBottomRemoveChance = 0;
        }
        // set chances if NPC has bottom fetish
        if (this.hasFetish(currentBottomFetish)) {
            currentTopChance *= pairedFetishMultiplier;
            currentBottomChance -= matchedFetishDecrement;
            currentTopRemoveChance = 0;
            if (!pairedFetishesOnly) {
                currentBottomRemoveChance += matchedFetishRemoveIncrement;
            }
        } else if (pairedFetishesOnly) {
            currentTopChance = 0;
            // in paired only mode, we're only adding fetishes
            currentTopRemoveChance = 0;
            currentBottomRemoveChance = 0;
        }
        // if player has positive bottom fetish desire, adjust potency level to fully add fetish, not just desire
        if (Main.game.getPlayer().getFetishDesire(currentBottomFetish) == FetishDesire.THREE_LIKE || Main.game.getPlayer().getFetishDesire(currentBottomFetish) == FetishDesire.FOUR_LOVE) {
            currentBottomPotency = TFPotency.BOOST;
        } else if (Main.game.getPlayer().getFetishDesire(currentBottomFetish) == FetishDesire.TWO_NEUTRAL) {
            int rand = Util.random.nextInt(100);
            // if the player is neutral, but the NPC has fetish,small chance to fully add rather than just boost desire
            if (this.hasFetish(currentTopFetish) && rand < 30) {
                currentBottomPotency = TFPotency.BOOST;
            }
        } else {
            // if they are already less than neutral, don't remove any more
            currentBottomRemoveChance = 0;
        }
        // prevent extraneous effects if player has bottom fetish, plus alter remove potency to drop fetish, not just desire
        if (Main.game.getPlayer().hasFetish(currentBottomFetish)) {
            currentBottomChance = 0;
            currentBottomRemovePotency = TFPotency.DRAIN;
        }
        // if player has positive top fetish desire, adjust potency level to fully add fetish, not just desire
        if (Main.game.getPlayer().getFetishDesire(currentTopFetish) == FetishDesire.THREE_LIKE || Main.game.getPlayer().getFetishDesire(currentTopFetish) == FetishDesire.FOUR_LOVE) {
            currentTopPotency = TFPotency.BOOST;
        } else if (Main.game.getPlayer().getFetishDesire(currentTopFetish) == FetishDesire.TWO_NEUTRAL) {
            int rand = Util.random.nextInt(100);
            // if the player is neutral, but the NPC has paired fetish,small chance to fully add rather than just boost desire
            if (this.hasFetish(currentBottomFetish) && rand < 30) {
                currentTopPotency = TFPotency.BOOST;
            }
        } else {
            // if they are already less than neutral, don't remove any more
            currentTopRemoveChance = 0;
        }
        // prevent extraneous effects if player has top fetish, plus alter remove potency to drop fetish, not just desire
        if (Main.game.getPlayer().hasFetish(currentTopFetish)) {
            currentTopChance = 0;
            currentTopRemovePotency = TFPotency.DRAIN;
        }
        // some settings and status combinations can create negative values, so let's zero those out
        if (currentTopChance < 0) {
            currentTopChance = 0;
        }
        if (currentBottomChance < 0) {
            currentBottomChance = 0;
        }
        if (currentTopRemoveChance < 0) {
            currentTopRemoveChance = 0;
        }
        if (currentBottomRemoveChance < 0) {
            currentBottomRemoveChance = 0;
        }
        if (currentTopChance > 0) {
            possibleEffects.put(new ItemEffect(itemType.getEnchantmentEffect(), TFModifier.NONE, currentTopModifier, currentTopPotency, 1), currentTopChance);
        }
        if (currentTopRemoveChance > 0) {
            possibleEffects.put(new ItemEffect(itemType.getEnchantmentEffect(), TFModifier.NONE, currentTopModifier, currentTopRemovePotency, 1), currentTopRemoveChance);
        }
        if (currentBottomChance > 0) {
            possibleEffects.put(new ItemEffect(itemType.getEnchantmentEffect(), TFModifier.NONE, currentBottomModifier, currentBottomPotency, 1), currentBottomChance);
        }
        if (currentBottomRemoveChance > 0) {
            possibleEffects.put(new ItemEffect(itemType.getEnchantmentEffect(), TFModifier.NONE, currentBottomModifier, currentBottomRemovePotency, 1), currentBottomRemoveChance);
        }
    }
    // map of unpaired fetish -> boolean stating whether it wants to be shared, or hoarded
    // currently, all unpaired fetishes seem like they are something the owner would want to share,
    // but setting the second argument to false will cause the NPC to instead have an aversion to
    // giving the player the same fetish
    Map<Fetish, Boolean> unpairedFetishMap = new HashMap<>();
    unpairedFetishMap.put(Fetish.FETISH_BIMBO, true);
    unpairedFetishMap.put(Fetish.FETISH_CROSS_DRESSER, true);
    unpairedFetishMap.put(Fetish.FETISH_INCEST, true);
    unpairedFetishMap.put(Fetish.FETISH_MASTURBATION, true);
    for (Entry<Fetish, Boolean> entry : unpairedFetishMap.entrySet()) {
        currentTopFetish = entry.getKey();
        Boolean wantsToShare = entry.getValue();
        currentTopModifier = TFModifier.valueOf("TF_MOD_" + currentTopFetish);
        currentTopPotency = TFPotency.MINOR_BOOST;
        currentTopRemovePotency = TFPotency.MINOR_DRAIN;
        currentTopChance = baseTopChance;
        currentTopRemoveChance = baseTopRemoveChance;
        if (wantsToShare) {
            // Increase base add chances based on NPC's experience levels for this fetishes
            switch(this.getFetishDesire(currentTopFetish)) {
                case THREE_LIKE:
                    currentTopChance += desiredFetishIncrement;
                    break;
                case FOUR_LOVE:
                    currentTopChance += desiredFetishIncrement * 2;
                    break;
                case ONE_DISLIKE:
                    currentTopChance -= desiredFetishIncrement;
                    break;
                case ZERO_HATE:
                    currentTopChance = 0;
                    break;
                default:
            }
            // Increase base add chances based on NPC's experience levels for this fetishes
            switch(this.getFetishLevel(currentTopFetish)) {
                case ONE_AMATEUR:
                    currentTopChance += expFetishIncrement;
                    break;
                case TWO_EXPERIENCED:
                    currentTopChance += expFetishIncrement * 2;
                    break;
                case THREE_EXPERT:
                    currentTopChance += expFetishIncrement * 3;
                    break;
                case FOUR_MASTERFUL:
                    currentTopChance += expFetishIncrement * 4;
                    break;
                default:
            }
        }
        // set chances if NPC has top fetish
        if (this.hasFetish(currentTopFetish)) {
            if (wantsToShare) {
                currentTopChance *= pairedFetishMultiplier;
                currentTopRemoveChance = 0;
            } else if (pairedFetishesOnly) {
                currentTopChance = 0;
            } else {
                currentTopChance -= matchedFetishDecrement;
                currentTopRemoveChance += matchedFetishRemoveIncrement;
            }
        } else if (pairedFetishesOnly && wantsToShare) {
            currentTopChance = 0;
            currentTopRemoveChance = 0;
        }
        // if player has positive top fetish desire, adjust potency level to fully add fetish, not just desire
        if (Main.game.getPlayer().getFetishDesire(currentTopFetish) == FetishDesire.THREE_LIKE || Main.game.getPlayer().getFetishDesire(currentTopFetish) == FetishDesire.FOUR_LOVE) {
            currentTopPotency = TFPotency.BOOST;
        } else if (Main.game.getPlayer().getFetishDesire(currentTopFetish) == FetishDesire.TWO_NEUTRAL) {
            int rand = Util.random.nextInt(100);
            // if the player is neutral, but the NPC has paired fetish,small chance to fully add rather than just boost desire
            if (wantsToShare && this.hasFetish(currentBottomFetish) && rand < 30) {
                currentTopPotency = TFPotency.BOOST;
            }
        } else {
            // if they are already less than neutral, don't remove any more
            currentTopRemoveChance = 0;
        }
        // prevent extraneous effects if player has top fetish, plus alter remove potency to drop fetish, not just desire
        if (Main.game.getPlayer().hasFetish(currentTopFetish)) {
            currentTopChance = 0;
            currentTopRemovePotency = TFPotency.DRAIN;
        }
        // some setting and status combos can result in negative values, so let's zero those out
        if (currentTopChance < 0) {
            currentTopChance = 0;
        }
        if (currentTopRemoveChance < 0) {
            currentTopRemoveChance = 0;
        }
        if (currentTopChance > 0) {
            possibleEffects.put(new ItemEffect(itemType.getEnchantmentEffect(), TFModifier.NONE, currentTopModifier, currentTopPotency, 1), currentTopChance);
        }
        if (currentTopRemoveChance > 0) {
            possibleEffects.put(new ItemEffect(itemType.getEnchantmentEffect(), TFModifier.NONE, currentTopModifier, currentTopRemovePotency, 1), currentTopRemoveChance);
        }
    }
    // randomly select from possible effects
    int total = 0;
    for (Entry<ItemEffect, Integer> entry : possibleEffects.entrySet()) {
        total += entry.getValue();
    }
    // no valid options found
    if (total == 0) {
        return null;
    }
    int count = Util.random.nextInt(total) + 1;
    total = 0;
    for (Entry<ItemEffect, Integer> entry : possibleEffects.entrySet()) {
        if (total < count && total + entry.getValue() >= count) {
            selectedEffect = entry.getKey();
            break;
        }
        total += entry.getValue();
    }
    // no fetish to add, so we have nothing to return
    if (selectedEffect == null) {
        return null;
    }
    // Let's figure out what flavor text string to pair with our selected effect
    // I'm VERY uncertain that you'll like any of this flavor text at all, so please feel free to modify as you see fit
    // Some of it I do like, but mostly I just wanted to be sure there were unique placeholder values for every current fetish
    // Also, simply removing/commenting out an entry will cause the fetish in question to go to the default, if you'd like
    // to get rid of one of my placeholders without having to write your own replacement
    Map<TFModifier, String> fetishAddFlavorText = new HashMap<>(), fetishRemoveFlavorText = new HashMap<>();
    String defaultFetishAddFlavorText = "Why not expand your horizons a bit, eh?";
    String defaultFetishRemoveFlavorText = "Maybe you should cool down a bit about the more extreme stuff, eh?.";
    // body part
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_ANAL_GIVING, "You're going to love doing it in the ass after this.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_ANAL_GIVING, "Maybe you should cool down a bit about fucking people in the ass.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_ANAL_RECEIVING, "You're going to love taking it in the ass after this.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_ANAL_RECEIVING, "Maybe you should cool down a bit about getting fucked in the ass.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_BREASTS_OTHERS, "Don't you just love a nice pair of tits?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_BREASTS_OTHERS, "You're way too into breasts.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_BREASTS_SELF, "Wouldn't you love to put your breasts to good use?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_BREASTS_SELF, "You're way too into your breasts.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_ORAL_GIVING, "That beautiful mouth of yours is about to get a lot more use");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_ORAL_GIVING, "You don't really need to suck every cock you come across, do you?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_ORAL_RECEIVING, "Don't you just love getting head?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_ORAL_RECEIVING, "Not everyone enjoys getting fucked in the face, you know.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_VAGINAL_GIVING, "Nothing quite compares to fucking a wet pussy, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_VAGINAL_GIVING, "There's more to sex than just pussy. Expand your horizons a bit.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_VAGINAL_RECEIVING, "When it comes down to it, you just want to get fucked in the pussy, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_VAGINAL_RECEIVING, "There's more to sex than just pussy. Expand your horizons a bit.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_LEG_LOVER, "A nice pair of stems makes all the difference, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_LEG_LOVER, "Maybe focus a bit more on what's above the waist -- or at least around the hips?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_STRUTTER, "You've got legs that don't quit -- you really ought to use them");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_STRUTTER, "Maybe focus a bit more on what's above your waist -- or at least around the hips?");
    // Behavioral
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_DOMINANT, "Don't you think you deserve to be the one in charge?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_DOMINANT, "You're really not as intimidating as you think.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_SUBMISSIVE, "Give in to it, and admit that you want nothing more than to be my plaything.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_SUBMISSIVE, "Sometimes it's nice to get what you want too, right?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_CUM_STUD, "Nothing really compares to filling a juicy hole hole with your seed, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_CUM_STUD, "Sex should be about the journey, not the destination.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_CUM_ADDICT, "I know a dirty little cum dumpster when I see one.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_CUM_ADDICT, "You can be more than a receptacle for other people's jizz if you want, you know.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_DEFLOWERING, "There's something special about being the first to the party, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_DEFLOWERING, "Trust me, it's a lot more fun when they have a bit of experience.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_PURE_VIRGIN, "You should treasure whatever innocence you have left while it lasts.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_PURE_VIRGIN, "Fuck virginity. You'll have a lot more fun doing it than having it.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_IMPREGNATION, "A stud like you really ought to be breeding as many bitches as you can");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_IMPREGNATION, "Get over yourself. No one wants to have your baby.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_PREGNANCY, "Being fucked is nice, but being bred is better, isn't it?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_PREGNANCY, "Being knocked up is a bit of a drag, don't you think?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_SEEDER, "You ought to be making babies, and lots of them.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_SEEDER, "You don't really need more mouths to feed, do you?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_BROODMOTHER, "You ought to be making babies, and lots of them.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_BROODMOTHER, "You don't really need more mouths to feed, do you?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_SADIST, "Isn't it nice when you hurt them and they beg for more?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_SADIST, "Not everyone likes being your punching bag.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_MASOCHIST, "It's time for you to embrace the pain. You'll thank me later.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_MASOCHIST, "You should really take better care of yourself.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_NON_CON_DOM, "When they beg for you to stop it just drives you crazy, doesn't it?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_NON_CON_DOM, "Most of the time, no really means no.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_NON_CON_SUB, "Every time you say 'no' I can see 'fuck me harder' in your eyes.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_NON_CON_SUB, "You really can get off without being forced to, believe it or not.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_DENIAL, "The only thing better than coming is telling your partner they can't, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_DENIAL, "If they're willing to fuck you, at least let them come once in a while.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_DENIAL_SELF, "Where's the fun in coming right away? Wouldn't you rather savor the experience?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_DENIAL_SELF, "What's the point if you aren't getting off?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_VOYEURIST, "Sometimes it's just fun to watch, isn't it?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_VOYEURIST, "Privacy is a thing worth respecting.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_EXHIBITIONIST, "You've got it -- you should flaunt it");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_EXHIBITIONIST, "Not everyone wants to see what you've got to offer.");
    // Behavioral unpaired
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_BIMBO, "I think it's time you embraced your inner braindead slut.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_BIMBO, "Maybe have just a little self respect?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_CROSS_DRESSER, "You should wear what you want, and enjoy it.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_CROSS_DRESSER, "It wouldn't kill you to be a bit more reserved.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_MASTURBATION, "Nobody knows your body quite like you do, right?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_MASTURBATION, "Maybe you should think getting your hands on someone else's junk once in a while?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_INCEST, "You know it wouldn't be a taboo if it wasn't at least a little bit fun.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_INCEST, "You what? Gross.");
    // Behavioral transformative
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_TRANSFORMATION_GIVING, "You strike me as someone who should be an agent of change.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_TRANSFORMATION_GIVING, "You should really just let people be who they are.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_TRANSFORMATION_RECEIVING, "Don't you just love becoming something new?");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_TRANSFORMATION_RECEIVING, "I think you're good just as you are.");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_KINK_GIVING, "You're into so many interesting things -- you really should share them with others.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_KINK_GIVING, "Just let people enjoy what they enjoy, okay?");
    fetishAddFlavorText.put(TFModifier.TF_MOD_FETISH_KINK_RECEIVING, "You strike me as someone who would really enjoy trying new things.");
    fetishRemoveFlavorText.put(TFModifier.TF_MOD_FETISH_KINK_RECEIVING, "I think you're already excitable enough as it is.");
    if (selectedEffect.getPotency() == TFPotency.MINOR_BOOST || selectedEffect.getPotency() == TFPotency.BOOST) {
        // default for adding a fetish, just in case a fetish is somehow selected without a string defined in the lookup
        selectedEffectString = defaultFetishAddFlavorText;
        if (fetishAddFlavorText.get(selectedEffect.getSecondaryModifier()) != null) {
            selectedEffectString = fetishAddFlavorText.get(selectedEffect.getSecondaryModifier());
        }
    } else {
        // default for removing a fetish, just in case a fetish is somehow selected without a string defined in the lookup
        selectedEffectString = defaultFetishRemoveFlavorText;
        if (fetishRemoveFlavorText.get(selectedEffect.getSecondaryModifier()) != null) {
            selectedEffectString = fetishRemoveFlavorText.get(selectedEffect.getSecondaryModifier());
        }
    }
    // finally, build and return our fetish potion
    List<ItemEffect> effects = new ArrayList<>();
    effects.add(selectedEffect);
    return new Value<>(selectedEffectString, EnchantingUtils.craftItem(AbstractItemType.generateItem(itemType), effects));
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AbstractItemType(com.lilithsthrone.game.inventory.item.AbstractItemType) TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) TFPotency(com.lilithsthrone.game.inventory.enchanting.TFPotency) ListValue(com.lilithsthrone.utils.Util.ListValue) Value(com.lilithsthrone.utils.Util.Value) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect)

Example 4 with TFPotency

use of com.lilithsthrone.game.inventory.enchanting.TFPotency in project liliths-throne-public by Innoxia.

the class EnchantmentDialogue method inventoryView.

private static String inventoryView() {
    inventorySB.setLength(0);
    ItemEffect effect = new ItemEffect(ingredient.getEnchantmentEffect(), primaryMod, secondaryMod, potency, limit);
    // Primary mods:
    inventorySB.append("<div class='container-half-width' style='padding-bottom:0;'>");
    for (TFModifier tfMod : ingredient.getEnchantmentEffect().getPrimaryModifiers()) {
        inventorySB.append("<div class='modifier-icon " + tfMod.getRarity().getName() + "' style='width:11.5%;'>" + "<div class='modifier-icon-content'>" + tfMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_PRIMARY_" + tfMod.hashCode() + "'></div>" + "</div>");
    }
    for (int i = 32; i > ingredient.getEnchantmentEffect().getPrimaryModifiers().size(); i--) {
        inventorySB.append("<div class='modifier-icon empty' style='width:11.5%;'></div>");
    }
    inventorySB.append("<div class='container-full-width'>" + "<div class='container-half-width' style='width:78%; margin:0 1%; text-align:center; line-height:100vh;'>" + "<h5 style='margin:0; padding:0;'>Primary Modifier</h5>" + "</div>" + "<div class='container-half-width' style='width:18%; margin:0 1%;'>");
    if (primaryMod != null) {
        inventorySB.append("<div class='modifier-icon " + primaryMod.getRarity().getName() + "' style='width:100%; margin:0;'>" + "<div class='modifier-icon-content'>" + primaryMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_PRIMARY_ENCHANTING'></div>" + "</div>");
    } else {
        inventorySB.append("<div class='modifier-icon empty' style='width:30%; margin:0 1%;'>" + "<div class='overlay' style='cursor:default;' id='MOD_PRIMARY_ENCHANTING'></div>" + "</div>");
    }
    inventorySB.append("</div></div>");
    inventorySB.append("</div>");
    // Secondary mods:
    inventorySB.append("<div class='container-half-width' style='padding-bottom:0;'>");
    for (TFModifier tfMod : ingredient.getEnchantmentEffect().getSecondaryModifiers(primaryMod)) {
        inventorySB.append("<div class='modifier-icon " + tfMod.getRarity().getName() + "' style='width:11.5%;'>" + "<div class='modifier-icon-content'>" + tfMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_SECONDARY_" + tfMod.hashCode() + "'></div>" + "</div>");
    }
    for (int i = 32; i > ingredient.getEnchantmentEffect().getSecondaryModifiers(primaryMod).size(); i--) {
        inventorySB.append("<div class='modifier-icon empty' style='width:11.5%;'></div>");
    }
    inventorySB.append("<div class='container-full-width'>" + "<div class='container-half-width' style='width:18%; margin:0 1%;'>");
    if (secondaryMod != null) {
        inventorySB.append("<div class='modifier-icon " + secondaryMod.getRarity().getName() + "' style='width:100%; margin:0;'>" + "<div class='modifier-icon-content'>" + secondaryMod.getSVGString() + "</div>" + "<div class='overlay' id='MOD_SECONDARY_ENCHANTING'></div>" + "</div>");
    } else {
        inventorySB.append("<div class='modifier-icon empty' style='width:30%; margin:0 1%;'>" + "<div class='overlay' style='cursor:default;' id='MOD_SECONDARY_ENCHANTING'></div>" + "</div>");
    }
    inventorySB.append("</div>" + "<div class='container-half-width' style='width:78%; margin:0 1%; text-align:center; line-height:100vh;'>" + "<h5 style='margin:0; padding:0;'>Secondary Modifier</h5>" + "</div>" + "</div>");
    inventorySB.append("</div>");
    // Potency:
    inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>");
    for (TFPotency potency : TFPotency.values()) {
        inventorySB.append("<div class='normal-button" + (ingredient.getEnchantmentEffect().getPotencyModifiers(primaryMod, secondaryMod).contains(potency) ? "" : " disabled") + (EnchantmentDialogue.potency == potency ? " selected" : "") + "' id='POTENCY_" + potency + "'" + " style='" + (EnchantmentDialogue.potency == potency ? "color:" + potency.getColour().toWebHexString() + ";" : "") + " margin:0 1%; width:14%;'>" + potency.getName() + "</div>");
    }
    inventorySB.append("</div>");
    // Limits:
    int ingredientLimit = ingredient.getEnchantmentEffect().getLimits(primaryMod, secondaryMod);
    if (ingredientLimit != 0) {
        inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == 0 ? " disabled" : "") + "' id='LIMIT_MINIMUM' style='width:100%;'>Limit Min.</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == 0 ? " disabled" : "") + "' id='LIMIT_DECREASE_LARGE' style='width:100%;'>Limit--</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == 0 ? " disabled" : "") + "' id='LIMIT_DECREASE' style='width:100%;'>Limit-</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == ingredientLimit ? " disabled" : "") + "' id='LIMIT_INCREASE' style='width:100%;'>Limit+</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == ingredientLimit ? " disabled" : "") + "' id='LIMIT_INCREASE_LARGE' style='width:100%;'>Limit++</div>" + "</div>" + "<div style='float:left; width:14.6%; margin:0 1%; padding:0;'>" + "<div class='normal-button" + (limit == ingredientLimit ? " disabled" : "") + "' id='LIMIT_MAXIMUM' style='width:100%;'>Limit Max.</div>" + "</div>" + "</div>");
    }
    // Effect:
    inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>");
    inventorySB.append("<div class='container-half-width' style='width:28%; margin:0 1%;'>" + "<b style='color:" + ingredient.getRelatedEssence().getColour().toWebHexString() + ";'>Effect to be added:</b>" + "</div>");
    inventorySB.append("<div class='container-half-width' style='width:48%; margin:0 1%;'>");
    int i = 0;
    if (effect.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer()) != null) {
        if (i > 0) {
            inventorySB.append("</br>");
        }
        for (String s : effect.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer())) {
            inventorySB.append("<b>" + Util.capitaliseSentence(s) + "</b>");
        }
        i++;
    } else {
        inventorySB.append("<b>-</b>");
    }
    inventorySB.append("</div>");
    inventorySB.append("<div class='container-half-width' style='width:18%; margin:0 1%;'>");
    if (effects.size() >= ingredient.getEnchantmentLimit() || ingredient.getEnchantmentEffect().getEffectsDescription(primaryMod, secondaryMod, potency, limit, Main.game.getPlayer(), Main.game.getPlayer()) == null || ingredient.getEnchantmentEffect().getEffectsDescription(primaryMod, secondaryMod, potency, limit, Main.game.getPlayer(), Main.game.getPlayer()).isEmpty()) {
        inventorySB.append("<div class='normal-button disabled' style='width:100%; margin:auto 0;'>" + "<b>Add</b> | " + UtilText.formatAsEssencesUncoloured(effect.getCost(), "b", false) + "<div class='overlay no-pointer' id='ENCHANT_ADD_BUTTON_DISABLED'></div>" + "</div>");
    } else {
        inventorySB.append("<div class='normal-button' style='width:100%; margin:auto 0;'>" + "<b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Add</b> | " + UtilText.formatAsEssences(effect.getCost(), "b", false) + "<div class='overlay' id='ENCHANT_ADD_BUTTON'></div>" + "</div>");
    }
    inventorySB.append("</div>");
    inventorySB.append("</div>");
    // Item crafting:
    inventorySB.append("<div class='container-full-width' style='text-align:center; padding:8px 0; margin-top:0;'>");
    int count = 1;
    if (ingredient instanceof AbstractItem) {
        count = Main.game.getPlayer().getItemCount((AbstractItem) ingredient);
    } else if (ingredient instanceof AbstractClothing) {
        count = Main.game.getPlayer().getClothingCount((AbstractClothing) ingredient);
    } else if (ingredient instanceof AbstractWeapon) {
        count = Main.game.getPlayer().getWeaponCount((AbstractWeapon) ingredient);
    }
    inventorySB.append("<div class='container-half-width' style='width:18%; margin:0 1%; text-align:center;'>");
    inventorySB.append("<b>Input</b>" + "<div class='enchanting-ingredient " + ingredient.getRarity().getName() + "'>" + "<div class='enchanting-ingredient-content'>" + ingredient.getSVGString() + "</div>" + "<div class='overlay' id='INGREDIENT_ENCHANTING'></div>" + "<div class='enchanting-ingredient-count'><b>x" + count + "</b></div>" + "</div>");
    inventorySB.append("</div>");
    // Effects:
    inventorySB.append("<div class='container-half-width' style='width:58%; margin:0 1%;'>");
    inventorySB.append("<b>Effects (</b>" + (effects.size() >= ingredient.getEnchantmentLimit() ? "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>" : "<b>") + "" + effects.size() + "/" + ingredient.getEnchantmentLimit() + "</b><b>)</b></br>" + "<b>" + Util.capitaliseSentence(EnchantingUtils.getPotionName(ingredient, effects)) + "</b> | Cost: " + UtilText.formatAsEssences(EnchantingUtils.getCost(ingredient, effects), "b", false));
    if (effects.isEmpty()) {
        inventorySB.append("</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>No effects added</span>");
    } else {
        i = 0;
        for (ItemEffect ie : effects) {
            for (String s : ie.getEffectsDescription(Main.game.getPlayer(), Main.game.getPlayer())) {
                inventorySB.append("<div class='container-full-width' style='background:" + RenderingEngine.getEntryBackgroundColour(i % 2 == 0) + "; width:98%; margin:0 1%; padding:2px;'>" + Util.capitaliseSentence(s) + (ingredient.getEffects().size() > i && ingredient.getEffects().get(i).equals(ie) ? "<div class='normal-button' style='width:64px; height:22px; line-height:22px; font-size:16px; margin:0; padding:0 0 0 4px; float:right; text-align:left;'>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>X</b> " + UtilText.formatAsEssences(ie.getCost(), "b", false) + "<div class='overlay' id='DELETE_EFFECT_" + i + "'></div></div>" : "<div class='normal-button' id='DELETE_EFFECT_" + i + "'" + " style='width:22px; height:22px; line-height:22px; font-size:16px; margin:0; padding:0; float:right; color:" + Colour.GENERIC_BAD.toWebHexString() + ";'><b>X</b></div>") + "</div>");
                i++;
            }
        }
    }
    inventorySB.append("</div>");
    inventorySB.append("<div class='container-half-width' style='width:18%; margin:0 1%; text-align:center;'>");
    inventorySB.append("<b>Output</b>" + "<div class='enchanting-ingredient " + ingredient.getEnchantmentItemType(effects).getRarity().getName() + "'>" + "<div class='enchanting-ingredient-content'>" + EnchantingUtils.getSVGString(ingredient, effects) + "</div>" + "<div class='overlay' id='OUTPUT_ENCHANTING'></div>" + "</div>");
    inventorySB.append("</div>");
    inventorySB.append("</div>");
    return inventorySB.toString();
}
Also used : TFModifier(com.lilithsthrone.game.inventory.enchanting.TFModifier) TFPotency(com.lilithsthrone.game.inventory.enchanting.TFPotency) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) AbstractWeapon(com.lilithsthrone.game.inventory.weapon.AbstractWeapon)

Aggregations

TFModifier (com.lilithsthrone.game.inventory.enchanting.TFModifier)4 TFPotency (com.lilithsthrone.game.inventory.enchanting.TFPotency)4 ItemEffect (com.lilithsthrone.game.inventory.item.ItemEffect)4 Attribute (com.lilithsthrone.game.character.attributes.Attribute)2 Colour (com.lilithsthrone.utils.Colour)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 TooltipResponseMoveEventListener (com.lilithsthrone.controller.eventListeners.TooltipResponseMoveEventListener)1 ButtonCharactersEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonCharactersEventListener)1 ButtonCopyDialogueEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonCopyDialogueEventListener)1 ButtonInventoryEventHandler (com.lilithsthrone.controller.eventListeners.buttons.ButtonInventoryEventHandler)1 ButtonJournalEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonJournalEventListener)1 ButtonMainMenuEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonMainMenuEventListener)1 ButtonMoveEastEventListener (com.lilithsthrone.controller.eventListeners.buttons.ButtonMoveEastEventListener)1