Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Dialogues
Browse files Browse the repository at this point in the history
  • Loading branch information
VolcanoCookies committed Mar 10, 2019
1 parent 554ab6c commit 051550d
Show file tree
Hide file tree
Showing 70 changed files with 969 additions and 857 deletions.
Binary file modified bin/dialogueobject/Dialogue.class
Binary file not shown.
Binary file modified bin/dialogueobject/Message.class
Binary file not shown.
Binary file modified bin/dialogueobject/Response.class
Binary file not shown.
Binary file modified bin/dialogues/DialoguePanel$1.class
Binary file not shown.
Binary file modified bin/dialogues/DialoguePanel$SwingActionAddMessage.class
Binary file not shown.
Binary file modified bin/dialogues/DialoguePanel$SwingActionLoad.class
Binary file not shown.
Binary file modified bin/dialogues/DialoguePanel$SwingActionSaveDialogue.class
Binary file not shown.
Binary file modified bin/dialogues/DialoguePanel.class
Binary file not shown.
Binary file added bin/dialogues/Message$1.class
Binary file not shown.
Binary file added bin/dialogues/Message$2.class
Binary file not shown.
Binary file added bin/dialogues/Message$SwingActionAddReply.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/dialogues/Message$SwingActionRemove.class
Binary file not shown.
Binary file modified bin/dialogues/Message.class
Binary file not shown.
Binary file removed bin/dialogues/NewMessage$1.class
Binary file not shown.
Binary file removed bin/dialogues/NewMessage$2.class
Binary file not shown.
Binary file removed bin/dialogues/NewMessage$SwingActionAddReply.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed bin/dialogues/NewMessage$SwingActionRemove.class
Binary file not shown.
Binary file removed bin/dialogues/NewMessage.class
Binary file not shown.
Binary file removed bin/dialogues/NewResponse$1.class
Binary file not shown.
Binary file removed bin/dialogues/NewResponse$2.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed bin/dialogues/NewResponse$SwingActionRemove.class
Binary file not shown.
Binary file removed bin/dialogues/NewResponse.class
Binary file not shown.
Binary file added bin/dialogues/Response$1.class
Binary file not shown.
Binary file added bin/dialogues/Response$2.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/dialogues/Response$SwingActionRemove.class
Binary file not shown.
Binary file added bin/dialogues/Response.class
Binary file not shown.
Binary file modified bin/filemanagement/SaveDialogue.class
Binary file not shown.
Binary file added bin/popups/fileChooser.class
Binary file not shown.
Binary file modified bin/windows/Test.class
Binary file not shown.
Binary file modified bin/windows/Window$3.class
Binary file not shown.
Binary file modified bin/windows/Window$4.class
Binary file not shown.
Binary file modified bin/windows/Window$5.class
Binary file not shown.
Binary file modified bin/windows/Window$6.class
Binary file not shown.
Binary file modified bin/windows/Window$7.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionExit.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionOpenCredits.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionOpenDiscord.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionOpenDiscordBug.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionOpenIDList.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionOpenTrello.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionReadMeGuide.class
Binary file not shown.
Binary file modified bin/windows/Window$SwingActionSettings.class
Binary file not shown.
Binary file modified bin/windows/Window.class
Binary file not shown.
64 changes: 48 additions & 16 deletions src/dialogueobject/Dialogue.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Dialogue {

String GUID;
String diualogueID;
String dialogueID;

//Number of messages and responses
int numberOfMessages;
Expand All @@ -25,14 +25,47 @@ public class Dialogue {
public Dialogue(String path) {

this.path = path;
LoadDialogue(LoadDialogue.loadDialogue(path));
if(path!=null)
LoadDialogue(LoadDialogue.loadDialogue(path));
CompileDialogue();
}
private String[] CompileDialogue() {
//Asset.dat is 0, English.dat is 1
String output[] = new String[2];
output[0] = "";
output[1] = "";

//Get ID, GUID and set type
output[0] += "GUID " + this.GUID + "\n";
output[0] += "ID " + this.dialogueID + "\n";
output[0] += "Type Dialogue\n";


//Get messages and responses
output[0] += "\n" + "Messages " + this.numberOfMessages + "\n\n";
for(Message mes : messages) {
String[] compiled = mes.CompileMessage();
output[0] += compiled[0] + "\n";
output[1] += compiled[1] + "\n";
}
output[0] += "\n" + "Responses " + this.numberOfResponses + "\n\n";
for(Response res : responses) {
String[] compiled = res.CompileResponse();
output[0] += compiled[0] + "\n";
output[1] += compiled[1] + "\n";
}

System.out.println(output[0]);
System.out.println("##############\n##############\n");
System.out.println(output[1]);

return output;
}
private void LoadDialogue(String values[]) {

//Matcher to use for everything
Matcher matcher = Pattern.compile("").matcher(values[0]);
Matcher englishMatcher = Pattern.compile("").matcher(values[1]);

//Get number of messages and responses
matcher.reset();
Expand Down Expand Up @@ -77,11 +110,18 @@ private void LoadDialogue(String values[]) {
}
//Get message response indexes
matcher.reset();
matcher.usePattern(Pattern.compile("Message_([0-9]+)_Responses ([0-9]+)"));
matcher.usePattern(Pattern.compile("Message_([0-9]+)_Response_[0-9]+ ([0-9]+)"));
while(matcher.find()) {
messages[Integer.valueOf(matcher.group(1))].addResponseIndex(Integer.valueOf(matcher.group(2)));
}

//Get message English section
englishMatcher.reset();
englishMatcher.usePattern(Pattern.compile("Message_([0-9]+)_Page_[0-9]+ (.*)"));
while(englishMatcher.find()) {
messages[Integer.valueOf(englishMatcher.group(1))].addText(englishMatcher.group(2));
}

/*
* RESPONSE SECTION
*/
Expand Down Expand Up @@ -113,7 +153,6 @@ private void LoadDialogue(String values[]) {
matcher.reset();
matcher.usePattern(Pattern.compile("Response_([0-9]+)_(Quest|Dialogue|Vendor) ([0-9]+)"));
while(matcher.find()) {
System.out.println(matcher.group());
if(matcher.group(2).equals("Dialogue"))
responses[Integer.valueOf(matcher.group(1))].setDialogueID(matcher.group(3));
if(matcher.group(2).equals("Quest"))
Expand All @@ -122,18 +161,11 @@ private void LoadDialogue(String values[]) {
responses[Integer.valueOf(matcher.group(1))].setVendorID(matcher.group(3));
}


for(Message mes : messages) {
System.out.println("Index: " + mes.getIndex());
System.out.println(mes.getConditions());
System.out.println(mes.getRewards());
//Get response English section
englishMatcher.reset();
englishMatcher.usePattern(Pattern.compile("Response_([0-9]+) (.*)"));
while(englishMatcher.find()) {
responses[Integer.valueOf(englishMatcher.group(1))].setText(englishMatcher.group(2));
}
for(Response res : responses) {
System.out.println("Index: " + res.getIndex());
System.out.println(res.getConditions());
System.out.println(res.getRewards());
System.out.println(res.getDialogueID());
}

}
}
53 changes: 46 additions & 7 deletions src/dialogueobject/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;

public class Message {
class Message {

String index;
String conditions;
Expand All @@ -13,12 +13,12 @@ public class Message {
List<Integer> responseIndexes = new ArrayList<Integer>();

//Array is for pages.
String[] text;
List<String> text = new ArrayList<String>();

//Index of message to go back to
int returnMessageIndex;
int returnMessageIndex = 0;

Message() {
public Message() {

}

Expand Down Expand Up @@ -46,11 +46,11 @@ public List<Integer> getResponseIndexes() {
public void setResponseIndexes(List<Integer> responseIndexes) {
this.responseIndexes = responseIndexes;
}
public String[] getText() {
public List<String> getText() {
return text;
}
public void setText(String[] text) {
this.text = text;
public void addText(String text) {
this.text.add(text);
}
public int getReturnMessageIndex() {
return returnMessageIndex;
Expand All @@ -62,4 +62,43 @@ public void addReturnMessageIndex(int returnMessageIndex) {
public void addResponseIndex(int index) {
this.responseIndexes.add(index);
}

public String[] CompileMessage() {
//Asset.dat is 0, English.dat is 1
String output[] = new String[2];
output[0] = "";
output[1] = "";

//Get responses
if(this.responseIndexes.size()>0) {
output[0] += "Message_" + this.index + "_Responses " + this.responseIndexes.size() + "\n";
for(int i = 0; i < this.responseIndexes.size(); i++) {
output[0] += "Message_" + this.index + "_Response_" + i + " " + this.responseIndexes.get(i) + "\n";
}
}

//Get previous dialogue to go back to
if(this.returnMessageIndex!=0)
output[0] += "Message_" + this.index + "_Prev " + this.returnMessageIndex + "\n";

//Get message conditions and rewards
if(this.conditions!=null) {
for(String string : this.conditions.split("\n")) {
output[0] += "Message_" + this.index + "_" + string + "\n";
}
}
if(this.rewards!=null) {
for(String string : this.rewards.split("\n")) {
output[0] += "Message_" + this.index + "_" + string + "\n";
}
}

//Get English text
for(int i = 0; i < text.size(); i++) {
output[1] += "Message_" + this.index + "_Page_" + text.get(i);
}


return output;
}
}
41 changes: 39 additions & 2 deletions src/dialogueobject/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;

public class Response {
class Response {

String index;
String conditions;
Expand All @@ -21,7 +21,7 @@ public class Response {
List<Integer> messageIndexes = new ArrayList<Integer>();


Response() {
public Response() {

}

Expand Down Expand Up @@ -73,4 +73,41 @@ public List<Integer> getMessageIndexes() {
public void addMessageIndexes(int index) {
this.messageIndexes.add(index);
}

public String[] CompileResponse() {
//Asset.dat is 0, English.dat is 1
String output[] = new String[2];
output[0] = "";
output[1] = "";

//Get messages to show response for
if(this.messageIndexes.size()>0) {
output[0] += "Response_" + this.index + "_Messages " + this.messageIndexes.size() + "\n";
for(int i = 0; i < this.messageIndexes.size(); i++) {
output[0] += "Response_" + this.index + "_Message_" + i + " " + this.messageIndexes.get(i) + "\n";
}
}

//Get on click
if(this.dialogueID!=null)
output[0] += "Response_" + this.index + "_Dialogue " + this.dialogueID + "\n";
if(this.questID!=null)
output[0] += "Response_" + this.index + "_Quest " + this.questID + "\n";
if(this.vendorID!=null)
output[0] += "Response_" + this.index + "_Vendor " + this.vendorID + "\n";

//Get conditions and rewards
if(this.conditions!=null) {
for(String string : this.conditions.split("\n")) {
output[0] += "Response_" + this.index + "_" + string + "\n";
}
}
if(this.rewards!=null) {
for(String string : this.rewards.split("\n")) {
output[0] += "Response_" + this.index + "_" + string + "\n";
}
}

return output;
}
}
Loading

0 comments on commit 051550d

Please sign in to comment.