use of com.lilithsthrone.game.dialogue.DialogueNodeOld in project liliths-throne-public by Innoxia.
the class Game method setContent.
public void setContent(Response response, boolean allowTimeProgress, Colour flashMessageColour, String flashMessageText) {
DialogueNodeOld node = response.getNextDialogue();
response.applyEffects();
if (node == null) {
return;
}
int currentPosition = 0;
if (getCurrentDialogueNode() != null) {
currentPosition = (int) Main.mainController.getWebEngine().executeScript("document.getElementById('content-block').scrollTop");
}
String headerContent = node.getHeaderContent();
String content = node.getContent();
boolean resetPointer = false;
if (getMapDisplay() == MapDisplay.NORMAL) {
initialPositionAnchor = positionAnchor;
}
// Add characters in this scene to the player's encountered characters list:
if (started) {
if (!getCharactersPresent().isEmpty()) {
for (GameCharacter character : getCharactersPresent()) {
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);
}
}
}
}
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(UtilText.parse("<hr id='position" + positionAnchor + "'><p class='option-disabled'>> " + currentDialogueNode.getLabel() + "</p>"));
}
pastDialogueSB.append(content);
}
} else {
dialogueTitle = UtilText.parse(node.getLabel());
if (currentDialogueNode.getMapDisplay() == MapDisplay.NORMAL)
positionAnchor = 0;
pastDialogueSB.setLength(0);
pastDialogueSB.append(UtilText.parse("<b id='position" + positionAnchor + "'></b>" + textStartStringBuilder.toString() + content + textEndStringBuilder.toString()));
}
} else {
dialogueTitle = UtilText.parse(node.getLabel());
pastDialogueSB.setLength(0);
pastDialogueSB.append(UtilText.parse(textStartStringBuilder.toString() + content + textEndStringBuilder.toString()));
}
if (node != currentDialogueNode) {
responsePage = 0;
currentDialogueNode = node;
resetPointer = true;
} 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 onLoad='scrollBack()'>" + "<script>function scrollBack() {document.getElementById('content-block').scrollTop = " + currentPosition + ";}</script>" + "<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.setFlashMessageColour(flashMessageColour);
Main.mainController.setFlashMessageText(flashMessageText);
// -------------------- MEMORY LEAK PROBLEM
Main.mainController.setMainContent(currentDialogue);
// --------------------
textEndStringBuilder.setLength(0);
textStartStringBuilder.setLength(0);
// -------------------- MEMORY LEAK PROBLEM
if (started) {
if (allowTimeProgress) {
Main.game.endTurn(getCurrentDialogueNode().getMinutesPassed());
} else {
Main.game.endTurn(0);
}
}
// --------------------
}
use of com.lilithsthrone.game.dialogue.DialogueNodeOld 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));
}
}
}
use of com.lilithsthrone.game.dialogue.DialogueNodeOld 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));
}
}
}
use of com.lilithsthrone.game.dialogue.DialogueNodeOld in project liliths-throne-public by Innoxia.
the class Game method setActiveWorld.
/**
* @param world
* @param location Location to set player to
*/
public void setActiveWorld(World world, Vector2i location, boolean setDefaultDialogue) {
// activeWorld = world;
player.setWorldLocation(world.getWorldType());
player.setLocation(location);
if (setDefaultDialogue) {
DialogueNodeOld dn = Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).getPlace().getDialogue(true);
Main.game.setContent(new Response("", "", dn));
}
if (Main.game.started) {
Main.saveGame("AutoSave_" + Main.game.getPlayer().getName(), true);
}
}
Aggregations