Search in sources :

Example 21 with Response

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

the class MainController method moveNorth.

/**
 * Moves the player North.
 */
public void moveNorth() {
    if (Main.game.getPlayer().getLocation().getY() + 1 < Main.game.getActiveWorld().WORLD_HEIGHT) {
        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 22 with Response

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

the class MainController method manageAttributeListeners.

private void manageAttributeListeners() {
    documentAttributes = (Document) webEngineAttributes.executeScript("document");
    EventListenerDataMap.put(documentAttributes, new ArrayList<>());
    // Map:
    if (((EventTarget) documentAttributes.getElementById("upButton")) != null) {
        addEventListener(documentAttributes, "upButton", "click", moveNorthListener, true);
    }
    if (((EventTarget) documentAttributes.getElementById("downButton")) != null) {
        addEventListener(documentAttributes, "downButton", "click", moveSouthListener, true);
    }
    if (((EventTarget) documentAttributes.getElementById("leftButton")) != null) {
        addEventListener(documentAttributes, "leftButton", "click", moveWestListener, true);
    }
    if (((EventTarget) documentAttributes.getElementById("rightButton")) != null) {
        addEventListener(documentAttributes, "rightButton", "click", moveEastListener, true);
    }
    // Inventory:
    // For all equipped clothing slots:
    String id;
    for (InventorySlot invSlot : InventorySlot.values()) {
        id = invSlot.toString() + "Slot";
        if (invSlot != InventorySlot.WEAPON_MAIN && invSlot != InventorySlot.WEAPON_OFFHAND) {
            if (((EventTarget) documentAttributes.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setClothingEquipped(Main.game.getPlayer(), invSlot);
                addEventListener(documentAttributes, id, "click", el, false);
                addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
                addEventListener(documentAttributes, id, "mouseenter", el2, false);
            }
        } else {
            if (((EventTarget) documentAttributes.getElementById(id)) != null) {
                InventorySelectedItemEventListener el = new InventorySelectedItemEventListener().setWeaponEquipped(Main.game.getPlayer(), invSlot);
                addEventListener(documentAttributes, id, "click", el, false);
                addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
                InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setInventorySlot(invSlot, Main.game.getPlayer());
                addEventListener(documentAttributes, id, "mouseenter", el2, false);
            }
        }
    }
    id = "DATE_DISPLAY_TOGGLE";
    if (((EventTarget) documentAttributes.getElementById(id)) != null) {
        ((EventTarget) documentAttributes.getElementById(id)).addEventListener("click", e -> {
            Main.getProperties().calendarDisplay = !Main.getProperties().calendarDisplay;
            Main.saveProperties();
            this.updateUI();
        }, false);
        addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
        addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
        TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Toggle Calendar Display", "Toggle the date's display between a calendar and day count.");
        addEventListener(documentAttributes, id, "mouseenter", el2, false);
    }
    id = "TWENTY_FOUR_HOUR_TIME_TOGGLE";
    if (((EventTarget) documentAttributes.getElementById(id)) != null) {
        ((EventTarget) documentAttributes.getElementById(id)).addEventListener("click", e -> {
            Main.getProperties().twentyFourHourTime = !Main.getProperties().twentyFourHourTime;
            Main.saveProperties();
            this.updateUI();
        }, false);
        addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
        addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
        TooltipInformationEventListener el2 = new TooltipInformationEventListener().setInformation("Toggle Time Display", "Toggle the display of time between a 24 and 12-hour clock.");
        addEventListener(documentAttributes, id, "mouseenter", el2, false);
    }
    if (((EventTarget) documentAttributes.getElementById("ESSENCE_" + TFEssence.ARCANE.hashCode())) != null) {
        addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mousemove", moveTooltipListener, false);
        addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mouseleave", hideTooltipListener, false);
        InventoryTooltipEventListener el2 = new InventoryTooltipEventListener().setEssence(TFEssence.ARCANE);
        addEventListener(documentAttributes, "ESSENCE_" + TFEssence.ARCANE.hashCode(), "mouseenter", el2, false);
    }
    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.add(Main.game.getPlayer());
        charactersBeingRendered.addAll(Combat.getAllies());
    } else {
        if (Main.game.getPlayer() != null) {
            charactersBeingRendered.add(Main.game.getPlayer());
        }
    }
    for (GameCharacter character : charactersBeingRendered) {
        String idModifier = (character.isPlayer() ? "PLAYER_" : "NPC_" + character.getId() + "_");
        for (Attribute a : attributes) {
            if (((EventTarget) documentAttributes.getElementById(idModifier + a.getName())) != null) {
                if (a == Attribute.EXPERIENCE) {
                    ((EventTarget) documentAttributes.getElementById(idModifier + a.getName())).addEventListener("click", e -> {
                        if (character.isPlayer()) {
                            // block when in character creation
                            if (Main.game.isInNewWorld()) {
                                if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
                                    if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_APPEARANCE) {
                                        openPhone();
                                    } else {
                                        Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_APPEARANCE));
                                    }
                                } else if (!Main.game.getCurrentDialogueNode().isOptionsDisabled()) {
                                    if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
                                        Main.game.saveDialogueNode();
                                    }
                                    Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_APPEARANCE));
                                }
                            }
                        } else {
                            openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
                        }
                    }, false);
                }
                addEventListener(documentAttributes, idModifier + a.getName(), "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, idModifier + a.getName(), "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setAttribute(a, character);
                addEventListener(documentAttributes, idModifier + a.getName(), "mouseenter", el, false);
            }
        }
        if (((EventTarget) documentAttributes.getElementById(idModifier + "ATTRIBUTES")) != null) {
            ((EventTarget) documentAttributes.getElementById(idModifier + "ATTRIBUTES")).addEventListener("click", e -> {
                if (character.isPlayer()) {
                    // block when in character creation
                    if (Main.game.isInNewWorld()) {
                        if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.PHONE) {
                            if (Main.game.getCurrentDialogueNode() == PhoneDialogue.CHARACTER_LEVEL_UP) {
                                openPhone();
                            } else {
                                Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_LEVEL_UP));
                            }
                        } else if (!Main.game.getCurrentDialogueNode().isOptionsDisabled()) {
                            if (Main.game.getCurrentDialogueNode().getMapDisplay() == MapDisplay.NORMAL) {
                                Main.game.saveDialogueNode();
                            }
                            Main.game.setContent(new Response("", "", PhoneDialogue.CHARACTER_LEVEL_UP));
                        }
                    }
                } else {
                    // TODO display NPC perk tree
                    openCharactersPresent(Main.game.getNPCById(Main.game.getActiveNPC().getId()));
                }
            }, false);
            addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mousemove", moveTooltipListener, false);
            addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mouseleave", hideTooltipListener, false);
            TooltipInformationEventListener el = new TooltipInformationEventListener().setExtraAttributes(character);
            addEventListener(documentAttributes, idModifier + "ATTRIBUTES", "mouseenter", el, false);
        }
        // For status effect slots:
        for (StatusEffect se : character.getStatusEffects()) {
            if (((EventTarget) documentAttributes.getElementById("SE_" + idModifier + se)) != null) {
                addEventListener(documentAttributes, "SE_" + idModifier + se, "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, "SE_" + idModifier + se, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setStatusEffect(se, character);
                addEventListener(documentAttributes, "SE_" + idModifier + se, "mouseenter", el, false);
            }
        }
        for (Perk trait : character.getTraits()) {
            id = "TRAIT_" + idModifier + trait;
            if (((EventTarget) documentAttributes.getElementById(id)) != null) {
                addEventListener(documentAttributes, id, "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, id, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setPerk(trait, character);
                addEventListener(documentAttributes, id, "mouseenter", el, false);
            }
        }
        for (Fetish f : character.getFetishes()) {
            if (((EventTarget) documentAttributes.getElementById("FETISH_" + idModifier + f)) != null) {
                addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setFetish(f, character);
                addEventListener(documentAttributes, "FETISH_" + idModifier + f, "mouseenter", el, false);
            }
        }
        for (SpecialAttack sa : character.getSpecialAttacks()) {
            if (((EventTarget) documentAttributes.getElementById("SA_" + idModifier + sa)) != null) {
                addEventListener(documentAttributes, "SA_" + idModifier + sa, "mousemove", moveTooltipListener, false);
                addEventListener(documentAttributes, "SA_" + idModifier + sa, "mouseleave", hideTooltipListener, false);
                TooltipInformationEventListener el = new TooltipInformationEventListener().setSpecialAttack(sa, character);
                addEventListener(documentAttributes, "SA_" + 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) Attribute(com.lilithsthrone.game.character.attributes.Attribute) InventorySlot(com.lilithsthrone.game.inventory.InventorySlot) ArrayList(java.util.ArrayList) Perk(com.lilithsthrone.game.character.effects.Perk) Spell(com.lilithsthrone.game.combat.Spell) InventorySelectedItemEventListener(com.lilithsthrone.controller.eventListeners.InventorySelectedItemEventListener) Response(com.lilithsthrone.game.dialogue.responses.Response) Fetish(com.lilithsthrone.game.character.fetishes.Fetish) StatusEffect(com.lilithsthrone.game.character.effects.StatusEffect) InventoryTooltipEventListener(com.lilithsthrone.controller.eventListeners.InventoryTooltipEventListener) GameCharacter(com.lilithsthrone.game.character.GameCharacter) SpecialAttack(com.lilithsthrone.game.combat.SpecialAttack) EventTarget(org.w3c.dom.events.EventTarget)

Example 23 with Response

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

the class MainController method checkLastKeys.

/**
 * For cheat codes. debug: toggle debug mode spawn: open enemy spawn menu
 */
private void checkLastKeys() {
    if (lastKeysEqual(KeyCode.B, KeyCode.U, KeyCode.G, KeyCode.G, KeyCode.Y)) {
        Main.game.setContent(new Response("", "", DebugDialogue.DEBUG_MENU));
    }
    if (lastKeysEqual(KeyCode.N, KeyCode.O, KeyCode.X, KeyCode.X, KeyCode.X)) {
        if (Main.game.getPlayer().getLocationPlace().getPlaceType() == PlaceType.SHOPPING_ARCADE_GENERIC_SHOP && !Main.game.getTestNPC().isSlave()) {
            Main.game.setActiveNPC(Main.game.getTestNPC());
            Main.game.setContent(new Response("", "", TestNPC.TEST_DIALOGUE) {

                @Override
                public void effects() {
                    Main.game.getTestNPC().setLocation(WorldType.SHOPPING_ARCADE, Main.game.getPlayer().getLocation(), true);
                }
            });
        }
    }
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response)

Example 24 with Response

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

the class MainController method setTesticleCountListener.

private void setTesticleCountListener(int i) {
    String id = "TESTICLE_COUNT_" + i;
    if (((EventTarget) document.getElementById(id)) != null) {
        ((EventTarget) document.getElementById(id)).addEventListener("click", e -> {
            BodyChanging.getTarget().setTesticleCount(i);
            Main.game.setContent(new Response("", "", Main.game.getCurrentDialogueNode()));
        }, false);
    }
}
Also used : Response(com.lilithsthrone.game.dialogue.responses.Response) EventTarget(org.w3c.dom.events.EventTarget)

Example 25 with Response

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

the class MainController method moveWest.

/**
 * Moves the player West.
 */
public void moveWest() {
    if (Main.game.getPlayer().getLocation().getX() - 1 >= 0) {
        if (Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation().getX() - 1, Main.game.getPlayer().getLocation().getY()).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() - 1, Main.game.getPlayer().getLocation().getY()));
            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)

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