Search in sources :

Example 6 with Response

use of com.lilithsthrone.game.dialogue.responses.Response 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 7 with Response

use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.

the class MainController method moveSouth.

/**
 * Moves the player South.
 */
public void moveSouth() {
    if (Main.game.getPlayer().getLocation().getY() - 1 >= 0) {
        if (Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation().getX(), Main.game.getPlayer().getLocation().getY() - 1).getPlace().getPlaceType() != PlaceType.GENERIC_IMPASSABLE) {
            if (Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getPlace().isItemsDisappear()) {
                Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).resetInventory(Util.newArrayListOfValues(new ListValue<>(Rarity.LEGENDARY)));
            }
            Main.game.getPlayer().setLocation(new Vector2i(Main.game.getPlayer().getLocation().getX(), Main.game.getPlayer().getLocation().getY() - 1));
            DialogueNodeOld dn = Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getPlace().getDialogue(true);
            Main.game.setContent(new Response("", "", dn));
        }
    }
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response) ListValue(com.lilithsthrone.utils.Util.ListValue) DialogueNodeOld(com.lilithsthrone.game.dialogue.DialogueNodeOld) Vector2i(com.lilithsthrone.utils.Vector2i)

Example 8 with Response

use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.

the class InventorySelectedItemEventListener method handleEvent.

@Override
public void handleEvent(Event event) {
    if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.CHARACTERS_PRESENT || Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
        return;
    }
    TooltipUpdateThread.cancelThreads = true;
    if (item != null) {
        if (Main.game.getCurrentDialogueNode().getMapDisplay() != MapDisplay.INVENTORY) {
            Main.mainController.openInventory();
        }
        if (Main.game.getDialogueFlags().values.contains(DialogueFlagValue.quickTrade)) {
            switch(// TODO
            InventoryDialogue.getNPCInventoryInteraction()) {
                case COMBAT:
                    break;
                case FULL_MANAGEMENT:
                    break;
                case SEX:
                    break;
                case TRADING:
                    break;
                case CHARACTER_CREATION:
                    break;
            }
        } else {
            InventoryDialogue.setOwner(owner);
            InventoryDialogue.setItem(item);
            InventoryDialogue.setBuyBackIndex(buyBackIndex);
            Main.game.setResponseTab(1);
            Main.game.setContent(new Response("", "", InventoryDialogue.ITEM_INVENTORY));
        }
    } else if (clothing != null) {
        if (Main.game.getCurrentDialogueNode().getMapDisplay() != MapDisplay.INVENTORY) {
            Main.mainController.openInventory();
        }
        InventoryDialogue.setOwner(owner);
        InventoryDialogue.setClothing(clothing);
        InventoryDialogue.setBuyBackIndex(buyBackIndex);
        Main.game.setResponseTab(1);
        Main.game.setContent(new Response("", "", InventoryDialogue.CLOTHING_INVENTORY));
    } else if (weapon != null) {
        if (Main.game.getCurrentDialogueNode().getMapDisplay() != MapDisplay.INVENTORY) {
            Main.mainController.openInventory();
        }
        InventoryDialogue.setOwner(owner);
        InventoryDialogue.setWeapon(weapon);
        InventoryDialogue.setBuyBackIndex(buyBackIndex);
        Main.game.setResponseTab(1);
        Main.game.setContent(new Response("", "", InventoryDialogue.WEAPON_INVENTORY));
    } else if (clothingEquipped != null) {
        if (Main.game.getCurrentDialogueNode().getMapDisplay() != MapDisplay.INVENTORY) {
            Main.mainController.openInventory();
        }
        InventoryDialogue.setOwner(owner);
        InventoryDialogue.setClothing(clothingEquipped);
        InventoryDialogue.setBuyBackIndex(buyBackIndex);
        Main.game.setResponseTab(1);
        Main.game.setContent(new Response("", "", InventoryDialogue.CLOTHING_EQUIPPED));
    } else if (weaponEquipped != null) {
        if (Main.game.getCurrentDialogueNode().getMapDisplay() != MapDisplay.INVENTORY) {
            Main.mainController.openInventory();
        }
        InventoryDialogue.setOwner(owner);
        InventoryDialogue.setWeapon(weaponEquipped);
        InventoryDialogue.setBuyBackIndex(buyBackIndex);
        Main.game.setResponseTab(1);
        Main.game.setContent(new Response("", "", InventoryDialogue.WEAPON_EQUIPPED));
    }
    Main.mainController.getTooltip().hide();
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response)

Example 9 with Response

use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.

the class Game method setContent.

public void setContent(int index) {
    Response response = currentDialogueNode.getResponse(responseTab, index);
    if (response != null) {
        String corruptionGains = "";
        if (!response.isAvailable()) {
            if (!response.isAbleToBypass()) {
                return;
            } else {
                Main.game.getPlayer().incrementAttribute(Attribute.MAJOR_CORRUPTION, response.getCorruptionNeeded().getCorruptionBypass());
                corruptionGains = ("<p style='text-align:center;'>" + "<b>You have gained +" + response.getCorruptionNeeded().getCorruptionBypass() + "</b> <b style='color:" + Attribute.MAJOR_CORRUPTION.getColour().toWebHexString() + ";'>corruption</b><b>!</b>" + "</p>");
            }
        }
        String chosenResponse = response.getTitle();
        DialogueNodeOld node = response.getNextDialogue();
        response.applyEffects();
        if (response instanceof ResponseCombat) {
            setContent(new Response("", "", ((ResponseCombat) response).initCombat()));
            return;
        } else if (response instanceof ResponseSex) {
            setContent(new Response("", "", ((ResponseSex) response).initSex()));
            return;
        } else if (response instanceof ResponseEffectsOnly) {
            return;
        } else if (response instanceof ResponseTrade) {
            ((ResponseTrade) response).openTrade();
            return;
        }
        if (node != null) {
            // Add characters in this scene to the player's encountered characters list:
            if (started) {
                if (!getCharactersPresent().isEmpty()) {
                    for (GameCharacter character : getCharactersPresent()) {
                        if (!Main.game.getPlayer().getCharactersEncountered().contains(character.getId())) {
                            if (character instanceof NPC) {
                                if (((NPC) character).isAddedToContacts()) {
                                    Main.game.getPlayer().addCharacterEncountered(character);
                                }
                                if (!character.isRaceConcealed()) {
                                    Main.getProperties().addRaceDiscovered(character.getRace());
                                }
                                ((NPC) character).setLastTimeEncountered(minutesPassed);
                            }
                        }
                    }
                }
            }
            String headerContent = node.getHeaderContent();
            String content = node.getContent();
            if (currentDialogueNode != null) {
                if (node.isContinuesDialogue()) {
                    if (!node.isNoTextForContinuesDialogue()) {
                        if (Main.game.isInSex()) {
                            dialogueTitle = UtilText.parse(node.getLabel());
                        }
                        if (node.isDisplaysActionTitleOnContinuesDialogue()) {
                            if (currentDialogueNode.getMapDisplay() == MapDisplay.NORMAL) {
                                positionAnchor++;
                            }
                            pastDialogueSB.append("<hr id='position" + positionAnchor + "'><p class='option-disabled'>&gt " + chosenResponse + "</p>");
                        }
                        if (getMapDisplay() == MapDisplay.NORMAL)
                            initialPositionAnchor = positionAnchor;
                        pastDialogueSB.append(UtilText.parse(corruptionGains + textStartStringBuilder.toString() + content + textEndStringBuilder.toString()));
                    }
                } else {
                    dialogueTitle = UtilText.parse(node.getLabel());
                    if (getMapDisplay() == MapDisplay.NORMAL)
                        initialPositionAnchor = positionAnchor;
                    if (currentDialogueNode.getMapDisplay() == MapDisplay.NORMAL)
                        positionAnchor = 0;
                    pastDialogueSB.setLength(0);
                    pastDialogueSB.append(UtilText.parse(corruptionGains + textStartStringBuilder.toString() + content + textEndStringBuilder.toString()));
                }
            } else {
                dialogueTitle = UtilText.parse(node.getLabel());
            }
            // currentDialogueNode.applyResponse(index, true);
            // updateUIAttributes();
            boolean resetPointer = true;
            if (node != currentDialogueNode) {
                responsePage = 0;
                currentDialogueNode = node;
            } else {
                currentDialogueNode = node;
                checkForResponsePage();
                resetPointer = false;
            }
            if (node.isContinuesDialogue()) {
                currentDialogue = "<body onLoad='scrollToElement()'>" + "<script>function scrollToElement() {document.getElementById('content-block').scrollTop = document.getElementById('position" + (positionAnchor) + "').offsetTop -64;}</script>" + "<div id='main-content'>" + getTitleDiv(dialogueTitle) + "<div class='div-center' id='content-block'>" + // + "<div class='inner-text-content'>"
                getMapDiv() + (headerContent != null ? "<div id='header-content' style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;-webkit-user-select: none;'>" + (currentDialogueNode.disableHeaderParsing() ? headerContent : UtilText.parse(headerContent)) + "</div>" : "") + (content != null ? "<div " + (Main.getProperties().fadeInText ? "id='text-content'" : "") + " style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;'>" + pastDialogueSB.toString() + "</div>" : "") + // + "</div>"
                "</div>" + "<div id='bottom-text'>Game saved!</div>" + getResponsesDiv(currentDialogueNode, resetPointer) + "</div>" + "</body>";
            } else {
                currentDialogue = "<body>" + "<div id='main-content'>" + getTitleDiv(dialogueTitle) + "<span id='position" + positionAnchor + "'></span>" + "<div class='div-center' id='content-block'>" + // + "<div class='inner-text-content'>"
                getMapDiv() + (headerContent != null ? "<div id='header-content' style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;-webkit-user-select: none;'>" + (currentDialogueNode.disableHeaderParsing() ? headerContent : UtilText.parse(headerContent)) + "</div>" : "") + (content != null ? "<div " + (Main.getProperties().fadeInText ? "id='text-content'" : "") + " style='font-size:" + Main.getProperties().fontSize + "px; line-height:" + (Main.getProperties().fontSize + 6) + "px;'>" + pastDialogueSB.toString() + "</div>" : "") + // + "</div>"
                "</div>" + "<div id='bottom-text'>Game saved!</div>" + getResponsesDiv(currentDialogueNode, resetPointer) + "</div>" + "</body>";
            }
            // Main.mainController.unbindListeners();
            Main.mainController.setMainContent(currentDialogue);
            textEndStringBuilder.setLength(0);
            textStartStringBuilder.setLength(0);
            if (started) {
                Main.game.endTurn(getCurrentDialogueNode().getMinutesPassed());
            }
            TooltipUpdateThread.cancelThreads = true;
        // Main.mainController.processNewDialogue();
        }
    }
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response) TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) NPC(com.lilithsthrone.game.character.npc.NPC) GenericFemaleNPC(com.lilithsthrone.game.character.npc.GenericFemaleNPC) GenericAndrogynousNPC(com.lilithsthrone.game.character.npc.GenericAndrogynousNPC) GenericMaleNPC(com.lilithsthrone.game.character.npc.GenericMaleNPC) ResponseCombat(com.lilithsthrone.game.dialogue.responses.ResponseCombat) DialogueNodeOld(com.lilithsthrone.game.dialogue.DialogueNodeOld) ResponseEffectsOnly(com.lilithsthrone.game.dialogue.responses.ResponseEffectsOnly) ResponseTrade(com.lilithsthrone.game.dialogue.responses.ResponseTrade) GameCharacter(com.lilithsthrone.game.character.GameCharacter) ResponseSex(com.lilithsthrone.game.dialogue.responses.ResponseSex)

Example 10 with Response

use of com.lilithsthrone.game.dialogue.responses.Response in project liliths-throne-public by Innoxia.

the class Game method importGame.

public static void importGame(String name) {
    Game newGame = new Game();
    Main.game = newGame;
    File file = new File("data/saves/" + name + ".xml");
    if (file.exists()) {
        try {
            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
            Document doc = dBuilder.parse(file);
            // Cast magic:
            doc.getDocumentElement().normalize();
            Element gameElement = (Element) doc.getElementsByTagName("game").item(0);
            Element informationNode = (Element) gameElement.getElementsByTagName("coreInfo").item(0);
            String version = informationNode.getAttribute("version");
            newGame.minutesPassed = Long.valueOf(informationNode.getAttribute("minutesPassed"));
            newGame.debugMode = Boolean.valueOf(informationNode.getAttribute("debugMode"));
            newGame.imperialMeasurements = Boolean.valueOf(informationNode.getAttribute("imperialMeasurements"));
            newGame.currentWeather = Weather.valueOf(informationNode.getAttribute("weather"));
            newGame.nextStormTime = Long.valueOf(informationNode.getAttribute("nextStormTime"));
            newGame.weatherTimeRemaining = Integer.valueOf(informationNode.getAttribute("weatherTimeRemaining"));
            Element dateNode = (Element) gameElement.getElementsByTagName("date").item(0);
            newGame.startingDate = LocalDateTime.of(Integer.valueOf(dateNode.getAttribute("year")), Integer.valueOf(dateNode.getAttribute("month")), Integer.valueOf(dateNode.getAttribute("dayOfMonth")), Integer.valueOf(dateNode.getAttribute("hour")), Integer.valueOf(dateNode.getAttribute("minute")));
            newGame.dialogueFlags = DialogueFlags.loadFromXML((Element) gameElement.getElementsByTagName("dialogueFlags").item(0), doc);
            for (int i = 0; i < ((Element) gameElement.getElementsByTagName("eventLog").item(0)).getElementsByTagName("eventLogEntry").getLength(); i++) {
                Element e = (Element) ((Element) gameElement.getElementsByTagName("eventLog").item(0)).getElementsByTagName("eventLogEntry").item(i);
                newGame.eventLog.add(EventLogEntry.loadFromXML(e, doc));
            }
            newGame.eventLog.sort(Comparator.comparingLong(EventLogEntry::getTime));
            NodeList nodes = gameElement.getElementsByTagName("slaveryEventLog");
            Element extraEffectNode = (Element) nodes.item(0);
            if (extraEffectNode != null) {
                for (int i = 0; i < extraEffectNode.getElementsByTagName("day").getLength(); i++) {
                    Element e = (Element) gameElement.getElementsByTagName("day").item(i);
                    int day = Integer.valueOf(e.getAttribute("value"));
                    newGame.slaveryEventLog.put(day, new ArrayList<>());
                    for (int j = 0; j < e.getElementsByTagName("eventLogEntry").getLength(); j++) {
                        Element entry = (Element) e.getElementsByTagName("eventLogEntry").item(j);
                        newGame.slaveryEventLog.get(day).add(SlaveryEventLogEntry.loadFromXML(entry, doc));
                    }
                }
            }
            // Maps:
            for (int i = 0; i < ((Element) gameElement.getElementsByTagName("maps").item(0)).getElementsByTagName("world").getLength(); i++) {
                Element e = (Element) ((Element) gameElement.getElementsByTagName("maps").item(0)).getElementsByTagName("world").item(i);
                if ((!e.getAttribute("worldType").equals("SEWERS") || !Main.isVersionOlderThan(version, "0.2.0.5")) && (!e.getAttribute("worldType").equals("SUBMISSION") || !Main.isVersionOlderThan(version, "0.2.1.5")) && (!e.getAttribute("worldType").equals("DOMINION") || !Main.isVersionOlderThan(version, "0.2.1.5")) && (!e.getAttribute("worldType").equals("HARPY_NEST") || !Main.isVersionOlderThan(version, "0.2.1.5"))) {
                    World world = World.loadFromXML(e, doc);
                    newGame.worlds.put(world.getWorldType(), world);
                }
            }
            // Add missing world types:
            for (WorldType wt : WorldType.values()) {
                Generation gen = new Generation();
                if (Main.isVersionOlderThan(version, "0.1.99.5")) {
                    gen.worldGeneration(WorldType.SHOPPING_ARCADE);
                }
                if (Main.isVersionOlderThan(version, "0.2.1.5")) {
                    gen.worldGeneration(WorldType.SUBMISSION);
                    gen.worldGeneration(WorldType.DOMINION);
                    gen.worldGeneration(WorldType.HARPY_NEST);
                }
                if (newGame.worlds.get(wt) == null) {
                    gen.worldGeneration(wt);
                }
            }
            newGame.player = PlayerCharacter.loadFromXML(null, (Element) ((Element) gameElement.getElementsByTagName("playerCharacter").item(0)), doc);
            List<String> addedIds = new ArrayList<>();
            List<NPC> slaveImports = new ArrayList<>();
            // Load NPCs:
            for (int i = 0; i < gameElement.getElementsByTagName("NPC").getLength(); i++) {
                Element e = (Element) gameElement.getElementsByTagName("NPC").item(i);
                if (!addedIds.contains(((Element) e.getElementsByTagName("id").item(0)).getAttribute("value"))) {
                    @SuppressWarnings("unchecked") Class<? extends NPC> npcClass = (Class<? extends NPC>) Class.forName(((Element) e.getElementsByTagName("pathName").item(0)).getAttribute("value"));
                    Method m = npcClass.getMethod("loadFromXML", Element.class, Document.class, CharacterImportSetting[].class);
                    NPC npc = npcClass.getDeclaredConstructor(boolean.class).newInstance(true);
                    m.invoke(npc, e, doc, new CharacterImportSetting[] {});
                    newGame.addNPC(npc, true);
                    addedIds.add(npc.getId());
                    // To fix issues with older versions hair length:
                    if (Main.isVersionOlderThan(version, "0.1.90.5")) {
                        npc.getBody().getHair().setLength(null, npc.isFeminine() ? RacialBody.valueOfRace(npc.getRace()).getFemaleHairLength() : RacialBody.valueOfRace(npc.getRace()).getMaleHairLength());
                    }
                    // Generate desires in non-unique NPCs:
                    if (Main.isVersionOlderThan(version, "0.1.98.5") && !npc.isUnique() && npc.getFetishDesireMap().isEmpty()) {
                        CharacterUtils.generateDesires(npc);
                    }
                    if (Main.isVersionOlderThan(version, "0.2.0") && npc.getFetishDesireMap().size() > 10) {
                        npc.clearFetishDesires();
                        CharacterUtils.generateDesires(npc);
                    }
                    if (npc instanceof SlaveImport) {
                        slaveImports.add(npc);
                    }
                } else {
                    System.err.println("duplicate character attempted to be imported");
                }
            }
            // Add in new NPCS:
            if (!newGame.NPCMap.containsKey(newGame.getUniqueNPCId(Zaranix.class))) {
                Zaranix zaranix = new Zaranix();
                newGame.addNPC(zaranix, false);
                ZaranixMaidKatherine katherine = new ZaranixMaidKatherine();
                newGame.addNPC(katherine, false);
                ZaranixMaidKelly kelly = new ZaranixMaidKelly();
                newGame.addNPC(kelly, false);
                Amber amber = new Amber();
                newGame.addNPC(amber, false);
                zaranix.setAffection(katherine, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                zaranix.setAffection(kelly, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                zaranix.setAffection(amber, AffectionLevel.POSITIVE_FOUR_LOVE.getMedianValue());
                amber.setAffection(zaranix, AffectionLevel.POSITIVE_FOUR_LOVE.getMedianValue());
                amber.setAffection(kelly, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                amber.setAffection(katherine, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                kelly.setAffection(zaranix, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                kelly.setAffection(katherine, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                kelly.setAffection(amber, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                katherine.setAffection(zaranix, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                katherine.setAffection(kelly, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                katherine.setAffection(amber, AffectionLevel.POSITIVE_THREE_CARING.getMedianValue());
                newGame.addNPC(new Arthur(), false);
            }
            if (!newGame.NPCMap.containsKey(newGame.getUniqueNPCId(Ashley.class))) {
                newGame.addNPC(new Ashley(), false);
            }
            if (!newGame.NPCMap.containsKey(newGame.getUniqueNPCId(SupplierLeader.class))) {
                newGame.addNPC(new SupplierLeader(), false);
            }
            if (!newGame.NPCMap.containsKey(newGame.getUniqueNPCId(SupplierPartner.class))) {
                newGame.addNPC(new SupplierPartner(), false);
            }
            // To prevent errors from previous versions, reset Zaranix progress if prior to 0.1.95:
            if (Main.isVersionOlderThan(version, "0.1.90.5")) {
                if (Main.game.getPlayer().getWorldLocation() == WorldType.ZARANIX_HOUSE_GROUND_FLOOR || Main.game.getPlayer().getWorldLocation() == WorldType.ZARANIX_HOUSE_FIRST_FLOOR) {
                    Main.game.getPlayer().setLocation(WorldType.DOMINION, PlaceType.DOMINION_DEMON_HOME, false);
                    ZaranixHomeGroundFloor.resetHouseAfterLeaving();
                    Main.game.getDialogueFlags().setFlag(DialogueFlagValue.zaranixDiscoveredHome, false);
                    Main.game.getDialogueFlags().setFlag(DialogueFlagValue.zaranixKickedDownDoor, false);
                    Main.game.getDialogueFlags().setFlag(DialogueFlagValue.zaranixKnockedOnDoor, false);
                    Main.game.getDialogueFlags().setFlag(DialogueFlagValue.zaranixMaidsHostile, false);
                    Main.game.getArthur().setLocation(WorldType.ZARANIX_HOUSE_FIRST_FLOOR, PlaceType.ZARANIX_FF_OFFICE, true);
                    if (Main.game.getPlayer().isQuestProgressGreaterThan(QuestLine.MAIN, Quest.MAIN_1_H_THE_GREAT_ESCAPE)) {
                        Main.game.getPlayer().setQuestProgress(QuestLine.MAIN, Quest.MAIN_1_H_THE_GREAT_ESCAPE);
                    }
                }
            }
            if (Main.isVersionOlderThan(version, "0.1.95")) {
                if (Main.game.getPlayer().isQuestProgressGreaterThan(QuestLine.MAIN, Quest.MAIN_1_H_THE_GREAT_ESCAPE)) {
                    Main.game.getArthur().setLocation(WorldType.LILAYAS_HOUSE_GROUND_FLOOR, PlaceType.LILAYA_HOME_LAB, true);
                }
            }
            Main.game.pendingSlaveInStocksReset = false;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    Main.game.setRenderMap(true);
    Main.game.setRenderAttributesSection(true);
    Main.game.started = true;
    DialogueNodeOld startingDialogueNode = Main.game.getPlayerCell().getPlace().getDialogue(false);
    Main.game.addEvent(new EventLogEntry(Main.game.getMinutesPassed(), "[style.colourGood(Game loaded)]", "data/saves/" + name + ".xml"), false);
    Main.game.setContent(new Response(startingDialogueNode.getLabel(), startingDialogueNode.getDescription(), startingDialogueNode), false);
    newGame.endTurn(0);
}
Also used : TestNPC(com.lilithsthrone.game.character.npc.dominion.TestNPC) NPC(com.lilithsthrone.game.character.npc.NPC) GenericFemaleNPC(com.lilithsthrone.game.character.npc.GenericFemaleNPC) GenericAndrogynousNPC(com.lilithsthrone.game.character.npc.GenericAndrogynousNPC) GenericMaleNPC(com.lilithsthrone.game.character.npc.GenericMaleNPC) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Amber(com.lilithsthrone.game.character.npc.dominion.Amber) Arthur(com.lilithsthrone.game.character.npc.dominion.Arthur) EventLogEntry(com.lilithsthrone.game.dialogue.eventLog.EventLogEntry) SlaveryEventLogEntry(com.lilithsthrone.game.dialogue.eventLog.SlaveryEventLogEntry) Element(org.w3c.dom.Element) DialogueNodeOld(com.lilithsthrone.game.dialogue.DialogueNodeOld) ArrayList(java.util.ArrayList) SlaveImport(com.lilithsthrone.game.character.npc.SlaveImport) Document(org.w3c.dom.Document) World(com.lilithsthrone.world.World) Zaranix(com.lilithsthrone.game.character.npc.dominion.Zaranix) WorldType(com.lilithsthrone.world.WorldType) CharacterImportSetting(com.lilithsthrone.game.character.CharacterImportSetting) SupplierPartner(com.lilithsthrone.game.character.npc.dominion.SupplierPartner) NodeList(org.w3c.dom.NodeList) ZaranixMaidKelly(com.lilithsthrone.game.character.npc.dominion.ZaranixMaidKelly) Method(java.lang.reflect.Method) TransformerException(javax.xml.transform.TransformerException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) Response(com.lilithsthrone.game.dialogue.responses.Response) Generation(com.lilithsthrone.world.Generation) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Ashley(com.lilithsthrone.game.character.npc.dominion.Ashley) File(java.io.File) ZaranixMaidKatherine(com.lilithsthrone.game.character.npc.dominion.ZaranixMaidKatherine) SupplierLeader(com.lilithsthrone.game.character.npc.dominion.SupplierLeader)

Aggregations

Response (com.lilithsthrone.game.dialogue.responses.Response)32 DialogueNodeOld (com.lilithsthrone.game.dialogue.DialogueNodeOld)9 ListValue (com.lilithsthrone.utils.Util.ListValue)7 File (java.io.File)7 EventTarget (org.w3c.dom.events.EventTarget)7 TestNPC (com.lilithsthrone.game.character.npc.dominion.TestNPC)6 Vector2i (com.lilithsthrone.utils.Vector2i)6 GameCharacter (com.lilithsthrone.game.character.GameCharacter)5 NPC (com.lilithsthrone.game.character.npc.NPC)5 ResponseEffectsOnly (com.lilithsthrone.game.dialogue.responses.ResponseEffectsOnly)5 Fetish (com.lilithsthrone.game.character.fetishes.Fetish)4 GenericAndrogynousNPC (com.lilithsthrone.game.character.npc.GenericAndrogynousNPC)4 GenericFemaleNPC (com.lilithsthrone.game.character.npc.GenericFemaleNPC)4 GenericMaleNPC (com.lilithsthrone.game.character.npc.GenericMaleNPC)4 InventorySelectedItemEventListener (com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener)3 InventoryTooltipEventListener (com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener)3 TooltipInformationEventListener (com.lilithsthrone.controller.eventListeners.TooltipInformationEventListener)3 Game (com.lilithsthrone.game.Game)3 WorldType (com.lilithsthrone.world.WorldType)3 ArrayList (java.util.ArrayList)3