diff --git a/src/ChildBehaviorHelper.cs b/src/ChildBehaviorHelper.cs
new file mode 100644
index 0000000..3a77f74
--- /dev/null
+++ b/src/ChildBehaviorHelper.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Zyrenth.Zora
+{
+ ///
+ /// Various helper functions for use with the child's behavior
+ ///
+ public static class ChildBehaviorHelper
+ {
+ ///
+ /// Gets the value of the child's behavior based on reponses to questions asked
+ ///
+ /// The name of the child
+ /// The region of the game
+ ///
+ public static byte GetValue(string name, GameRegion region)
+ {
+ Encoding encoding = region.GetEncoding();
+ byte[] bytes = encoding.GetBytes(name);
+ int value = 0;
+
+ foreach (byte a in bytes)
+ {
+ value += ( a & 0xF );
+ }
+
+ do { value -= 3; } while (value > -1);
+ return (byte)( value + 4 );
+ }
+
+
+ ///
+ /// Gets the value of the child's behavior based on reponses to questions asked
+ ///
+ /// The name of the child
+ /// The region of the game
+ /// The number of rupees given
+ /// The method used to help the child sleep
+ ///
+ public static byte GetValue(string name, GameRegion region, RupeesGiven rupeesGiven, SleepMethod sleepMethod)
+ {
+ return (byte)( GetValue(name, region) + (int)rupeesGiven + (int)sleepMethod );
+ }
+
+ ///
+ /// Gets the value of the child's behavior based on reponses to questions asked
+ ///
+ /// The name of the child
+ /// The region of the game
+ /// The number of rupees given
+ /// The method used to help the child sleep
+ /// The response to the child's question
+ /// Kind of child the player was
+ ///
+ public static byte GetValue(string name, GameRegion region, RupeesGiven rupeesGiven, SleepMethod sleepMethod, ChildQuestion childsQuestion, KindOfChild kindOfChild)
+ {
+ return (byte)( GetValue(name, region, rupeesGiven, sleepMethod) + (int)childsQuestion + (int)kindOfChild);
+ }
+
+ ///
+ /// Gets the child's behavior based on the byte value supplied
+ ///
+ /// The raw behavior value
+ ///
+ public static ChildBehavior GetPersonality(byte value)
+ {
+ if (value == 0) return ChildBehavior.None;
+ if (value < 6) return ChildBehavior.Curious;
+ if (value < 11) return ChildBehavior.Shy;
+ return ChildBehavior.Hyperactive;
+ }
+ }
+}
diff --git a/src/Enums.cs b/src/Enums.cs
index bf02a69..5967fa6 100644
--- a/src/Enums.cs
+++ b/src/Enums.cs
@@ -217,4 +217,73 @@ public enum Rings : long
[RingInfo("Protection Ring", "Damage taken is always one Heart")]
ProtectionRing = unchecked((long)0x8000000000000000L)
}
+
+ ///
+ /// The calculated behavior of the child
+ ///
+ public enum ChildBehavior
+ {
+ None,
+ Curious,
+ Shy,
+ Hyperactive
+ }
+
+ ///
+ /// The number of rupees given to Blossom
+ ///
+ public enum RupeesGiven
+ {
+ ///
+ /// 1 Rupee
+ ///
+ _1 = 0,
+ ///
+ /// 10 Rupees
+ ///
+ _10 = 2,
+ ///
+ /// 50 Rupees
+ ///
+ _50 = 5,
+ ///
+ /// 150 Rupees
+ ///
+ _150 = 8
+ }
+
+ ///
+ /// How Blossom should help the child go to sleep
+ ///
+ public enum SleepMethod
+ {
+ Sing = 0,
+ Play = 10,
+ }
+
+ ///
+ /// Response to question about what kind of child the player was
+ ///
+ public enum KindOfChild
+ {
+ None = 0,
+ Weird = 1,
+ Quiet = 5,
+ Hyperactive = 8,
+ }
+
+ ///
+ /// Response to the child's question
+ ///
+ public enum ChildQuestion
+ {
+ ///
+ /// Either No or Egg, depending on the question asked
+ ///
+ NoOrEgg = 0,
+ ///
+ /// Either Yes or Chicken, depending on the question asked
+ ///
+ YesOrChicken = 4,
+ }
}
diff --git a/src/Extensions.cs b/src/Extensions.cs
index d8b14d2..9189e72 100644
--- a/src/Extensions.cs
+++ b/src/Extensions.cs
@@ -82,5 +82,21 @@ internal static string ReversedSubstring(this string value, int start, int lengt
return val;
}
+ ///
+ /// Gets the associated with the specified
+ ///
+ /// The region of the game
+ ///
+ public static Encoding GetEncoding(this GameRegion region)
+ {
+ if (region == GameRegion.US)
+ {
+ return new USEncoding();
+ }
+ else
+ {
+ return new JapaneseEncoding();
+ }
+ }
}
}
diff --git a/src/ZoraSharp.csproj b/src/ZoraSharp.csproj
index fca7874..8442918 100644
--- a/src/ZoraSharp.csproj
+++ b/src/ZoraSharp.csproj
@@ -1,4 +1,4 @@
-
+
Debug
@@ -52,6 +52,7 @@
+
@@ -65,4 +66,4 @@
-
+
\ No newline at end of file