Search in sources :

Example 1 with StatusEffect

use of com.lilithsthrone.game.character.effects.StatusEffect in project liliths-throne-public by Innoxia.

the class MainController method setUpButtons.

private void setUpButtons() {
    // HOTKEYS:
    actionKeyPressed = new EventHandler<KeyEvent>() {

        private Map.Entry<KeyboardAction, KeyCodeWithModifiers> findExistingBinding(Map<KeyboardAction, KeyCodeWithModifiers> bindings, KeyEvent lookingFor) {
            return bindings.entrySet().stream().filter(entry -> entry.getValue() != null).filter(entry -> entry.getValue().matches(lookingFor)).findFirst().orElse(null);
        }

        private void printAlreadyExistingBinding(String primarySecondary, String actionName, String eventCodeName) {
            Main.game.getTextStartStringBuilder().append("<p style='text-align:center;'>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>The key '" + eventCodeName + "' is already the " + primarySecondary + " bind for the action '" + actionName + "'!</b>" + "</p>");
            Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
        }

        private boolean handleExistingBindings(Map<KeyboardAction, KeyCodeWithModifiers> bindings, KeyEvent lookingFor, String primarySecondary) {
            Map.Entry<KeyboardAction, KeyCodeWithModifiers> existingBinding = findExistingBinding(bindings, lookingFor);
            boolean hasExistingBinding = existingBinding != null;
            if (hasExistingBinding) {
                actionToBind = null;
                printAlreadyExistingBinding(primarySecondary, existingBinding.getKey().getName(), existingBinding.getValue().getFullName());
            }
            return hasExistingBinding;
        }

        public void handle(KeyEvent event) {
            if (allowInput) {
                // Hotkey bindings:
                if (Main.game.getCurrentDialogueNode() == OptionsDialogue.KEYBINDS) {
                    if (actionToBind != null) {
                        KeyCode eventCode = event.getCode();
                        if (eventCode == KeyCode.SHIFT || eventCode == KeyCode.CONTROL) {
                            // these are explicitly blocked to allow SHIFT + key and CTRL + key
                            return;
                        }
                        if (handleExistingBindings(Main.getProperties().hotkeyMapPrimary, event, "primary") || handleExistingBindings(Main.getProperties().hotkeyMapSecondary, event, "secondary")) {
                            // such a binding already exists
                            return;
                        }
                        KeyCodeWithModifiers newBinding = new KeyCodeWithModifiers(eventCode, event.isControlDown(), event.isShiftDown());
                        if (primaryBinding)
                            Main.getProperties().hotkeyMapPrimary.put(actionToBind, newBinding);
                        else
                            Main.getProperties().hotkeyMapSecondary.put(actionToBind, newBinding);
                        actionToBind = null;
                        Main.saveProperties();
                        Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
                        return;
                    }
                } else {
                    actionToBind = null;
                }
                if (!buttonsPressed.contains(event.getCode())) {
                    buttonsPressed.add(event.getCode());
                    System.arraycopy(lastKeys, 0, lastKeys, 1, 4);
                    lastKeys[0] = event.getCode();
                    checkLastKeys();
                    if (event.getCode() == KeyCode.END) {
                        Main.game.getPlayer().setMana(1);
                    // Cell[][] grid = new Cell[5][5];
                    // for(int i=0; i<grid.length;i++) {
                    // for(int j=0; j<grid[0].length;j++) {
                    // grid[i][j] = new Cell(WorldType.SEWERS, new Vector2i(i, j));
                    // grid[i][j].setPlace(new GenericPlace(PlaceType.SUBMISSION_IMP_PALACE));
                    // }
                    // }
                    // 
                    // Generation.printMaze(WorldType.SEWERS, Generation.generateTestMap(WorldType.SEWERS, 0, 0, grid, 2));
                    // Main.game.getPlayer().incrementCummedInArea(OrificeType.VAGINA, 10000);
                    // Main.game.getPlayer().addPsychoactiveFluidIngested(FluidType.CUM_HUMAN);
                    // Main.game.getPlayer().addPsychoactiveFluidIngested(FluidType.MILK_HUMAN);
                    // Main.game.getPlayer().addPsychoactiveFluidIngested(FluidType.GIRL_CUM_HUMAN);
                    // Main.game.getPlayer().addStatusEffect(StatusEffect.PSYCHOACTIVE, 60*6);
                    // Main.game.getPlayer().addAddiction(new Addiction(FluidType.MILK_HUMAN, Main.game.getMinutesPassed()));
                    // Main.game.getPlayer().incrementAlcoholLevel(0.2f);
                    // for(Fetish f : Fetish.values()) {
                    // Main.game.getPlayer().incrementFetishExperience(f, (int) (Math.random()*20));
                    // }
                    // Main.game.getPlayer().incrementCummedInArea(OrificeType.MOUTH, 2500);
                    // for(NPC npc : Main.game.getNPCMap().values()) {
                    // System.out.println(npc.getId());
                    // }
                    // for(int i=0; i<=1000; i++) {
                    // System.out.println(Util.intToString(i));
                    // }
                    // Main.game.getPlayer().addDirtySlot(InventorySlot.GROIN);
                    // Main.game.getPlayer().addDirtySlot(InventorySlot.MOUTH);
                    // Main.game.getPlayer().addDirtySlot(InventorySlot.LEG);
                    // System.out.println(Main.isVersionOlderThan("0.1.84", Main.VERSION_NUMBER));
                    // for(int i=0;i<10;i++) {
                    // System.out.println(Name.getRandomTriplet(Race.DEMON));
                    // }
                    // Game.exportGame();
                    // System.out.println(Main.game.getNumberOfWitches());
                    // SlaveryUtil.calculateEvent(Main.game.getMinutesPassed(), Main.game.getPlayer().getSlavesOwned().get(0));
                    // for(String npc : Main.game.getNPCMap().keySet()) {
                    // System.out.println(npc);
                    // }
                    // 
                    // System.out.println(ItemType.BOOK_CAT_MORPH.getId());
                    // System.out.println(Main.game.getPlayer().getNextClothingToRemoveForCoverableAreaAccess(CoverableArea.VAGINA).getKey().getName());
                    // webViewMain = new WebView();
                    // webViewAttributes = new WebView();
                    // webViewInventory = new WebView();
                    // webViewMap = new WebView();
                    // webViewMapTitle = new WebView();
                    // webViewButtons = new WebView();
                    // webViewResponse = new WebView();
                    // 
                    // setUpWebViews();
                    // File dir = new File("data/clothing");
                    // dir.mkdir();
                    // for (ClothingType ct : ClothingType.values()) {
                    // 
                    // dir = new File("data/clothing/"+ct);
                    // dir.mkdir();
                    // 
                    // for(Colour c : ct.getAvailableColours()) {
                    // try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("data/clothing/"+ct+"/"+ct.getName().replaceAll(" ", "_")+"_"+c+".svg"), "utf-8"))) {
                    // writer.write(ct.getSVGImage(c));
                    // } catch (IOException e) {
                    // e.printStackTrace();
                    // }
                    // }
                    // }
                    // dir = new File("data/items");
                    // dir.mkdir();
                    // for (ItemType ct : ItemType.values()) {
                    // 
                    // 
                    // try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("data/items/"+ct.getName(false).replaceAll(" ", "_")+".svg"), "utf-8"))) {
                    // writer.write(ct.getSVGString());
                    // } catch (IOException e) {
                    // e.printStackTrace();
                    // }
                    // }
                    // dir = new File("data/weapons");
                    // dir.mkdir();
                    // for (WeaponType ct : WeaponType.values()) {
                    // 
                    // for(DamageType dt : ct.getAvailableDamageTypes())
                    // try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("data/weapons/"+ct.getName().replaceAll(" ", "_")+"("+dt+").svg"), "utf-8"))) {
                    // writer.write(ct.getSVGStringMap().get(dt));
                    // } catch (IOException e) {
                    // e.printStackTrace();
                    // }
                    // }
                    // dir = new File("data/statusEffects");
                    // dir.mkdir();
                    // for (StatusEffect se : StatusEffect.values()) {
                    // if(!se.isSexEffect()) {
                    // try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("data/statusEffects/"+se+"("+se.getName(Main.game.getPlayer()).replaceAll(" ", "_")+").svg"), "utf-8"))) {
                    // writer.write(se.getSVGString(Main.game.getPlayer()));
                    // } catch (IOException e) {
                    // e.printStackTrace();
                    // }
                    // }
                    // }
                    // dir = new File("data/fetishes");
                    // dir.mkdir();
                    // for (Fetish se : Fetish.values()) {
                    // 
                    // try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("data/fetishes/"+se+"("+se.getName(Main.game.getPlayer()).replaceAll(" ", "_")+").svg"), "utf-8"))) {
                    // writer.write(se.getSVGString());
                    // } catch (IOException e) {
                    // e.printStackTrace();
                    // }
                    // }
                    // Main.getProperties().savePropertiesAsXML();
                    // System.out.println("Free memory (bytes) -gc: " + Runtime.getRuntime().freeMemory());
                    // System.gc();
                    // System.out.println("Free memory (bytes) +gc: " + Runtime.getRuntime().freeMemory());
                    // System.out.println("Body sizes:");
                    // for(BodySize bs : BodySize.values()) {
                    // System.out.println(bs.getName(false));
                    // }
                    // System.out.println("");
                    // System.out.println("Muscle:");
                    // for(Muscle m : Muscle.values()) {
                    // System.out.println(m.getName(false));
                    // }
                    // System.out.println("");
                    // System.out.println("");
                    // System.out.println("Body shapes:");
                    // for(BodyShape bs : BodyShape.values()) {
                    // System.out.println(bs.getRelatedBodySize().getName(false)+" + "+bs.getRelatedMuscle().getName(false)+" = "+bs.getName());
                    // }
                    }
                    // Escape Menu:
                    if (keyEventMatchesBindings(KeyboardAction.MENU, event))
                        openOptions();
                    // Movement:
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_NORTH, event)) {
                        if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
                            moveNorth();
                        } else {
                            Main.game.responseNavigationUp();
                        }
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_WEST, event)) {
                        if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
                            moveWest();
                        } else {
                            Main.game.responseNavigationLeft();
                        }
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_SOUTH, event)) {
                        if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
                            moveSouth();
                        } else {
                            Main.game.responseNavigationDown();
                        }
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_EAST, event)) {
                        if (!Main.game.getCurrentDialogueNode().isTravelDisabled()) {
                            moveEast();
                        } else {
                            Main.game.responseNavigationRight();
                        }
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_NORTH, event)) {
                        Main.game.responseNavigationUp();
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_WEST, event)) {
                        Main.game.responseNavigationLeft();
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_SOUTH, event)) {
                        Main.game.responseNavigationDown();
                    }
                    if (keyEventMatchesBindings(KeyboardAction.MOVE_RESPONSE_CURSOR_EAST, event)) {
                        Main.game.responseNavigationRight();
                    }
                    // Game stuff:
                    if (keyEventMatchesBindings(KeyboardAction.QUICKSAVE, event)) {
                        Main.quickSaveGame();
                    }
                    if (keyEventMatchesBindings(KeyboardAction.QUICKLOAD, event)) {
                        Main.quickLoadGame();
                    }
                    boolean allowInput = true;
                    boolean enterConsumed = false;
                    // Name selections:
                    if (Main.game.getCurrentDialogueNode() == CharacterCreation.CHOOSE_NAME || Main.game.getCurrentDialogueNode() == CityHall.CITY_HALL_NAME_CHANGE_FORM) {
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('nameInput') === document.activeElement")) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                Main.game.setContent(1);
                            }
                        }
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('surnameInput') === document.activeElement")) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                Main.game.setContent(1);
                            }
                        }
                    }
                    if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.ROOM_UPGRADES) {
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('nameInput') === document.activeElement")) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                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() {
                                                Main.game.getPlayerCell().getPlace().setName(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent());
                                            }
                                        });
                                    } else {
                                        Main.game.setContent(new Response("Rename Room", "", Main.game.getCurrentDialogueNode()));
                                    }
                                }
                            }
                        }
                    }
                    if (Main.game.getCurrentDialogueNode() == CityHall.CITY_HALL_NAME_CHANGE_FORM) {
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('nameInput') === document.activeElement")) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                Main.game.setContent(1);
                            }
                        }
                    }
                    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.SAVE_LOAD) {
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('new_save_name') === document.activeElement")) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                Main.mainController.getWebEngine().executeScript("document.getElementById('hiddenPField').innerHTML=document.getElementById('new_save_name').value;");
                                if (Main.isSaveGameAvailable()) {
                                    Main.saveGame(Main.mainController.getWebEngine().getDocument().getElementById("hiddenPField").getTextContent(), false);
                                }
                                Main.game.setContent(new Response("Save", "", Main.game.getCurrentDialogueNode()));
                            }
                        }
                    }
                    if (Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_INSPECT || Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_JOBS || Main.game.getCurrentDialogueNode() == SlaveryManagementDialogue.SLAVE_MANAGEMENT_PERMISSIONS) {
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('slaveToPlayerNameInput') === document.activeElement")) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                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());
                                            }
                                        });
                                    } else {
                                        Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()));
                                    }
                                }
                            }
                        }
                        if (((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('slaveNameInput') === document.activeElement"))) {
                            allowInput = false;
                            if (event.getCode() == KeyCode.ENTER) {
                                enterConsumed = true;
                                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) {
                                        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().setName(new NameTriplet(Main.mainController.getWebEngine().getDocument().getElementById("hiddenFieldName").getTextContent()));
                                            }
                                        });
                                    } else {
                                        Main.game.setContent(new Response("Rename", "", Main.game.getCurrentDialogueNode()));
                                    }
                                }
                            }
                        }
                    }
                    if (((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('offspringPetNameInput') === document.activeElement"))) {
                        allowInput = false;
                    }
                    if (Main.game.getCurrentDialogueNode() == OptionsDialogue.OPTIONS_PRONOUNS) {
                        for (GenderPronoun gp : GenderPronoun.values()) {
                            if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('feminine_" + gp + "') === document.activeElement") || (boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('masculine_" + gp + "') === document.activeElement")) {
                                allowInput = false;
                                if (event.getCode() == KeyCode.ENTER) {
                                    enterConsumed = true;
                                    Main.game.setContent(1);
                                }
                            }
                        }
                        for (GenderNames genderName : GenderNames.values()) {
                            if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('GENDER_NAME_MASCULINE_" + genderName + "') === document.activeElement") || (boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('GENDER_NAME_ANDROGYNOUS_" + genderName + "') === document.activeElement") || (boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('GENDER_NAME_FEMININE_" + genderName + "') === document.activeElement")) {
                                allowInput = false;
                                if (event.getCode() == KeyCode.ENTER) {
                                    enterConsumed = true;
                                    Main.game.setContent(1);
                                }
                            }
                        }
                    }
                    if (Main.game.getCurrentDialogueNode() == DebugDialogue.PARSER) {
                        if ((boolean) Main.mainController.getWebEngine().executeScript("document.getElementById('parseInput') === document.activeElement"))
                            allowInput = false;
                    }
                    if (allowInput) {
                        if (keyEventMatchesBindings(KeyboardAction.INVENTORY, event))
                            openInventory();
                        if (keyEventMatchesBindings(KeyboardAction.JOURNAL, event))
                            openPhone();
                        if (keyEventMatchesBindings(KeyboardAction.CHARACTERS, event))
                            openCharactersPresent(null);
                        if (keyEventMatchesBindings(KeyboardAction.ZOOM, event))
                            zoomMap();
                        if (keyEventMatchesBindings(KeyboardAction.SCROLL_UP, event))
                            Main.mainController.getWebEngine().executeScript("document.getElementById('main-content').scrollTop -= 50");
                        if (keyEventMatchesBindings(KeyboardAction.SCROLL_DOWN, event))
                            Main.mainController.getWebEngine().executeScript("document.getElementById('main-content').scrollTop += 50");
                        // Responses:
                        KeyboardAction[] keyboardActionsForResponses = { KeyboardAction.RESPOND_0, KeyboardAction.RESPOND_1, KeyboardAction.RESPOND_2, KeyboardAction.RESPOND_3, KeyboardAction.RESPOND_4, KeyboardAction.RESPOND_5, KeyboardAction.RESPOND_6, KeyboardAction.RESPOND_7, KeyboardAction.RESPOND_8, KeyboardAction.RESPOND_9, KeyboardAction.RESPOND_10, KeyboardAction.RESPOND_11, KeyboardAction.RESPOND_12, KeyboardAction.RESPOND_13, KeyboardAction.RESPOND_14 };
                        for (int i = 0; i < keyboardActionsForResponses.length; i++) {
                            if (keyEventMatchesBindings(keyboardActionsForResponses[i], event)) {
                                processResponse(i);
                            }
                        }
                        if (keyEventMatchesBindings(KeyboardAction.MENU_SELECT, event)) {
                            if (event.getCode() == KeyCode.ENTER) {
                                if (!enterConsumed) {
                                    Main.game.setContent(Main.game.getResponsePointer());
                                }
                            } else {
                                Main.game.setContent(Main.game.getResponsePointer());
                            }
                        }
                    }
                    // Next/Previous response tab:
                    if (keyEventMatchesBindings(KeyboardAction.RESPOND_NEXT_TAB, event)) {
                        if (Main.game.incrementResponseTab()) {
                            Main.game.updateResponses();
                        }
                    }
                    if (keyEventMatchesBindings(KeyboardAction.RESPOND_PREVIOUS_TAB, event)) {
                        if (Main.game.decrementResponseTab()) {
                            Main.game.updateResponses();
                        }
                    }
                    // Next/Previous response page:
                    if (keyEventMatchesBindings(KeyboardAction.RESPOND_NEXT_PAGE, event)) {
                        if (Main.game.isHasNextResponsePage()) {
                            Main.game.setResponsePage(Main.game.getResponsePage() + 1);
                            Main.game.updateResponses();
                        }
                    }
                    if (keyEventMatchesBindings(KeyboardAction.RESPOND_PREVIOUS_PAGE, event)) {
                        if (Main.game.getResponsePage() != 0) {
                            Main.game.setResponsePage(Main.game.getResponsePage() - 1);
                            Main.game.updateResponses();
                        }
                    }
                }
            }
        }
    };
    actionKeyReleased = new EventHandler<KeyEvent>() {

        public void handle(KeyEvent event) {
            if (buttonsPressed.contains(event.getCode())) {
                buttonsPressed.remove(event.getCode());
            }
        }
    };
    Main.primaryStage.addEventFilter(KeyEvent.KEY_PRESSED, actionKeyPressed);
    Main.primaryStage.addEventFilter(KeyEvent.KEY_RELEASED, actionKeyReleased);
}
Also used : 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) KeyboardAction(com.lilithsthrone.game.settings.KeyboardAction) NameTriplet(com.lilithsthrone.game.character.NameTriplet) KeyEvent(javafx.scene.input.KeyEvent) Response(com.lilithsthrone.game.dialogue.responses.Response) Entry(java.util.Map.Entry) PerkEntry(com.lilithsthrone.game.character.effects.PerkEntry) KeyCodeWithModifiers(com.lilithsthrone.game.settings.KeyCodeWithModifiers) GenderPronoun(com.lilithsthrone.game.character.gender.GenderPronoun) KeyCode(javafx.scene.input.KeyCode) GenderNames(com.lilithsthrone.game.character.gender.GenderNames)

Example 2 with StatusEffect

use of com.lilithsthrone.game.character.effects.StatusEffect in project liliths-throne-public by Innoxia.

the class MainController method manageRightListeners.

private void manageRightListeners() {
    documentRight = (Document) webEngineRight.executeScript("document");
    EventListenerDataMap.put(documentRight, new ArrayList<>());
    List<InventorySlot> concealedSlots = new ArrayList<>();
    if (RenderingEngine.getCharacterToRender() != null) {
        concealedSlots = RenderingEngine.getCharacterToRender().getInventorySlotsConcealed();
    }
    // Inventory:
    String id;
    for (InventorySlot invSlot : InventorySlot.values()) {
        id = invSlot.toString() + "Slot";
        if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
            if (((EventTarget) documentRight.getElementById(id)) != null) {
                if (concealedSlots.contains(invSlot)) {
                    addEventListener(documentRight, id, "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, id, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation(Util.capitaliseSentence(invSlot.getName()) + " - [style.boldBad(Concealed!)]", "");
                    addEventListener(documentRight, id, "mouseenter", el2, false);
                } else {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingEquipped(RenderingEngine.getCharacterToRender(), invSlot);
                    addEventListener(documentRight, id, "click", el, false);
                    addEventListener(documentRight, id, "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, id, "mouseleave", hideTooltipListener, false);
                    InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, RenderingEngine.getCharacterToRender());
                    addEventListener(documentRight, id, "mouseenter", el2, false);
                }
            }
        } else {
            if (((EventTarget) documentRight.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponEquipped(RenderingEngine.getCharacterToRender(), invSlot);
                addEventListener(documentRight, id, "click", el, false);
                addEventListener(documentRight, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentRight, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, RenderingEngine.getCharacterToRender());
                addEventListener(documentRight, id, "mouseenter", el2, false);
            }
        }
    }
    for (NPC character : Main.game.getCharactersPresent()) {
        id = "CHARACTERS_PRESENT_" + character.getId();
        if (((EventTarget) documentRight.getElementById(id)) != null) {
            ((EventTarget) documentRight.getElementById(id)).addEventListener("click", e -> {
                openCharactersPresent(Main.game.getNPCById(character.getId()));
            }, false);
        }
    }
    if (Main.game.getPlayer() != null) {
        // Weapons on floor:
        for (Entry<AbstractWeapon, Integer> entry : Main.game.getPlayerCell().getInventory().getMapOfDuplicateWeapons().entrySet()) {
            id = "WEAPON_FLOOR_" + entry.getKey().hashCode();
            if (((EventTarget) documentRight.getElementById(id)) != null) {
                if (!Main.game.getCurrentDialogueNode().isInventoryDisabled()) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponInventory(entry.getKey(), null);
                    addEventListener(documentRight, id, "click", el, false);
                }
                addEventListener(documentRight, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentRight, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setWeapon(entry.getKey(), null);
                addEventListener(documentRight, 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) documentRight.getElementById(id)) != null) {
                if (!Main.game.getCurrentDialogueNode().isInventoryDisabled()) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingInventory(entry.getKey(), null);
                    addEventListener(documentRight, id, "click", el, false);
                }
                addEventListener(documentRight, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentRight, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setClothing(entry.getKey(), null, null);
                addEventListener(documentRight, 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) documentRight.getElementById(id)) != null) {
                if (!Main.game.getCurrentDialogueNode().isInventoryDisabled()) {
                    InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setItemInventory(entry.getKey(), null);
                    addEventListener(documentRight, id, "click", el, false);
                }
                addEventListener(documentRight, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentRight, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setItem(entry.getKey(), null, null);
                addEventListener(documentRight, id, "mouseenter", el2, false);
            }
        }
    }
    if (RenderingEngine.getCharacterToRender() != null) {
        Attribute[] attributes = { Attribute.HEALTH_MAXIMUM, Attribute.MANA_MAXIMUM, Attribute.EXPERIENCE, Attribute.MAJOR_PHYSIQUE, Attribute.MAJOR_ARCANE, Attribute.MAJOR_CORRUPTION, Attribute.AROUSAL, Attribute.LUST };
        List<GameCharacter> charactersBeingRendered = new ArrayList<>();
        if (Main.game.isInSex()) {
            charactersBeingRendered.addAll(Sex.getDominantParticipants().keySet());
            charactersBeingRendered.addAll(Sex.getSubmissiveParticipants().keySet());
        } else if (Main.game.isInCombat()) {
            charactersBeingRendered.addAll(Combat.getEnemies());
        } else {
            charactersBeingRendered.add(RenderingEngine.getCharacterToRender());
        }
        charactersBeingRendered.remove(Main.game.getPlayer());
        for (GameCharacter character : charactersBeingRendered) {
            String idModifier = character.getId() + "_";
            for (Attribute a : attributes) {
                if (((EventTarget) documentRight.getElementById("NPC_" + idModifier + a.getName())) != null) {
                    if (a == Attribute.EXPERIENCE) {
                        ((EventTarget) documentRight.getElementById("NPC_" + idModifier + a.getName())).addEventListener("click", e -> {
                            openCharactersPresent(character);
                        }, false);
                    }
                    addEventListener(documentRight, "NPC_" + idModifier + a.getName(), "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, "NPC_" + idModifier + a.getName(), "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setAttribute(a, character);
                    addEventListener(documentRight, "NPC_" + idModifier + a.getName(), "mouseenter", el, false);
                }
            }
            // Extra attribute info:
            if (((EventTarget) documentRight.getElementById("NPC_" + idModifier + "ATTRIBUTES")) != null) {
                // ((EventTarget) documentRight.getElementById("NPC_"+idModifier+"ATTRIBUTES")).addEventListener("click", e -> {
                // openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
                // }, false);
                addEventListener(documentRight, "NPC_" + idModifier + "ATTRIBUTES", "mousemove", moveTooltipListener, false);
                addEventListener(documentRight, "NPC_" + idModifier + "ATTRIBUTES", "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setExtraAttributes(character);
                addEventListener(documentRight, "NPC_" + idModifier + "ATTRIBUTES", "mouseenter", el, false);
            }
            // For status effect slots:
            for (StatusEffect se : character.getStatusEffects()) {
                if (((EventTarget) documentRight.getElementById("SE_NPC_" + idModifier + se)) != null) {
                    addEventListener(documentRight, "SE_NPC_" + idModifier + se, "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, "SE_NPC_" + idModifier + se, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setStatusEffect(se, character);
                    addEventListener(documentRight, "SE_NPC_" + idModifier + se, "mouseenter", el, false);
                }
            }
            // For perk slots:
            for (Perk p : character.getMajorPerks()) {
                if (((EventTarget) documentRight.getElementById("PERK_NPC_" + idModifier + p)) != null) {
                    addEventListener(documentRight, "PERK_NPC_" + idModifier + p, "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, "PERK_NPC_" + idModifier + p, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setPerk(p, character);
                    addEventListener(documentRight, "PERK_NPC_" + idModifier + p, "mouseenter", el, false);
                }
            }
            for (Fetish f : character.getFetishes()) {
                if (((EventTarget) documentRight.getElementById("FETISH_NPC_" + idModifier + f)) != null) {
                    addEventListener(documentRight, "FETISH_NPC_" + idModifier + f, "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, "FETISH_NPC_" + idModifier + f, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setFetish(f, character);
                    addEventListener(documentRight, "FETISH_NPC_" + idModifier + f, "mouseenter", el, false);
                }
            }
            for (SpecialAttack sa : character.getSpecialAttacks()) {
                if (((EventTarget) documentRight.getElementById("SA_NPC_" + idModifier + sa)) != null) {
                    addEventListener(documentRight, "SA_NPC_" + idModifier + sa, "mousemove", moveTooltipListener, false);
                    addEventListener(documentRight, "SA_NPC_" + idModifier + sa, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setSpecialAttack(sa, character);
                    addEventListener(documentRight, "SA_NPC_" + idModifier + sa, "mouseenter", el, false);
                }
            }
            for (Spell s : character.getAllSpells()) {
                if (((EventTarget) documentAttributes.getElementById("SPELL_" + idModifier + s)) != null) {
                    addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mousemove", moveTooltipListener, false);
                    addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mouseleave", hideTooltipListener, false);
                    TooltipInformationEventListener el = new TooltipInformationEventListener().setSpell(s, character.getLevel(), character);
                    addEventListener(documentAttributes, "SPELL_" + idModifier + s, "mouseenter", el, false);
                }
            }
        }
    }
}
Also used : TooltipInformationEventListener(com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener) TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) NPC(com.lilithsthrone.game.character.npc.NPC) Attribute(com.lilithsthrone.game.character.attributes.Attribute) ArrayList(java.util.ArrayList) Spell(com.lilithsthrone.game.combat.Spell) InventorySelectedItemEventListener(com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) InventoryTooltipEventListener(com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener) GameCharacter(com.lilithsthrone.game.character.GameCharacter) SpecialAttack(com.lilithsthrone.game.combat.SpecialAttack) AbstractWeapon(com.lilithsthrone.game.inventory.weapon.AbstractWeapon) EventTarget(org.w3c.dom.events.EventTarget) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem) Perk(com.lilithsthrone.game.character.effects.Perk) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect)

Example 3 with StatusEffect

use of com.lilithsthrone.game.character.effects.StatusEffect in project liliths-throne-public by Innoxia.

the class TooltipInformationEventListener method handleEvent.

@Override
public void handleEvent(Event event) {
    Main.mainController.setTooltipSize(360, 180);
    Main.mainController.setTooltipContent("");
    if (statusEffect != null) {
        int yIncrease = (statusEffect.getModifiersAsStringList(owner).size() > 4 ? statusEffect.getModifiersAsStringList(owner).size() - 4 : 0) + (owner.hasStatusEffect(statusEffect) ? (owner.getStatusEffectDuration(statusEffect) == -1 ? 0 : 2) : 0);
        Main.mainController.setTooltipSize(360, 284 + (yIncrease * LINE_HEIGHT));
        // Title:
        tooltipSB.setLength(0);
        tooltipSB.append("<body>" + "<div class='title'>" + Util.capitaliseSentence(statusEffect.getName(owner)) + "</div>");
        // Attribute modifiers:
        tooltipSB.append("<div class='subTitle-picture'>");
        if (!statusEffect.getModifiersAsStringList(owner).isEmpty()) {
            int i = 0;
            for (String s : statusEffect.getModifiersAsStringList(owner)) {
                tooltipSB.append((i != 0 ? "</br>" : "") + s);
                i++;
            }
        } else {
            tooltipSB.append("<span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>No bonuses</span>");
        }
        tooltipSB.append("</div>");
        // Picture:
        tooltipSB.append("<div class='picture'>" + statusEffect.getSVGString(owner) + "</div>" + "<div class='description'>" + statusEffect.getDescription(owner) + "</div>");
        if (owner.hasStatusEffect(statusEffect))
            if (owner.getStatusEffectDuration(statusEffect) != -1) {
                if (statusEffect.isCombatEffect()) {
                    tooltipSB.append("<div class='subTitle'><b>Turns remaining: " + owner.getStatusEffectDuration(statusEffect) + "</b></div>");
                } else {
                    int timerHeight = (int) ((owner.getStatusEffectDuration(statusEffect) / (60 * 6f)) * 100);
                    Colour timerColour = Colour.STATUS_EFFECT_TIME_HIGH;
                    if (timerHeight > 100) {
                        timerHeight = 100;
                        timerColour = Colour.STATUS_EFFECT_TIME_OVERFLOW;
                    } else if (timerHeight < 15) {
                        timerColour = Colour.STATUS_EFFECT_TIME_LOW;
                    } else if (timerHeight < 50) {
                        timerColour = Colour.STATUS_EFFECT_TIME_MEDIUM;
                    }
                    tooltipSB.append("<div class='subTitle'><b>Time remaining: " + "<b style='color:" + timerColour.toWebHexString() + ";'>" + (owner.getStatusEffectDuration(statusEffect) / 60) + ":" + String.format("%02d", (owner.getStatusEffectDuration(statusEffect) % 60)) + "</b>" + "</div>");
                // STATUS_EFFECT_TIME_OVERFLOW
                }
            }
        tooltipSB.append("</body>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (perk != null) {
        // Perks:
        int yIncrease = (perk.getModifiersAsStringList().size() > 4 ? perk.getModifiersAsStringList().size() - 4 : 0);
        Main.mainController.setTooltipSize(360, 324 + (yIncrease * LINE_HEIGHT));
        // Title:
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>" + Util.capitaliseSentence(perk.getName(owner)) + "</div>");
        if (perk.isMajor()) {
            tooltipSB.append("<div class='subTitle' style='color:" + Colour.TRAIT.toWebHexString() + ";'>Trait</div>");
        } else {
            tooltipSB.append("<div class='subTitle' style='color:" + Colour.PERK.toWebHexString() + ";'>Perk</div>");
        }
        // Attribute modifiers:
        tooltipSB.append("<div class='subTitle-picture'>");
        if (!perk.getModifiersAsStringList().isEmpty()) {
            int i = 0;
            for (String s : perk.getModifiersAsStringList()) {
                tooltipSB.append((i != 0 ? "</br>" : "") + s);
                i++;
            }
        } else
            tooltipSB.append("<b style='color:" + Colour.PERK.toWebHexString() + ";'>Perk</b>" + "</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>None</span>");
        tooltipSB.append("</div>");
        // Picture:
        tooltipSB.append("<div class='picture'>" + perk.getSVGString() + "</div>");
        // Description:
        tooltipSB.append("<div class='description'>" + perk.getDescription(owner) + "</div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (levelUpPerk != null) {
        // Level Up Perk (same as Perk, but with requirements at top):
        int yIncrease = (levelUpPerk.getModifiersAsStringList().size() > 4 ? levelUpPerk.getModifiersAsStringList().size() - 4 : 0);
        Main.mainController.setTooltipSize(360, 352 + (yIncrease * LINE_HEIGHT));
        // Title:
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>" + Util.capitaliseSentence(levelUpPerk.getName(owner)) + "</div>");
        if (levelUpPerk.isMajor()) {
            tooltipSB.append("<div class='subTitle' style='color:" + Colour.TRAIT.toWebHexString() + ";'>Trait</div>");
        } else {
            tooltipSB.append("<div class='subTitle' style='color:" + Colour.PERK.toWebHexString() + ";'>Perk</div>");
        }
        // Attribute modifiers:
        tooltipSB.append("<div class='subTitle-picture'>");
        if (!levelUpPerk.getModifiersAsStringList().isEmpty()) {
            int i = 0;
            for (String s : levelUpPerk.getModifiersAsStringList()) {
                tooltipSB.append((i != 0 ? "</br>" : "") + s);
                i++;
            }
        } else {
            tooltipSB.append("<b style='color:" + Colour.PERK.toWebHexString() + ";'>Perk</b>" + "</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>None</span>");
        }
        tooltipSB.append("</div>");
        // Picture:
        tooltipSB.append("<div class='picture'>" + levelUpPerk.getSVGString() + "</div>");
        // Description:
        tooltipSB.append("<div class='description'>" + levelUpPerk.getDescription(Main.game.getPlayer()) + "</div>");
        if (levelUpPerk.isMajor()) {
            if (levelUpPerk.getPerkCategory() == PerkCategory.JOB) {
                tooltipSB.append("<div class='subTitle' style='color:" + Colour.TRAIT.toWebHexString() + ";'>Job-related trait cannot be removed.</div>");
            } else {
                if (!owner.hasPerkInTree(perkRow, levelUpPerk)) {
                    if (!PerkManager.MANAGER.isPerkAvailable(perkRow, levelUpPerk)) {
                        tooltipSB.append("<div class='subTitle' style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Purchasing requires a connecting perk or trait.</div>");
                    } else {
                        tooltipSB.append("<div class='subTitle' style='color:" + Colour.GENERIC_MINOR_GOOD.toWebHexString() + ";'>Click to purchase trait.</div>");
                    }
                } else {
                    if (owner.getTraits().contains(levelUpPerk)) {
                        tooltipSB.append("<div class='subTitle' style='color:" + Colour.GENERIC_MINOR_BAD.toWebHexString() + ";'>Click to unequip trait.</div>");
                    } else {
                        if (owner.getTraits().size() == GameCharacter.MAX_TRAITS) {
                            tooltipSB.append("<div class='subTitle' style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Maximum traits activated.</div>");
                        } else {
                            tooltipSB.append("<div class='subTitle' style='color:" + Colour.TRAIT.toWebHexString() + ";'>Click to equip trait.</div>");
                        }
                    }
                }
            }
        } else {
            if (!owner.hasPerkInTree(perkRow, levelUpPerk)) {
                if (!PerkManager.MANAGER.isPerkAvailable(perkRow, levelUpPerk)) {
                    tooltipSB.append("<div class='subTitle' style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Purchasing requires a connecting perk or trait.</div>");
                } else {
                    tooltipSB.append("<div class='subTitle' style='color:" + Colour.GENERIC_MINOR_GOOD.toWebHexString() + ";'>Click to purchase perk.</div>");
                }
            } else {
                tooltipSB.append("<div class='subTitle' style='color:" + Colour.PERK.toWebHexString() + ";'>You already own this perk!</div>");
            }
        }
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (desire != null) {
        // Desire:
        Main.mainController.setTooltipSize(360, 264);
        // Title:
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>Set Desire: <b style='color:" + desire.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(desire.getName()) + "</b></div>");
        // Attribute modifiers:
        tooltipSB.append("<div class='subTitle-picture'>");
        int i = 0;
        for (String s : desire.getModifiersAsStringList()) {
            tooltipSB.append((i != 0 ? "</br>" : "") + s);
            i++;
        }
        tooltipSB.append("</div>");
        // Picture:
        tooltipSB.append("<div class='picture'>" + desire.getSVGImage() + "</div>");
        // Description:
        if (owner.hasFetish(fetish) && desire != FetishDesire.FOUR_LOVE) {
            tooltipSB.append("<div class='description' style='height:53px'>Your desire is [style.boldBad(locked)] to <b style='color:" + FetishDesire.FOUR_LOVE.getColour().toWebHexString() + ";'>" + FetishDesire.FOUR_LOVE.getName() + "</b>," + " due to owning the related fetish (" + fetish.getName(owner) + ").</div>");
            tooltipSB.append("<div class='subTitle' style='text-align:center;'>Cost: [style.boldDisabled(N/A)]</div>");
        } else {
            tooltipSB.append("<div class='description' style='height:53px'>" + fetish.getFetishDesireDescription(owner, desire) + "</div>");
            if (owner.getBaseFetishDesire(fetish) == desire) {
                tooltipSB.append("<div class='subTitle' style='text-align:center;'>Cost: [style.boldDisabled(N/A)]</div>");
            } else {
                tooltipSB.append("<div class='subTitle' style='text-align:center;'>Cost: [style.boldArcane(" + (FetishDesire.getCostToChange() == 0 ? "Free" : "" + FetishDesire.getCostToChange() + " Arcane Essence" + (FetishDesire.getCostToChange() > 1 ? "s" : "")) + ")]</div>");
            }
        }
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (fetish != null) {
        if (fetishExperience) {
            Main.mainController.setTooltipSize(420, 156);
            tooltipSB.setLength(0);
            tooltipSB.append("<div class='title'>" + Util.capitaliseSentence(fetish.getName(owner)) + " fetish</div>");
            FetishLevel level = FetishLevel.getFetishLevelFromValue(owner.getFetishExperience(fetish));
            tooltipSB.append("<div class='subTitle'>Level " + level.getNumeral() + ": <span style='color:" + level.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(level.getName()) + "</span>" + " <span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>|</span> " + owner.getFetishExperience(fetish) + " / " + level.getMaximumExperience() + " xp" + "</div>");
            tooltipSB.append("<div class='description' style='height:53px'>You earn fetish experience by performing related actions in sex. Each level increases the fetish's bonuses (max level is 5).</div>");
            Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
        } else {
            int yIncrease = (fetish.getModifiersAsStringList(owner).size() > 4 ? fetish.getModifiersAsStringList(owner).size() - 4 : 0) + fetish.getFetishesForAutomaticUnlock().size();
            Main.mainController.setTooltipSize(360, (fetish.getFetishesForAutomaticUnlock().isEmpty() ? 350 : 360) + (yIncrease * LINE_HEIGHT));
            // Title:
            tooltipSB.setLength(0);
            tooltipSB.append("<div class='title'>" + Util.capitaliseSentence(fetish.getName(owner)) + " fetish</div>");
            FetishLevel level = FetishLevel.getFetishLevelFromValue(owner.getFetishExperience(fetish));
            tooltipSB.append("<div class='subTitle'>Level " + level.getNumeral() + ": <span style='color:" + level.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(level.getName()) + "</span>" + " <span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>|</span> " + owner.getFetishExperience(fetish) + " / " + level.getMaximumExperience() + " xp" + "</div>");
            // Requirements:
            if (!fetish.getFetishesForAutomaticUnlock().isEmpty()) {
                tooltipSB.append("<div class='subTitle'>Requirements");
                for (Fetish f : fetish.getFetishesForAutomaticUnlock()) tooltipSB.append("</br>[style.boldArcane(" + Util.capitaliseSentence(f.getName(Main.game.getPlayer())) + ")]");
                tooltipSB.append("</div>");
            }
            // Attribute modifiers:
            tooltipSB.append("<div class='subTitle-picture'>");
            if (!fetish.getModifiersAsStringList(owner).isEmpty()) {
                int i = 0;
                for (String s : fetish.getModifiersAsStringList(owner)) {
                    tooltipSB.append((i != 0 ? "</br>" : "") + s);
                    i++;
                }
            } else {
                tooltipSB.append("<b style='color:" + Colour.FETISH.toWebHexString() + ";'>Fetish</b>" + "</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>None</span>");
            }
            tooltipSB.append("</div>");
            // Picture:
            tooltipSB.append("<div class='picture'>" + fetish.getSVGString() + "</div>");
            // Description:
            tooltipSB.append("<div class='description'>" + fetish.getDescription(owner) + "</div>");
            if (fetish.getFetishesForAutomaticUnlock().isEmpty()) {
                if (owner.hasBaseFetish(fetish)) {
                    tooltipSB.append("<div class='subTitle' style='text-align:center;'>Cost: [style.boldDisabled(N/A)]</div>");
                } else {
                    tooltipSB.append("<div class='subTitle' style='text-align:center;'>Cost: [style.boldArcane(" + fetish.getCost() + " Arcane Essences)]</div>");
                }
            }
            Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
        }
    } else if (specialAttack != null) {
        // Special attacks:
        int yIncrease = (specialAttack.getStatusEffects().size() > 2 ? specialAttack.getStatusEffects().size() - 2 : 0);
        Main.mainController.setTooltipSize(360, 324 + (yIncrease * LINE_HEIGHT));
        // Title:
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>" + Util.capitaliseSentence(specialAttack.getName()) + "</div>");
        // Attribute modifiers:
        tooltipSB.append("<div class='subTitle-picture'>" + "<b style='color:" + Colour.SPECIAL_ATTACK.toWebHexString() + ";'>Special Attack</b></br>" + "<b>" + Attack.getMinimumSpecialAttackDamage(owner, null, specialAttack.getDamageType(), specialAttack.getDamage(), specialAttack.getDamageVariance()) + "-" + Attack.getMaximumSpecialAttackDamage(owner, null, specialAttack.getDamageType(), specialAttack.getDamage(), specialAttack.getDamageVariance()) + "</b>" + " <b style='color:" + specialAttack.getDamageType().getMultiplierAttribute().getColour().toWebHexString() + ";'>" + specialAttack.getDamageType().getName() + "</b> damage");
        tooltipSB.append("</br><b style='color:" + Colour.SPECIAL_ATTACK.toWebHexString() + ";'>Applies</b>");
        if (!specialAttack.getStatusEffects().isEmpty()) {
            for (Entry<StatusEffect, Integer> e : specialAttack.getStatusEffects().entrySet()) tooltipSB.append("</br><b style='color:" + e.getKey().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(e.getKey().getName(owner)) + "</b> for " + e.getValue() + " turn" + (e.getValue() > 1 ? "s" : ""));
        } else
            tooltipSB.append("</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>No effects</span>");
        tooltipSB.append("</div>");
        // Picture:
        tooltipSB.append("<div class='picture'>" + specialAttack.getSVGString() + "</div>");
        // Description & turns remaining:
        tooltipSB.append("<div class='description'>" + specialAttack.getDescription(owner) + "</div>" + "<div class='subTitle-half'>" + "<b>Cooldown: " + (specialAttack.getCooldown()) + "</b>" + "</div>" + "<div class='subTitle-half'>" + (Main.game.isInCombat() ? (Combat.getCooldown(owner, specialAttack) == 0 ? "[style.boldGood(Off Cooldown)]" : "[style.boldCooldown(On Cooldown:)] " + Combat.getCooldown(owner, specialAttack)) : "[style.boldGood(Off Cooldown)]") + "</div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (spell != null) {
        // Spells:
        int yIncrease = (spell.getStatusEffects().size() > 2 ? spell.getStatusEffects().size() - 2 : 0);
        Main.mainController.setTooltipSize(360, 324 + (yIncrease * LINE_HEIGHT));
        // Title:
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>" + Util.capitaliseSentence(spell.getName()) + "</div>");
        // Attribute modifiers:
        tooltipSB.append("<div class='subTitle-picture'>" + "<b style='color:" + Colour.GENERIC_ARCANE.toWebHexString() + ";'>Spell</b></br>");
        if (spell.isBeneficial()) {
            tooltipSB.append("<b style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Beneficial</b> <b style='color:" + spell.getDamageType().getMultiplierAttribute().getColour().toWebHexString() + ";'>" + spell.getDamageType().getName() + "</b> spell");
        } else {
            tooltipSB.append("<b>" + Attack.getMinimumSpellDamage(owner, null, spell.getDamageType(), spell.getDamage(), spell.getDamageVariance()) + "-" + Attack.getMaximumSpellDamage(owner, null, spell.getDamageType(), spell.getDamage(), spell.getDamageVariance()) + "</b>" + " <b style='color:" + spell.getDamageType().getMultiplierAttribute().getColour().toWebHexString() + ";'>" + spell.getDamageType().getName() + "</b> damage");
        }
        tooltipSB.append("</br><b style='color:" + Colour.GENERIC_ARCANE.toWebHexString() + ";'>Applies</b>");
        if (!spell.getStatusEffects().isEmpty()) {
            for (Entry<StatusEffect, Integer> e : spell.getStatusEffects().entrySet()) {
                tooltipSB.append("</br><b style='color:" + e.getKey().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(e.getKey().getName(owner)) + "</b> for " + e.getValue() + " turn" + (e.getValue() > 1 ? "s" : ""));
            }
        } else {
            tooltipSB.append("</br><span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>No effects</span>");
        }
        tooltipSB.append("</div>");
        // Picture:
        tooltipSB.append("<div class='picture'>" + spell.getSVGString() + "</div>");
        // Description & turns remaining:
        tooltipSB.append("<div class='description'>" + spell.getDescription(owner, spellLevel) + "</div>" + "<div class='subTitle'>" + "<b style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>Costs</b> <b>" + (spell.getModifiedCost(owner)) + "</b>" + " <b style='color:" + Colour.ATTRIBUTE_MANA.toWebHexString() + ";'>aura</b>" + "</div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (attribute != null) {
        if (attribute == Attribute.MAJOR_PHYSIQUE || attribute == Attribute.MAJOR_ARCANE || attribute == Attribute.MAJOR_CORRUPTION || attribute == Attribute.AROUSAL || attribute == Attribute.LUST) {
            StatusEffect currentAttributeStatusEffect = null;
            int minimumLevelValue = 0, maximumLevelValue = 0;
            if (attribute == Attribute.MAJOR_PHYSIQUE) {
                currentAttributeStatusEffect = PhysiqueLevel.getPhysiqueLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_PHYSIQUE)).getRelatedStatusEffect();
                minimumLevelValue = PhysiqueLevel.getPhysiqueLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_PHYSIQUE)).getMinimumValue();
                maximumLevelValue = PhysiqueLevel.getPhysiqueLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_PHYSIQUE)).getMaximumValue();
            } else if (attribute == Attribute.MAJOR_ARCANE) {
                currentAttributeStatusEffect = IntelligenceLevel.getIntelligenceLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_ARCANE)).getRelatedStatusEffect();
                minimumLevelValue = IntelligenceLevel.getIntelligenceLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_ARCANE)).getMinimumValue();
                maximumLevelValue = IntelligenceLevel.getIntelligenceLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_ARCANE)).getMaximumValue();
            } else if (attribute == Attribute.MAJOR_CORRUPTION) {
                currentAttributeStatusEffect = CorruptionLevel.getCorruptionLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_CORRUPTION)).getRelatedStatusEffect();
                minimumLevelValue = CorruptionLevel.getCorruptionLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_CORRUPTION)).getMinimumValue();
                maximumLevelValue = CorruptionLevel.getCorruptionLevelFromValue(owner.getAttributeValue(Attribute.MAJOR_CORRUPTION)).getMaximumValue();
            } else if (attribute == Attribute.AROUSAL) {
                currentAttributeStatusEffect = ArousalLevel.getArousalLevelFromValue(owner.getAttributeValue(Attribute.AROUSAL)).getRelatedStatusEffect();
                minimumLevelValue = ArousalLevel.getArousalLevelFromValue(owner.getAttributeValue(Attribute.AROUSAL)).getMinimumValue();
                maximumLevelValue = ArousalLevel.getArousalLevelFromValue(owner.getAttributeValue(Attribute.AROUSAL)).getMaximumValue();
            } else if (attribute == Attribute.LUST) {
                currentAttributeStatusEffect = LustLevel.getLustLevelFromValue(owner.getAttributeValue(Attribute.LUST)).getRelatedStatusEffect();
                minimumLevelValue = LustLevel.getLustLevelFromValue(owner.getAttributeValue(Attribute.LUST)).getMinimumValue();
                maximumLevelValue = LustLevel.getLustLevelFromValue(owner.getAttributeValue(Attribute.LUST)).getMaximumValue();
            }
            int yIncrease = (currentAttributeStatusEffect.getModifiersAsStringList(owner).size() > 4 ? currentAttributeStatusEffect.getModifiersAsStringList(owner).size() - 4 : 0) + (owner.hasStatusEffect(currentAttributeStatusEffect) ? (owner.getStatusEffectDuration(currentAttributeStatusEffect) == -1 ? 0 : 2) : 0);
            Main.mainController.setTooltipSize(360, 460 + (yIncrease * LINE_HEIGHT));
            tooltipSB.setLength(0);
            tooltipSB.append("<div class='title' style='color:" + attribute.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(attribute.getName()) + "</div>" + "<div class='subTitle-third'>" + "<b style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>Core</b></br>" + (owner.getBaseAttributeValue(attribute) > 0 ? "<span style='color: " + Colour.GENERIC_EXCELLENT.getShades()[1] + ";'>" : "<span>") + String.format("%.2f", owner.getBaseAttributeValue(attribute)) + "</span>" + "</div>" + "<div class='subTitle-third'>" + "<b style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>Bonus</b></br>" + ((owner.getBonusAttributeValue(attribute)) > 0 ? "<span style='color: " + Colour.GENERIC_GOOD.getShades()[1] + ";'>" : ((owner.getBonusAttributeValue(attribute)) == 0 ? "<span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>" : "<span style='color: " + Colour.GENERIC_BAD.getShades()[1] + ";'>")) + String.format("%.2f", owner.getBonusAttributeValue(attribute)) + "</span>" + "</div>" + "<div class='subTitle-third'>" + "<b style='color:" + attribute.getColour().toWebHexString() + ";'>Total</b></br>" + String.format("%.2f", owner.getAttributeValue(attribute)) + "</span>" + "</div>");
            tooltipSB.append("<div class='description-half'>" + attribute.getDescription(owner) + "</div>");
            // Related status effect:
            tooltipSB.append("<div class='title'>" + "<span style='color:" + currentAttributeStatusEffect.getColour().toWebHexString() + ";'>" + currentAttributeStatusEffect.getName(owner) + "</span> (" + minimumLevelValue + "-" + maximumLevelValue + ")" + "</div>");
            // Attribute modifiers:
            tooltipSB.append("<div class='subTitle-picture'>");
            if (!currentAttributeStatusEffect.getModifiersAsStringList(owner).isEmpty()) {
                int i = 0;
                for (String s : currentAttributeStatusEffect.getModifiersAsStringList(owner)) {
                    if (i != 0) {
                        tooltipSB.append("</br>");
                    }
                    tooltipSB.append(s);
                    i++;
                }
            } else {
                tooltipSB.append("<span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>No bonuses</span>");
            }
            tooltipSB.append("</div>");
            // Picture:
            tooltipSB.append("<div class='picture'>" + currentAttributeStatusEffect.getSVGString(owner) + "</div>");
            // Description & turns remaining:
            tooltipSB.append("<div class='description'>" + currentAttributeStatusEffect.getDescription(owner) + "</div>");
            Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
        } else if (attribute == Attribute.EXPERIENCE) {
            if (owner.isRaceConcealed()) {
                Main.mainController.setTooltipSize(420, 64);
                tooltipSB.setLength(0);
                tooltipSB.append("<div class='title' style='color:" + Colour.RACE_UNKNOWN.toWebHexString() + ";'>" + "Unknown Race!" + "</div>");
            } else {
                Main.mainController.setTooltipSize(420, 508);
                tooltipSB.setLength(0);
                tooltipSB.append("<div class='title' style='color:" + owner.getRace().getColour().toWebHexString() + ";'>" + (owner.getRaceStage().getName() != "" ? "<b style='color:" + owner.getRaceStage().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(owner.getRaceStage().getName()) + "</b> " : "") + "<b style='color:" + owner.getRace().getColour().toWebHexString() + ";'>" + (owner.isFeminine() ? Util.capitaliseSentence(owner.getSubspecies().getSingularFemaleName()) : Util.capitaliseSentence(owner.getSubspecies().getSingularMaleName())) + "</b>" + "</div>");
                // GREATER:
                tooltipSB.append(getBodyPartDiv("Face", owner.getFaceRace(), owner.getFaceType().getBodyCoveringType(owner)));
                tooltipSB.append(getBodyPartDiv("Body", owner.getSkinRace(), owner.getSkinType().getBodyCoveringType(owner)));
                // LESSER:
                tooltipSB.append(getBodyPartDiv("Arms", owner.getArmRace(), owner.getArmType().getBodyCoveringType(owner)));
                tooltipSB.append(getBodyPartDiv("Legs", owner.getLegRace(), owner.getLegType().getBodyCoveringType(owner)));
                // PARTIAL:
                tooltipSB.append(getBodyPartDiv("Hair", owner.getHairRace(), owner.getHairType().getBodyCoveringType(owner)));
                tooltipSB.append(getBodyPartDiv("Eyes", owner.getEyeRace(), owner.getEyeType().getBodyCoveringType(owner)));
                tooltipSB.append(getBodyPartDiv("Ears", owner.getEarRace(), owner.getEarType().getBodyCoveringType(owner)));
                tooltipSB.append(getBodyPartDiv("Tongue", owner.getTongueRace(), owner.getTongueType().getBodyCoveringType(owner)));
                if (owner.getHornType() != HornType.NONE) {
                    tooltipSB.append(getBodyPartDiv((owner.hasHorns() ? Util.capitaliseSentence(owner.getHornName()) : "Horns"), owner.getHornRace(), owner.getHornType().getBodyCoveringType(owner)));
                } else {
                    tooltipSB.append(getEmptyBodyPartDiv("Horns", "None"));
                }
                if (owner.getAntennaType() != AntennaType.NONE) {
                    tooltipSB.append(getBodyPartDiv("Antennae", owner.getAntennaRace(), owner.getAntennaType().getBodyCoveringType(owner)));
                } else {
                    tooltipSB.append(getEmptyBodyPartDiv("Antennae", "None"));
                }
                if (owner.getWingType() != WingType.NONE) {
                    tooltipSB.append(getBodyPartDiv("Wings", owner.getWingRace(), owner.getWingType().getBodyCoveringType(owner)));
                } else {
                    tooltipSB.append(getEmptyBodyPartDiv("Wings", "None"));
                }
                if (owner.getTailType() != TailType.NONE) {
                    tooltipSB.append(getBodyPartDiv("Tail", owner.getTailRace(), owner.getTailType().getBodyCoveringType(owner)));
                } else {
                    tooltipSB.append(getEmptyBodyPartDiv("Tail", "None"));
                }
                // SEXUAL:
                if (!owner.isPlayer() && !owner.getPlayerKnowsAreas().contains(CoverableArea.VAGINA)) {
                    tooltipSB.append(getEmptyBodyPartDiv("Vagina", "Unknown!"));
                } else {
                    if (owner.getVaginaType() != VaginaType.NONE) {
                        tooltipSB.append(getBodyPartDiv("Vagina", owner.getVaginaRace(), owner.getVaginaType().getBodyCoveringType(owner)));
                    } else {
                        tooltipSB.append(getEmptyBodyPartDiv("Vagina", "None"));
                    }
                }
                if (!owner.isPlayer() && !owner.getPlayerKnowsAreas().contains(CoverableArea.PENIS)) {
                    tooltipSB.append(getEmptyBodyPartDiv("Penis", "Unknown!"));
                } else {
                    if (owner.getPenisType() != PenisType.NONE) {
                        tooltipSB.append(getBodyPartDiv("Penis", owner.getPenisRace(), owner.getPenisType().getBodyCoveringType(owner)));
                    } else {
                        tooltipSB.append(getEmptyBodyPartDiv("Penis", "None"));
                    }
                }
                tooltipSB.append(getBodyPartDiv("Ass", owner.getAssRace(), owner.getAssType().getBodyCoveringType(owner)));
                tooltipSB.append(getBodyPartDiv(owner.hasBreasts() ? "Breasts" : "Chest", owner.getBreastRace(), owner.getBreastType().getBodyCoveringType(owner)));
            }
            Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
        } else {
            Main.mainController.setTooltipSize(360, 234);
            Main.mainController.setTooltipContent(UtilText.parse("<div class='title' style='color:" + attribute.getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(attribute.getName()) + "</div>" + "<div class='subTitle-third'>" + "<b style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>Core</b></br>" + (owner.getBaseAttributeValue(attribute) > 0 ? "<span style='color: " + Colour.GENERIC_EXCELLENT.getShades()[1] + ";'>" : "<span>") + String.format("%.2f", owner.getBaseAttributeValue(attribute)) + "</span>" + "</div>" + "<div class='subTitle-third'>" + "<b style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>Bonus</b></br>" + ((owner.getBonusAttributeValue(attribute)) > 0 ? "<span style='color: " + Colour.GENERIC_GOOD.getShades()[1] + ";'>" : ((owner.getBonusAttributeValue(attribute)) == 0 ? "<span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>" : "<span style='color: " + Colour.GENERIC_BAD.getShades()[1] + ";'>")) + String.format("%.2f", owner.getBonusAttributeValue(attribute)) + "</span>" + "</div>" + "<div class='subTitle-third'>" + "<b style='color:" + attribute.getColour().toWebHexString() + ";'>Total</b></br>" + String.format("%.2f", owner.getAttributeValue(attribute)) + "</span>" + "</div>" + "<div class='description'>" + attribute.getDescription(owner) + "</div>"));
        }
    } else if (extraAttributes) {
        Main.mainController.setTooltipSize(360, 520);
        tooltipSB.setLength(0);
        tooltipSB.append(UtilText.parse(owner, "<div class='title' style='color:" + Femininity.valueOf(owner.getFemininityValue()).getColour().toWebHexString() + ";'>" + (owner.getName().length() == 0 ? "[npc.Race]" : "[npc.Name]") + "</div>" + "<div class='subTitle' style='margin-bottom:4px;'>Level " + owner.getLevel() + " <span style='color:" + Colour.TEXT_GREY.toWebHexString() + ";'>|</span> " + owner.getExperience() + " / " + (10 * owner.getLevel()) + " xp</div>" + extraAttributeBonus(owner, Attribute.CRITICAL_CHANCE) + extraAttributeBonus(owner, Attribute.CRITICAL_DAMAGE) + // Header:
        "<div class='subTitle-third combatValue'>" + "Type" + "</div>" + "<div class='subTitle-third combatValue'>" + "Damage" + "</div>" + "<div class='subTitle-third combatValue'>" + "Resist" + "</div>" + // Values:
        extraAttributeTableRow(owner, "Physical", Attribute.DAMAGE_PHYSICAL, Attribute.RESISTANCE_PHYSICAL) + extraAttributeTableRow(owner, "Fire", Attribute.DAMAGE_FIRE, Attribute.RESISTANCE_FIRE) + extraAttributeTableRow(owner, "Cold", Attribute.DAMAGE_ICE, Attribute.RESISTANCE_ICE) + extraAttributeTableRow(owner, "Poison", Attribute.DAMAGE_POISON, Attribute.RESISTANCE_POISON) + extraAttributeTableRow(owner, "Seduction", Attribute.DAMAGE_LUST, Attribute.RESISTANCE_LUST) + extraAttributeTableRow(owner, "Spell", Attribute.DAMAGE_SPELLS, Attribute.RESISTANCE_SPELLS) + extraAttributeBonus(owner, Attribute.FERTILITY) + extraAttributeBonus(owner, Attribute.VIRILITY) + extraAttributeBonus(owner, Attribute.SPELL_COST_MODIFIER)));
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (weather) {
        Main.mainController.setTooltipSize(360, 100);
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>" + "<b style='color:" + Main.game.getCurrentWeather().getColour().toWebHexString() + ";'>" + Util.capitaliseSentence(Main.game.getCurrentWeather().getName()) + "</b>" + "</div>" + "<div class='title'>" + "<b>" + ((Main.game.getWeatherTimeRemaining() / 60) + 1) + " hour" + (((Main.game.getWeatherTimeRemaining() / 60) + 1) > 1 ? "s" : "") + " remaining" + "</b>" + "</div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (protection) {
        Main.mainController.setTooltipSize(360, 100);
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>Protection</div>" + "<div class='subTitle'>" + (owner.isWearingCondom() ? "<span style='color:" + Colour.GENERIC_GOOD.toWebHexString() + ";'>Wearing Condom</span>" : "<span style='color:" + Colour.GENERIC_BAD.toWebHexString() + ";'>No Condom</span>") + "</div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (tattoo) {
        Main.mainController.setTooltipSize(360, 100);
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='title'>Tattoos</div>" + "<div class='subTitle'>" + "TODO" + "</div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else if (copyInformation) {
        Main.mainController.setTooltipSize(360, 170);
        tooltipSB.setLength(0);
        tooltipSB.append("<div class='subTitle'>" + (Main.game.getCurrentDialogueNode().getLabel() == "" || Main.game.getCurrentDialogueNode().getLabel() == null ? "-" : Main.game.getCurrentDialogueNode().getLabel()) + "</div>" + "<div class='description'>" + "Click to copy the currently displayed dialogue to your clipboard.</br></br>" + "This scene was written by <b style='color:" + Colour.ANDROGYNOUS.toWebHexString() + ";'>" + Main.game.getCurrentDialogueNode().getAuthor() + "</b></div>");
        Main.mainController.setTooltipContent(UtilText.parse(tooltipSB.toString()));
    } else {
        // Standard information:
        if (description == null || description.isEmpty()) {
            Main.mainController.setTooltipSize(360, 64);
            Main.mainController.setTooltipContent(UtilText.parse("<div class='title'>" + title + "</div>"));
        } else {
            Main.mainController.setTooltipSize(360, 175);
            Main.mainController.setTooltipContent(UtilText.parse("<div class='title'>" + title + "</div>" + "<div class='description'>" + description + "</div>"));
        }
    }
    (new Thread(new TooltipUpdateThread())).start();
}
Also used : Fetish(com.lilithsthrone.game.character.fetishes.Fetish) Entry(java.util.Map.Entry) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) FetishLevel(com.lilithsthrone.game.character.fetishes.FetishLevel) TooltipUpdateThread(com.lilithsthrone.controller.TooltipUpdateThread) Colour(com.lilithsthrone.utils.Colour) TooltipUpdateThread(com.lilithsthrone.controller.TooltipUpdateThread)

Example 4 with StatusEffect

use of com.lilithsthrone.game.character.effects.StatusEffect in project liliths-throne-public by Innoxia.

the class GameCharacter method calculateStatusEffects.

// Status effects:
public void calculateStatusEffects(int turnTime) {
    // Count down status effects:
    String s;
    List<StatusEffect> tempListStatusEffects = new ArrayList<>();
    for (StatusEffect se : getStatusEffects()) {
        if (!se.isCombatEffect()) {
            s = se.applyEffect(this, turnTime);
            if (s.length() != 0) {
                statusEffectDescriptions.put(se, s);
            }
        }
        incrementStatusEffectDuration(se, -turnTime);
        if (statusEffects.get(se) < 0 && !se.isConditionsMet(this)) {
            tempListStatusEffects.add(se);
        }
    }
    // Remove all status effects that are no longer applicable:
    for (StatusEffect se : tempListStatusEffects) {
        removeStatusEffect(se);
    }
    if (!Main.game.isInCombat()) {
        clearCombatStatusEffects();
    }
    // Add all status effects that are applicable:
    for (StatusEffect se : StatusEffect.values()) {
        if (se.isConditionsMet(this)) {
            addStatusEffect(se, -1);
        }
    }
    for (AbstractClothing c : this.getClothingCurrentlyEquipped()) {
        for (ItemEffect ie : c.getEffects()) {
            if (this.isPlayer()) {
                String clothingEffectDescription = ie.applyEffect(this, this, turnTime);
                if (!clothingEffectDescription.isEmpty()) {
                    statusEffectDescriptions.putIfAbsent(StatusEffect.CLOTHING_EFFECT, "");
                    statusEffectDescriptions.put(StatusEffect.CLOTHING_EFFECT, statusEffectDescriptions.get(StatusEffect.CLOTHING_EFFECT) + clothingEffectDescription);
                }
            } else {
                ie.applyEffect(this, this, turnTime);
            }
        }
    }
    updateAttributeListeners();
}
Also used : StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) ArrayList(java.util.ArrayList) AbstractClothing(com.lilithsthrone.game.inventory.clothing.AbstractClothing) ItemEffect(com.lilithsthrone.game.inventory.item.ItemEffect)

Example 5 with StatusEffect

use of com.lilithsthrone.game.character.effects.StatusEffect in project liliths-throne-public by Innoxia.

the class GameCharacter method saveAsXML.

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

Aggregations

StatusEffect (com.lilithsthrone.game.character.effects.StatusEffect)7 Attribute (com.lilithsthrone.game.character.attributes.Attribute)5 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)5 Perk (com.lilithsthrone.game.character.effects.Perk)4 AbstractClothing (com.lilithsthrone.game.inventory.clothing.AbstractClothing)4 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)3 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)3 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)3 GameCharacter (com.lilithsthrone.game.character.GameCharacter)3 SpecialAttack (com.lilithsthrone.game.combat.SpecialAttack)3 Spell (com.lilithsthrone.game.combat.Spell)3 InventorySlot (com.lilithsthrone.game.inventory.InventorySlot)3 ArrayList (java.util.ArrayList)3 NPC (com.lilithsthrone.game.character.npc.NPC)2 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)2 AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)2 ItemEffect (com.lilithsthrone.game.inventory.item.ItemEffect)2 AbstractWeapon (com.lilithsthrone.game.inventory.weapon.AbstractWeapon)2 SexType (com.lilithsthrone.game.sex.SexType)2 SlaveJobSetting (com.lilithsthrone.game.slavery.SlaveJobSetting)2