From 78216614df40f76fee03e1f186360f70f7a5601e Mon Sep 17 00:00:00 2001
From: Jacky720 <32578221+Jacky720@users.noreply.github.com>
Date: Thu, 26 Aug 2021 08:31:47 -0400
Subject: [PATCH 01/14] some ini function cleanup
---
main.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/main.js b/main.js
index dae8f74..bd20d21 100644
--- a/main.js
+++ b/main.js
@@ -751,18 +751,22 @@ function parseIniFromText(text) {
if (section === null) {
throw "Assignment outside of a section";
}
+
var eq = line.indexOf("=");
if (eq === -1) {
throw "Expected '='";
}
+
var lquot = line.indexOf('"');
if (lquot === -1) {
throw "Expected '\"'";
}
+
var rquot = line.slice(lquot + 1).indexOf('"') + lquot + 1;
if (rquot === -1) {
throw "Unterminated value string";
}
+
var value = line.slice(lquot + 1, rquot);
var key = line.slice(0, eq);
ini[section][key] = value;
@@ -821,7 +825,7 @@ function updatePersistentDataForm(iniobj) {
document.getElementById("ini-love").value = Number(iniobj.General.Love.trim());
if (iniobj.FFFFF) {
if (iniobj.FFFFF.F) {
- document.getElementById("ini-omega-flowey-trapped").checked = (Number(iniobj.FFFFF.F.trim()) === 1);
+ document.getElementById("ini-omega-flowey-trapped").checked = Number(iniobj.FFFFF.F.trim());
}
if (iniobj.FFFFF.P) {
updateSelection("ini-omega-flowey-soul", iniobj.FFFFF.P);
@@ -834,7 +838,7 @@ function updatePersistentDataForm(iniobj) {
}
if (iniobj.reset) {
if (iniobj.reset.s_key) {
- document.getElementById("ini-dodged-all-special-thanks").checked = (Number(iniobj.reset.s_key.trim()) === 1);
+ document.getElementById("ini-dodged-all-special-thanks").checked = Number(iniobj.reset.s_key.trim());
}
} else {
document.getElementById("ini-dodged-all-special-thanks").checked = false;
@@ -873,9 +877,7 @@ function updateIniFromForm(ini) {
if (!ini.FFFFF) {
ini.FFFFF = {};
}
- if (ini.FFFFF) {
- ini.FFFFF.D = timesDied;
- }
+ ini.FFFFF.D = timesDied;
}
if (document.getElementById("ini-dodged-all-special-thanks").checked) {
if (!ini.reset) {
From 7e10b7a03984baa4fb161303d37ecde3c34e4c5b Mon Sep 17 00:00:00 2001
From: Jacky720 <32578221+Jacky720@users.noreply.github.com>
Date: Thu, 26 Aug 2021 09:42:28 -0400
Subject: [PATCH 02/14] Add local function to simplify updateIniFromForm
---
main.js | 66 +++++++++++++++++++++++----------------------------------
1 file changed, 27 insertions(+), 39 deletions(-)
diff --git a/main.js b/main.js
index bd20d21..972f461 100644
--- a/main.js
+++ b/main.js
@@ -851,48 +851,36 @@ function updatePersistentDataForm(iniobj) {
// Update an ini object from the persistent data form.
function updateIniFromForm(ini) {
"use strict";
- ini.General.Name = document.getElementById("ini-name").value;
- ini.General.Room = document.getElementById("ini-location").value;
- ini.General.Kills = document.getElementById("ini-kills").value;
- ini.General.Love = document.getElementById("ini-love").value;
- if (document.getElementById("ini-omega-flowey-trapped").checked) {
- if (!ini.FFFFF) {
- ini.FFFFF = {};
- }
- ini.FFFFF.F = "1";
- } else {
- if (ini.FFFFF) {
- ini.FFFFF.F = "0";
- }
- }
- var upcomingSoul = Number(document.getElementById("ini-omega-flowey-soul").value);
- if (upcomingSoul) {
- if (!ini.FFFFF) {
- ini.FFFFF = {};
- }
- ini.FFFFF.P = upcomingSoul;
- }
- var timesDied = Number(document.getElementById("ini-omega-flowey-deaths").value);
- if (timesDied) {
- if (!ini.FFFFF) {
- ini.FFFFF = {};
- }
- ini.FFFFF.D = timesDied;
- }
- if (document.getElementById("ini-dodged-all-special-thanks").checked) {
- if (!ini.reset) {
- ini.reset = {};
+
+ function formItemToObj(section, key, id) {
+ var value = 0;
+ if (document.getElementById(id).type === "checkbox") {
+ value = Number(document.getElementById(id).checked);
+ } else {
+ value = Number(document.getElementById(id).value);
}
- ini.reset.s_key = "1";
- } else {
- if (ini.reset) {
- ini.reset.s_key = "0";
+
+ if (value) {
+ if (!ini[section]) {
+ ini[section] = {};
+ }
+ ini[section][key] = String(value);
+ } else {
+ if (ini[section]) {
+ ini[section][key] = "0";
+ }
}
}
- var fun = Number(document.getElementById("ini-fun").value);
- if (fun) {
- ini.General.fun = fun;
- }
+
+ formItemToObj("General", "Name", "ini-name");
+ formItemToObj("General", "Room", "ini-location");
+ formItemToObj("General", "Kills", "ini-kills");
+ formItemToObj("General", "Love", "ini-love");
+ formItemToObj("General", "fun", "ini-fun");
+ formItemToObj("FFFFF", "F", "ini-omega-flowey-trapped");
+ formItemToObj("FFFFF", "P", "ini-omega-flowey-soul");
+ formItemToObj("FFFFF", "D", "ini-omega-flowey-deaths");
+ formItemToObj("reset", "s_key", "ini-dodged-all-special-thanks");
}
function updateSelection(id, value, newChoiceArray) {
From 7e7bebe3373dd2faeb8eac4041106349e0fa7176 Mon Sep 17 00:00:00 2001
From: Jacky720 <32578221+Jacky720@users.noreply.github.com>
Date: Fri, 5 Nov 2021 10:19:50 -0400
Subject: [PATCH 03/14] Add boxes, keys, file8
Not functional yet. Working on #11, #34, and #74.
---
index.html | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/index.html b/index.html
index e047eb1..27f4a53 100644
--- a/index.html
+++ b/index.html
@@ -160,6 +160,9 @@
Persistent Data (undertale.ini)
>Trapped in Flowey's World
+
@@ -407,6 +410,78 @@
SAVE Data (file0)
+
+
+
+
+
+