Skip to content

EA 23.96 Nyaightly

February 26, 2025

28 files modified.

Important Changes

Possible breaking changes. Click the filename to view the chunk.

GamePrincipal (6)

cs
public int GetGrade(int score) 
cs
public string GetTitle() 
cs
public int GetScore() 
public List<Item> ListItems() 
cs
public int GetScore(string s) 
cs
public int GetValidScore() 
cs
public void Apply() 

LayerWorldSetting (2)

cs
public void Refresh() 
public void RefreshTemplate() 
cs
public void RefreshScore() 
public void StartGame() 

UICharaMaker (1)

cs
public void ListDifficulties() 

AI_Torture

@@ -87,7 +87,7 @@ public override void OnCancelOrSuccess()

cs
	{
		return;
	}
	owner.AddCondition<ConInvulnerable>(); 
	_owner.AddCondition<ConInvulnerable>(); 
	foreach (Chara chara in EClass._map.charas)
	{
		if (chara != _owner && (chara.enemy == _owner || chara.enemy == _owner.parasite || chara.enemy == _owner.ride))

AM_Adv

@@ -861,7 +861,7 @@ public override void _OnUpdateInput()

cs
		break;
	}
	case EAction.QuickSave:
		if (EClass.debug.enable || EClass.game.Difficulty.allowManualSave) 
		if (EClass.debug.enable || !EClass.game.principal.disableManualSave) 
		{
			if (!EClass.pc.HasNoGoal)
			{

@@ -875,7 +875,7 @@ public override void _OnUpdateInput()

cs
		break;
	case EAction.QuickLoad:
	{
		if (!EClass.debug.enable && !EClass.game.Difficulty.allowManualSave) 
		if (!EClass.debug.enable && EClass.game.principal.disableManualSave) 
		{
			SE.Beep();
			break;

ActEffect

@@ -2172,7 +2172,7 @@ public static void LoveMiracle(Chara tc, Chara c, int power)

cs
		tc.Say("love_chara", c, tc);
	}
	tc.ModAffinity(EClass.pc, power / 4);
	if (EClass.rnd(2) != 0) 
	if (EClass.rnd(2) != 0 && (!EClass._zone.IsUserZone || tc.IsPCFaction || !EClass.game.principal.disableUsermapBenefit)) 
	{
		if (EClass.rnd(2) == 0)
		{

@@ -2274,6 +2274,7 @@ public static bool Wish(string s, string name, int power, BlessedState state)

cs
				}
				Thing thing = ThingGen.Create(r.id, -1, wishLv);
				int num = 1;
				bool flag2 = thing.trait is TraitDeed || thing.rarity >= Rarity.Artifact || thing.source._origin == "artifact_summon"; 
				switch (thing.id)
				{
				case "rod_wish":

@@ -2291,30 +2292,24 @@ public static bool Wish(string s, string name, int power, BlessedState state)

cs
				case "medal":
					num = EClass.rndHalf(wishValue / 3000 + 4);
					break;
				} 
				if (num < 1) 
				{ 
					num = 1; 
				} 
				if (num == 1 && thing.trait.CanStack) 
				{ 
					int num2 = wishValue; 
					int price = thing.GetPrice(); 
					for (int i = 0; i < 1000; i++) 
				default: 
					if (!flag2 && thing.trait.CanStack) 
					{
						int num3 = price + 500 + i * Mathf.Max(price, 200); 
						if (num2 > num3) 
						int num2 = wishValue; 
						int price = thing.GetPrice(); 
						for (int i = 0; i < 1000; i++) 
						{
							num++; 
							num2 -= num3; 
							int num3 = price + 500 + i * Mathf.Max(price, 200); 
							if (num2 > num3) 
							{ 
								num++; 
								num2 -= num3; 
							} 
						}
					}
					break; 
				}
				if (thing.trait is TraitDeed) 
				{ 
					num = 1; 
				} 
				if (thing.source._origin == "artifact_summon") 
				if (num < 1) 
				{
					num = 1;
				}

ActMelee

@@ -146,6 +146,7 @@ public bool Attack(float dmgMulti = 1f, bool maxRoll = false)

cs
	void _Attack(BodySlot slot)
	{
		Act.TC = orgTC;
		Act.TP = orgPos; 
		Thing w;
		int splash;
		int chaser;

@@ -163,7 +164,7 @@ void _Attack(BodySlot slot)

cs
				}
				w = slot.thing;
			}
			int num = ((w == null) ? 1 : (w.Evalue(666) + 1)); 
			int num = 1 + Mathf.Max(Act.CC.Evalue(666), (w != null) ? w.Evalue(666) : 0); 
			if (dist <= 1 || dist <= num)
			{
				if (w != null)

BaseListPeople

@@ -287,25 +287,7 @@ public override void OnClick(Chara c, ItemGeneral i)

cs
				}
			});
		});
		if (c == EClass.pc) 
		{ 
			if (EClass.game.Difficulty.tier > 0) 
			{ 
				uIContextMenu.AddButton("changeDifficulty", delegate
				{ 
					Dialog.YesNo("dialog_changeDifficulty".lang(EClass.game.Difficulty.Name), delegate
					{ 
						SE.Play("mutation"); 
						if (!EClass.game.Difficulty.allowRevive) 
						{ 
							EClass.pc.SetFeat(1220, 0); 
						} 
						EClass.game.idDifficulty--; 
					}); 
				}); 
			} 
		} 
		else
		if (c != EClass.pc) 
		{
			if (c.sourceCard.idActor.IsEmpty() && c.host == null)
			{

Card

@@ -2772,6 +2772,10 @@ public void AddExp(int a)

cs
		if (IsPCFaction)
		{
			a = a * Mathf.Clamp(100 + Chara.affinity.value / 10, 50, 200) / 100;
			if (EClass.game.principal.petFeatExp) 
			{ 
				a = a * (50 + EClass.game.principal.petFeatExpMtp * 50) / 100; 
			} 
		}
	}
	a = a * (100 + Evalue(1237) * 30) / 100;

@@ -4651,7 +4655,7 @@ public void SpawnLoot(Card origin)

cs
		}
		list.Add(thing3);
	}
	if (!IsPCFaction && chance(200)) 
	if (!IsPCFaction && (!isUserZone || !EClass.game.principal.disableUsermapBenefit) && chance(200)) 
	{
		list.Add(Chara.MakeGene());
	}

@@ -4715,6 +4719,10 @@ public void SpawnLoot(Card origin)

cs
			{
				num5 += 2;
			}
			if (num5 > 0 && EClass.game.principal.dropRate) 
			{ 
				num5 = Mathf.Max(1, num5 * (50 + EClass.game.principal.dropRateMtp * 50) / 100); 
			} 
			List<Thing> list2 = new List<Thing>();
			foreach (Thing thing4 in things)
			{

Chara

@@ -498,7 +498,7 @@ public string IDPCCBodySet

cs

	public string NameBraced => GetName(NameStyle.Full);

	public string NameTitled => ((EClass.game.idDifficulty == 0) ? "" : ((EClass.game.idDifficulty == 1) ? "☆" : "★")) + NameBraced; 
	public string NameTitled => (EClass.game.principal.permadeath ? "★" : "") + NameBraced; 

	public override string actorPrefab
	{

@@ -4615,7 +4615,7 @@ public void Revive(Point p = null, bool msg = false)

cs
		{
			Msg.Say("noDeathPenalty2", this);
		}
		else if (EClass.player.stats.days <= 90 && !EClass.debug.enable) 
		else if (EClass.player.stats.days <= 90 && !EClass.game.principal.disableDeathPenaltyProtection) 
		{
			Msg.Say("noDeathPenalty", this);
		}

CharaBody

@@ -409,7 +409,7 @@ public int GetAttackIndex(Thing t)

cs

	public int GetMeleeDistance()
	{
		int num = 0; 
		int num = owner.Evalue(666); 
		foreach (BodySlot slot in slots)
		{
			if (slot.elementId == 35 && slot.thing != null && slot.thing.Evalue(666) > num)

CoreDebug

@@ -237,8 +237,6 @@ public class DebugCommand

cs

	public bool allStory;

	public bool skipInitialQuest; 

	[Header("Log")]
	public bool logAdv;

@@ -355,8 +353,6 @@ public void QuickStart()

cs
		break;
	}
	EClass.game.StartNewGame();
	EClass.game.principal = IO.DeepCopy(EClass.setting.start.principals[0]); 
	EClass.player.validScore = -1; 
	EClass.player.flags.OnEnableDebug();
	EClass.player.pref.lastIdTabAbility = 3;
	Zone homeZone = EClass.game.spatials.Find(EClass.game.Prologue.idStartZone);

@@ -2007,6 +2003,17 @@ public static string ResetPetUpgrades()

cs
		return "Not Implemented.";
	}

	[ConsoleCommand("")] 
	public static string ResetPrincipalSeals() 
	{ 
		if (!CheatEnabled()) 
		{ 
			return EnableCheat; 
		} 
		EClass.game.principal.modified.Clear(); 
		return "Done."; 
	} 

	[ConsoleCommand("")]
	public static string GodMode()
	{

FACTION

@@ -398,7 +398,7 @@ public void OnAdvanceMonth()

cs
	Msg.Say("getBill", Lang._currency(num, "money"));
	TryPayBill(thing2);
	Msg.Say("bills", EClass.player.taxBills.ToString() ?? "");
	if (EClass.player.taxBills >= 4 && !EClass.debug.godMode) 
	if (EClass.player.taxBills >= 4 && EClass.game.principal.tax && !EClass.debug.godMode) 
	{
		EClass.player.ModKarma(-50);
	}

Game

@@ -256,8 +256,6 @@ private void _OnDeserialized(StreamingContext context)

cs

	public Prologue Prologue => EClass.setting.start.prologues[idPrologue];

	public GameDifficultySetting Difficulty => EClass.setting.start.difficulties[idDifficulty]; 

	public bool UseGrid => EClass.core.config.game.useGrid;

	public bool altUI => EClass.core.config.game.altUI;

@@ -464,10 +462,18 @@ public void OnLoad()

cs
		}
	}
	TryAddQuest("into_darkness", "exile_kettle");
	if (version.IsBelow(0, 23, 94)) 
	if (version.IsBelow(0, 23, 96)) 
	{
		EClass.game.principal = IO.DeepCopy(EClass.setting.start.principals[0]);
		player.validScore = -1; 
		player.resetPrincipal = true; 
		GameDifficultySetting gameDifficultySetting = EClass.setting.start.difficulties[idDifficulty]; 
		EClass.game.principal.id = -1; 
		EClass.game.principal.permadeath = gameDifficultySetting.deleteGameOnDeath; 
		EClass.game.principal.disableManualSave = !gameDifficultySetting.allowManualSave; 
		EClass.core.actionsNextFrame.Add(delegate
		{ 
			EClass.ui.AddLayer<LayerWorldSetting>(); 
		}); 
	}
	if (version.IsBelow(0, 23, 93))
	{

@@ -717,6 +723,8 @@ public void OnGameInstantiated()

cs

	public void _Create()
	{
		principal = IO.DeepCopy(EClass.setting.start.principals[0]); 
		idDifficulty = 1; 
		config.snapFreePos = (config.slope = (config.autoWall = true));
		config.autoCombat.abortOnAllyDead = true;
		config.autoCombat.abortOnHalfHP = true;

@@ -725,7 +733,6 @@ public void _Create()

cs
	config.autoCombat.bDontChangeTarget = true;
	config.autoCombat.abortOnKill = true;
	config.autoCombat.abortOnItemLoss = true;
	idDifficulty = 1; 
	seed = EClass.rnd(10000);
	Debug.Log("creating game: " + id + " seed:" + seed);
	uniforms.Import();

GameIndex

@@ -14,8 +14,6 @@ public class GameIndex : EClass

cs

	public string color;

	public int difficulty; 

	public int days;

	public int deepest;

@@ -42,6 +40,8 @@ public class GameIndex : EClass

cs

	public bool cloud;

	public bool permaDeath; 

	public Dictionary<string, string> fallbackTypes = new Dictionary<string, string>();

	[JsonIgnore]

@@ -75,8 +75,8 @@ public GameIndex Create(Game game)

cs
		zoneName = game.player.zone.Name;
		pcName = EClass.pc.c_altName;
		aka = EClass.pc.Aka;
		permaDeath = game.principal.permadeath; 
		date = game.world.date.Copy();
		difficulty = game.idDifficulty; 
		idPortrait = EClass.pc.c_idPortrait;
		idRace = EClass.pc.race.id;
		idJob = EClass.pc.job.id;

GamePrincipal

@@ -1,12 +1,114 @@

cs
using System;
using System.Collections.Generic; 
using Newtonsoft.Json;
using UnityEngine; 

[Serializable]
public class GamePrincipal : EClass
{
	public enum Type
	{ 
		Oath, 
		Workaround
	} 

	public class Item
	{ 
		public string id; 

		public Type type; 

		public Func<bool> _get; 

		public Action<bool> _set; 

		public int grade; 

		public bool IsEmbark
		{ 
			get
			{ 
				if (EClass.core.IsGameStarted) 
				{ 
					return EClass.player.resetPrincipal; 
				} 
				return true; 
			} 
		} 

		public bool Get() 
		{ 
			return _get(); 
		} 

		public void Set(bool value) 
		{ 
			_set(value); 
		} 

		public bool IsModified() 
		{ 
			return Get() != EClass.game.principal.GetField<bool>(id); 
		} 

		public bool WasSealed() 
		{ 
			if (EClass.game.principal.modified.Contains(id) || IsEmbark) 
			{ 
				return false; 
			} 
			bool num = type == Type.Oath; 
			bool field = EClass.game.principal.GetField<bool>(id); 
			if (num) 
			{ 
				return field; 
			} 
			return !field; 
		} 

		public bool IsSealed() 
		{ 
			if (EClass.game.principal.modified.Contains(id)) 
			{ 
				return false; 
			} 
			bool num = type == Type.Oath; 
			bool flag = Get(); 
			bool flag2 = (IsEmbark ? flag : EClass.game.principal.GetField<bool>(id)); 
			if (num) 
			{ 
				return flag2 && flag; 
			} 
			if (!flag2) 
			{ 
				return !flag; 
			} 
			return false; 
		} 
	} 

	public class ItemSlider : Item
	{ 
		public int max; 

		public Func<int> _getInt; 

		public Action<int> _setInt; 

		public Func<int, string> funcText; 

		public int GetInt() 
		{ 
			return _getInt(); 
		} 

		public void SetInt(int value) 
		{ 
			_setInt(value); 
		} 
	} 

	[JsonProperty]
	public int idTemplate; 
	public int id; 

	[JsonProperty]
	public int socre;

@@ -14,6 +116,9 @@ public class GamePrincipal : EClass

cs
	[JsonProperty]
	public int dropRateMtp;

	[JsonProperty] 
	public int petFeatExpMtp; 

	[JsonProperty]
	public bool ignoreEvaluate;

@@ -41,101 +146,66 @@ public class GamePrincipal : EClass

cs
	[JsonProperty]
	public bool dropRate;

	public bool IsCustom => idTemplate == -1; 
	[JsonProperty] 
	public bool petFeatExp; 

	public int GetGrade(int score) 
	{ 
		return Mathf.Clamp(score / 20, 0, 5); 
	} 
	[JsonProperty] 
	public HashSet<string> modified = new HashSet<string>(); 

	public string GetTitle() 
	{ 
		int grade = GetGrade(GetScore()); 
		return Lang.GetList("pp_titles")[grade]; 
	} 
	public bool IsCustom => id == -1; 

	public int GetScore() 
	public List<Item> ListItems() 
	{
		if (ignoreEvaluate) 
		{ 
			return 0; 
		} 
		int num = 0; 
		if (tax) 
		{ 
			num += GetScore("tax"); 
		} 
		if (disableManualSave) 
		List<Item> list = new List<Item>(); 
		Add(1, Type.Oath, "disableManualSave", () => disableManualSave, delegate(bool a) 
		{
			num += GetScore("disableManualSave"); 
		} 
		if (disableDeathPenaltyProtection) 
			disableManualSave = a; 
		}); 
		Add(1, Type.Oath, "disableDeathPenaltyProtection", () => disableDeathPenaltyProtection, delegate(bool a) 
		{
			num += GetScore("disableDeathPenaltyProtection"); 
		} 
		if (disableUsermapBenefit) 
			disableDeathPenaltyProtection = a; 
		}); 
		Add(1, Type.Oath, "disableUsermapBenefit", () => disableUsermapBenefit, delegate(bool a) 
		{
			num += GetScore("disableUsermapBenefit"); 
		} 
		if (permadeath) 
			disableUsermapBenefit = a; 
		}); 
		Add(3, Type.Oath, "permadeath", () => permadeath, delegate(bool a) 
		{
			num += GetScore("permadeath"); 
		} 
		if (infiniteMarketFund) 
			permadeath = a; 
		}); 
		AddSlider(2, Type.Workaround, "dropRate", () => dropRate, delegate(bool a) 
		{
			num += GetScore("infiniteMarketFund"); 
		} 
		if (opMilk) 
			dropRate = a; 
		}, () => dropRateMtp, delegate(int a) 
		{
			num += GetScore("opMilk"); 
		} 
		if (dropRate) 
			dropRateMtp = a; 
		}, (int a) => 0.5f + 0.5f * (float)a + "x", 5); 
		return list; 
		void Add(int grade, Type type, string id, Func<bool> _get, Action<bool> _set) 
		{
			num += GetScore("dropRate"); 
		} 
		if (num >= 0) 
		{ 
			return num; 
		} 
		return 0; 
	} 

	public int GetScore(string s) 
	{ 
		if (ignoreEvaluate) 
		{ 
			return 0; 
			list.Add(new Item
			{ 
				type = type, 
				grade = grade, 
				id = id, 
				_get = _get, 
				_set = _set 
			}); 
		}
		return s switch
		{ 
			"tax" => 20,  
			"disableManualSave" => 20,  
			"disableDeathPenaltyProtection" => 10,  
			"disableUsermapBenefit" => 20,  
			"permadeath" => 50,  
			"infiniteMarketFund" => -40,  
			"opMilk" => -40,  
			"dropRate" => 20 + dropRateMtp * -10,  
			_ => 0,  
		}; 
	} 

	public int GetValidScore() 
	{ 
		int score = GetScore(); 
		if (EClass.player.validScore != -1) 
		void AddSlider(int grade, Type type, string id, Func<bool> _get, Action<bool> _set, Func<int> _getInt, Action<int> _setInt, Func<int, string> funcText, int max) 
		{
			if (score >= EClass.player.validScore) 
			list.Add(new ItemSlider
			{
				return EClass.player.validScore; 
			} 
			return score; 
				type = type, 
				grade = grade, 
				id = id, 
				_get = _get, 
				_set = _set, 
				_getInt = _getInt, 
				_setInt = _setInt, 
				funcText = funcText, 
				max = max 
			}); 
		}
		return score; 
	} 

	public void Apply() 
	{ 
		EClass.player.validScore = GetScore(); 
	}
}

GrowSystem

@@ -573,6 +573,10 @@ public Thing TryPopSeed(Chara c)

cs
		{
			num /= 5;
		}
		if (EClass._zone.IsUserZone && EClass.game.principal.disableUsermapBenefit) 
		{ 
			return null; 
		} 
		if (EClass.player.isAutoFarming || EClass.rnd(num) < EClass.rnd(source.chance))
		{
			Thing thing = TraitSeed.MakeSeed(source, EClass._map.TryGetPlant(cell));

GrowSystemTree

@@ -170,7 +170,7 @@ public override void OnMineObj(Chara c = null)

cs
		TryPick(GrowSystem.cell, IsPalulu ? "leaf_palulu" : "bark", -1, 1 + PlantBonus() / 2);
		TryPick(GrowSystem.cell, "log", id, 1 + EClass.rnd(3) + PlantBonus(), applySeed: true);
		TryPick(GrowSystem.cell, "resin", -1, 1 + PlantBonus() / 2);
		if (!EClass.player.isAutoFarming) 
		if ((!EClass._zone.IsUserZone || !EClass.game.principal.disableUsermapBenefit) && !EClass.player.isAutoFarming) 
		{
			if (EClass.rnd(500) == 0)
			{

@@ -185,7 +185,7 @@ public override void OnMineObj(Chara c = null)

cs
	}
	TryPick(GrowSystem.cell, "bark", -1, EClass.rnd(3) + PlantBonus());
	TryPick(GrowSystem.cell, "resin", -1, 1 + PlantBonus() / 2);
	if (!EClass.player.isAutoFarming) 
	if ((!EClass._zone.IsUserZone || !EClass.game.principal.disableUsermapBenefit) && !EClass.player.isAutoFarming) 
	{
		TryPick(GrowSystem.cell, TraitSeed.MakeSeed(GrowSystem.cell.sourceObj, plant).SetNum(1 + EClass.rnd(3)), c);
		if (EClass.rnd(100) == 0)

HotItemContext

@@ -137,7 +137,7 @@ public static void Show(string id, Vector3 pos)

cs
				EClass.ui.AddLayer<LayerHoard>();
			});
			i.AddSeparator();
			if (EClass.game.Difficulty.allowManualSave || EClass.debug.enable) 
			if (!EClass.game.principal.disableManualSave || EClass.debug.enable) 
			{
				i.AddButton("save", delegate
				{

InvOwner

@@ -1447,7 +1447,7 @@ public ListInteraction ListInteractions(ButtonGrid b, bool context)

cs
					t.ShowSplitMenu(b, (HasTrader && currency != 0 && !owner.IsPC) ? new Transaction(b) : null);
				});
			}
			if (owner.IsPC && AllowDrop(t)) 
			if (owner.IsPC) 
			{
				flag4 = true;
				listInteraction.Add(t.c_isImportant ? "important_off" : "important_on", 299, delegate

@@ -1456,7 +1456,7 @@ public ListInteraction ListInteractions(ButtonGrid b, bool context)

cs
					LayerInventory.SetDirty(t);
					SE.ClickOk();
				});
				if (!EClass._zone.IsRegion) 
				if (AllowDrop(t)) 
				{
					listInteraction.Add(flag ? "dragForget" : "actDrop", 300, delegate
					{

LayerEditBio

@@ -12,8 +12,6 @@ public class LayerEditBio : ELayer

cs

	public Image imageBG;

	private bool started; 

	public override void OnAfterAddLayer()
	{
		if (ELayer.game == null)

@@ -42,35 +40,9 @@ public void SetChara(Chara c, UnityAction _onKill = null)

cs

	public void OnClickStart()
	{
		if (!ELayer.game.Difficulty.allowManualSave) 
		{ 
			Dialog.YesNo("dialog_warnManualSave".lang(ELayer.game.Difficulty.Name), delegate
			{ 
				Start(); 
			}); 
		} 
		else
		{ 
			Start(); 
		} 
		void Start() 
		if (!ELayer.ui.GetLayer<LayerWorldSetting>()) 
		{
			if (!started) 
			{ 
				started = true; 
				if (!ELayer.debug.skipInitialQuest) 
				{ 
					if (!LayerDrama.Instance) 
					{ 
						LayerDrama.ActivateMain("mono", "1-1"); 
					} 
					else
					{ 
						LayerTitle.KillActor(); 
						ELayer.game.StartNewGame(); 
					} 
				} 
			} 
			ELayer.ui.AddLayer<LayerWorldSetting>(); 
		}
	}

LayerLoadGame

@@ -123,7 +123,7 @@ public void RefreshList()

cs
			string s = a.Title + ((ELayer.core.IsGameStarted && a.id == Game.id) ? "currentSave".lang() : "") + Environment.NewLine;
			b.mainText.SetText(s, c);
			b.subText.SetText(a.RealDate ?? "");
			b.subText2.SetText(((a.difficulty == 2) ? "★" : ((a.difficulty == 1) ? "☆" : "")) + a.pcName + " (" + a.zoneName + ")", c); 
			b.subText2.SetText((a.permaDeath ? "★" : "") + a.pcName + " (" + a.zoneName + ")", c); 
			b.GetComponent<UIItem>().text1.SetText(a.version.GetText() + (cloud ? (" " + "isCloud".lang()) : ""));
		},
		onClick = delegate(GameIndex a, UIButton b)

LayerWorldSetting

@@ -1,4 +1,5 @@

cs
using System.Collections.Generic;
using System.Linq; 
using UnityEngine;
using UnityEngine.UI;

@@ -8,6 +9,8 @@ public class LayerWorldSetting : ELayer

cs

	public List<UIButton> buttonTemplates;

	public GamePrincipal pp; 

	public UIButton toggleEvaluate;

	public UIButton toggleDeathPenaltyProtection;

@@ -32,16 +35,54 @@ public class LayerWorldSetting : ELayer

cs

	public UIText textValidScore;

	public UIText textDetail; 

	public UISlider sliderDropRate;

	public Image imageScoreBar;

	public GamePrincipal pp => ELayer.game.principal; 
	public UIButton moldToggle; 

	public UIButton moldSlider; 

	public UIButton buttonEmbark; 

	public UIButton buttonWorkaround; 

	public UIItem moldHeader; 

	public Transform transCustom; 

	public Transform transMold; 

	public List<Sprite> sprites; 

	private bool started; 

	public int IdxCustom => 3;

	public bool IsEmbark 
	{ 
		get 
		{ 
			if (ELayer.core.IsGameStarted) 
			{ 
				return ELayer.player.resetPrincipal; 
			} 
			return true; 
		} 
	} 

	public override void OnInit()
	{
		buttonEmbark.SetActive(IsEmbark); 
		buttonWorkaround.SetActive(!IsEmbark); 
		if (IsEmbark) 
		{ 
			ELayer.game.principal.modified.Clear(); 
		} 
		pp = IO.DeepCopy(ELayer.game.principal); 
		transMold.SetActive(enable: false); 
		for (int j = 0; j < buttonTemplates.Count; j++)
		{
			int i = j;

@@ -56,24 +97,29 @@ public override void OnInit()

cs
				SetTemplate(i);
			});
		}
		buttonWorkaround.SetToggle(ELayer.player.showWorkaround, delegate(bool a) 
		{ 
			ELayer.player.showWorkaround = a; 
			Refresh(); 
		}); 
		Refresh();
	}

	public void SetTemplate(int idx)
	{
		pp.idTemplate = idx; 
		pp.id = idx; 
		if (idx == IdxCustom)
		{
			pp.idTemplate = -1; 
			pp.id = -1; 
		}
		else
		{
			ELayer.game.principal = IO.DeepCopy(ELayer.setting.start.principals[idx]); 
			pp = IO.DeepCopy(ELayer.setting.start.principals[idx]); 
		}
		Refresh();
	}

	public void Refresh() 
	public void RefreshTemplate() 
	{
		if (pp.IsCustom)
		{

@@ -81,76 +127,107 @@ public void Refresh()

cs
		}
		else
		{
			groupTemplate.Select(pp.idTemplate); 
			groupTemplate.Select(pp.id); 
		}
		toggleEvaluate.SetToggleWithScore(pp.ignoreEvaluate, delegate(bool a) 
		{ 
			Toggle(ref pp.ignoreEvaluate, a); 
			Refresh(); 
		}, 0); 
		toggleTax.SetToggleWithScore(pp.tax, delegate(bool a) 
		{ 
			Toggle(ref pp.tax, a); 
		}, pp.GetScore("tax")); 
		toggleDeathPenaltyProtection.SetToggleWithScore(pp.disableDeathPenaltyProtection, delegate(bool a) 
		{ 
			Toggle(ref pp.disableDeathPenaltyProtection, a); 
		}, pp.GetScore("disableDeathPenaltyProtection")); 
		toggleManualSave.SetToggleWithScore(pp.disableManualSave, delegate(bool a) 
		{ 
			Toggle(ref pp.disableManualSave, a); 
		}, pp.GetScore("disableManualSave")); 
		toggleUsermapBenefit.SetToggleWithScore(pp.disableUsermapBenefit, delegate(bool a) 
		{ 
			Toggle(ref pp.disableUsermapBenefit, a); 
		}, pp.GetScore("disableUsermapBenefit")); 
		toggleDropRate.SetToggleWithScore(pp.dropRate, delegate(bool a) 
		{ 
			Toggle(ref pp.dropRate, a); 
		}, pp.GetScore("dropRate")); 
		togglePermadeath.SetToggleWithScore(pp.permadeath, delegate(bool a) 
		{ 
			Toggle(ref pp.permadeath, a); 
		}, pp.GetScore("permadeath")); 
		toggleInfiniteMarketFund.SetToggleWithScore(pp.infiniteMarketFund, delegate(bool a) 
		{ 
			Toggle(ref pp.infiniteMarketFund, a); 
		}, pp.GetScore("infiniteMarketFund")); 
		toggleOPMilk.SetToggleWithScore(pp.opMilk, delegate(bool a) 
		{ 
			Toggle(ref pp.opMilk, a); 
		}, pp.GetScore("opMilk")); 
		sliderDropRate.SetSlider(pp.dropRateMtp, (float a) => (float)(int)a * 0.5f + "x", 0, 10, notify: false); 
		sliderDropRate.onValueChanged.RemoveAllListeners(); 
		sliderDropRate.onValueChanged.AddListener(delegate(float a) 
		textDetail.SetText(("vow_" + pp.id).lang()); 
	} 

	public void Refresh() 
	{ 
		RefreshTemplate(); 
		transCustom.DestroyChildren(); 
		List<GamePrincipal.Item> items = pp.ListItems(); 
		AddCategory(GamePrincipal.Type.Oath); 
		if (!IsEmbark && ELayer.player.showWorkaround) 
		{
			pp.dropRateMtp = (int)a; 
			Refresh(); 
		}); 
		RefreshScore(); 
		void Toggle(ref bool flag, bool on) 
			AddCategory(GamePrincipal.Type.Workaround); 
		} 
		transCustom.RebuildLayout(); 
		void AddCategory(GamePrincipal.Type type) 
		{
			flag = on; 
			if (!pp.IsCustom) 
			Util.Instantiate(moldHeader, transCustom).text1.SetText(("pp_" + type).lang()); 
			foreach (GamePrincipal.Item item in items.Where((GamePrincipal.Item a) => a.type == type)) 
			{
				pp.idTemplate = -1; 
				groupTemplate.Select(buttonTemplates.LastItem()); 
				UIButton b = null; 
				GamePrincipal.ItemSlider itemSlider = item as GamePrincipal.ItemSlider; 
				if (itemSlider == null) 
				{ 
					if (item != null) 
					{ 
						_ = item; 
						b = Util.Instantiate(moldToggle, transCustom); 
					} 
				} 
				else
				{ 
					b = Util.Instantiate(moldSlider, transCustom); 
					b.GetComponentInChildren<UISlider>().SetSlider(itemSlider.GetInt(), delegate(float a) 
					{ 
						itemSlider.SetInt((int)a); 
						return itemSlider.funcText((int)a); 
					}, 0, itemSlider.max, notify: false); 
				} 
				bool flag = item.id == "permadeath" && !IsEmbark && !item.WasSealed(); 
				b.mainText.SetText(("pp_" + item.id).lang()); 
				b.icon.SetActive(item.IsSealed() || item.WasSealed()); 
				b.icon.SetAlpha(item.IsSealed() ? 1f : 0.3f); 
				b.icon.sprite = sprites[item.grade]; 
				b.icon.SetNativeSize(); 
				b.GetOrCreate<CanvasGroup>().alpha = (flag ? 0.5f : 1f); 
				b.interactable = !flag; 
				b.SetToggle(item.Get(), delegate(bool a) 
				{ 
					item.Set(a); 
					if (!pp.IsCustom) 
					{ 
						pp.id = -1; 
						RefreshTemplate(); 
					} 
					b.icon.SetActive(item.IsSealed() || item.WasSealed()); 
					b.icon.SetAlpha(item.IsSealed() ? 1f : 0.3f); 
				}); 
			}
			RefreshScore(); 
		}
	}

	public void RefreshScore() 
	public void StartGame() 
	{
		textTitle.text = pp.GetTitle() ?? ""; 
		textScore.text = "pp_score".lang(pp.ignoreEvaluate ? " - " : (pp.GetScore().ToString() ?? "")); 
		textValidScore.text = "pp_validScore".lang(pp.GetValidScore().ToString() ?? ""); 
		textValidScore.SetActive(!pp.ignoreEvaluate); 
		imageScoreBar.rectTransform.sizeDelta = new Vector2(Mathf.Clamp(300f * (float)pp.GetScore() / 100f, 0f, 300f), 50f); 
		if (ELayer.player.resetPrincipal) 
		{ 
			Close(); 
			return; 
		} 
		started = true; 
		Close(); 
		if (!LayerDrama.Instance) 
		{ 
			LayerDrama.ActivateMain("mono", "1-1"); 
		} 
	}

	public override void OnKill()
	{
		pp.Apply(); 
		Apply(); 
	} 

	public void Apply() 
	{ 
		if (!IsEmbark) 
		{ 
			pp.modified = ELayer.game.principal.modified; 
			foreach (GamePrincipal.Item item in pp.ListItems()) 
			{ 
				if (item.IsModified()) 
				{ 
					pp.modified.Add(item.id); 
				} 
			} 
		} 
		ELayer.game.principal = pp; 
		if (ELayer.player.resetPrincipal) 
		{ 
			ELayer.player.resetPrincipal = false; 
		} 
		ELayer.pc.SetFeat(1220, pp.permadeath ? 1 : 0); 
	}
}

Map

@@ -737,18 +737,21 @@ public static MapMetaData GetMetaData(string pathZip)

cs
		ZipEntry zipEntry = zipFile["meta"];
		if (zipEntry != null)
		{
			Debug.Log(zipEntry); 
			using MemoryStream stream = new MemoryStream(); 
			zipEntry.Extract(stream); 
			MapMetaData mapMetaData = IO.LoadStreamJson<MapMetaData>(stream); 
			Debug.Log(mapMetaData); 
			mapMetaData.path = pathZip; 
			return mapMetaData; 
			using (MemoryStream stream = new MemoryStream()) 
			{ 
				zipEntry.Extract(stream); 
				MapMetaData mapMetaData = IO.LoadStreamJson<MapMetaData>(stream); 
				mapMetaData.path = pathZip; 
				return mapMetaData; 
			} 
		}
	}
	catch (Exception message)
	{
		Debug.Log(message); 
		if (Application.isEditor) 
		{ 
			Debug.Log(message); 
		} 
	}
	return null;
}

@@ -1958,19 +1961,14 @@ public void _ValidateInstalled(int x, int y)

cs
		HitResult hitResult = item.TileType._HitTest(point, item.Thing, canIgnore: false);
		if (item.Thing.stackOrder != detail.things.IndexOf(item.Thing) || (hitResult != HitResult.Valid && hitResult != HitResult.Warning))
		{
			bool flag = true; 
			if (EClass._zone.IsPCFaction || item.rarity >= Rarity.Legendary || item.trait is TraitFigure) 
			if (EClass._zone.IsPCFaction || !item.isNPCProperty) 
			{
				flag = false; 
				item.SetPlaceState(PlaceState.roaming); 
			}
			if (flag) 
			else if (item.rarity < Rarity.Legendary) 
			{
				item.Die();
			}
			else
			{ 
				item.SetPlaceState(PlaceState.roaming); 
			} 
		}
	}
}

Player

@@ -797,6 +797,9 @@ public void OnLeaveZone()

cs
	[JsonProperty]
	public bool openContainerCenter;

	[JsonProperty] 
	public bool showWorkaround; 

	[JsonProperty]
	public string title;

@@ -971,6 +974,8 @@ public void OnLeaveZone()

cs

	public bool willAutoSave;

	public bool resetPrincipal; 

	public bool simulatingZone;

	public bool isAutoFarming;

@@ -1216,10 +1221,6 @@ public void OnStartNewGame()

cs
	dateTravel = EClass.world.date.GetRaw();
	uidLastTravelZone = EClass.pc.currentZone.uid;
	GenerateBackgroundText();
	if (!EClass.game.Difficulty.allowRevive) 
	{ 
		EClass.pc.SetFeat(1220); 
	} 
	EClass.pc.elements.CheckSkillActions();
	EClass.pc.hunger.value = 30;
	EClass.pc.CalculateMaxStamina();

Scene

@@ -562,7 +562,7 @@ public void OnUpdate()

cs
			EMono.Sound.Play("dead_pc");
			string[] list = Lang.GetList("lastWords");
			string lastWord = list.RandomItem();
			if (EMono.game.Difficulty.deleteGameOnDeath) 
			if (EMono.game.principal.permadeath) 
			{
				GameIO.DeleteGame(Game.id, EMono.game.isCloud);
			}

@@ -590,7 +590,7 @@ public void OnUpdate()

cs
				List<string> list2 = new List<string>();
				Zone lastTown = EMono.game.spatials.Find(EMono.player.uidLastTown);
				bool addTownRevive = lastTown != null && !EMono._zone.IsInstance;
				if (EMono.game.Difficulty.allowRevive) 
				if (!EMono.game.principal.permadeath) 
				{
					if (addTownRevive)
					{

@@ -610,7 +610,7 @@ public void OnUpdate()

cs
					Dialog.List("pc_deathChoice".lang(), list2, (string j) => j, delegate(int c, string d)
					{
						EMono.player.deathDialog = false;
						if (EMono.game.Difficulty.allowRevive && (c == 0 || (addTownRevive && c == 1))) 
						if (!EMono.game.principal.permadeath && (c == 0 || (addTownRevive && c == 1))) 
						{
							EMono.pc.MakeGrave(lastWord);
							EMono.pc.Revive();

TraitBaseContainer

@@ -2,6 +2,20 @@

cs

public class TraitBaseContainer : Trait
{
	public bool HasChara => owner.c_idRefCard != null; 

	public override bool ShowChildrenNumber
	{ 
		get
		{ 
			if (!HasChara) 
			{ 
				return base.ShowChildrenNumber; 
			} 
			return false; 
		} 
	} 

	public override string IDInvStyle
	{
		get

@@ -82,8 +96,6 @@ public override bool UseAltTiles

cs
		}
	}

	public bool HasChara => owner.c_idRefCard != null; 

	public override void OnCreate(int lv)
	{
		owner.things.SetSize(Width, Height);

TraitBoat

@@ -2,6 +2,8 @@

cs

public class TraitBoat : Trait
{
	public override bool CanBeDestroyed => false; 

	public override bool IsFloating => true;

	public override bool IsGround => true;

TraitCrafter

@@ -330,8 +330,13 @@ public virtual Thing Craft(AI_UseCrafter ai)

cs
		foreach (Element item in list)
		{
			SocketData runeEnc = eq.GetRuneEnc(item.id);
			item.vLink = 0; 
			if (runeEnc != null)
			{
				if (item.vBase + item.vSource != runeEnc.value) 
				{ 
					item.vLink = item.vBase + item.vSource; 
				} 
				item.vBase = runeEnc.value;
				item.vSource = 0;
			}

@@ -354,7 +359,7 @@ public virtual Thing Craft(AI_UseCrafter ai)

cs
			EClass.pc.PlayEffect("intonation");
		}, delegate(Element a, ItemGeneral b)
		{
			b.SetSubText((a.vBase + a.vSource).ToString() ?? "", 200, FontColor.Default, TextAnchor.MiddleRight); 
			b.SetSubText(a.vBase + a.vSource + ((a.vLink != 0) ? (" (" + a.vLink + ")") : ""), 200, FontColor.Default, TextAnchor.MiddleRight); 
			b.Build();
			if (a.HasTag("noRune"))
			{

UICharaMaker

@@ -51,8 +51,6 @@ public class UICharaMaker : EMono

cs

	public UIText textMode;

	public UIText textDifficulty; 

	public int ageIndex;

	public Vector2 posList;

@@ -74,7 +72,6 @@ public void SetChara(Chara c)

cs
	listMode = Lang.GetList("startMode");
	listDifficulties = Lang.GetList("difficulties");
	textMode.SetText(listMode[EMono.game.idPrologue]);
	textDifficulty.SetText(listDifficulties[EMono.game.idDifficulty]); 
	chara = c;
	BuildRaces();
	SetPortraitSlider();

@@ -175,7 +172,7 @@ public void Refresh()

cs
	chara.elements.AddNote(note2, (Element e) => e.source.category == "skill" && e.ValueWithoutLink > 1 && e.source.categorySub != "weapon", null, ElementContainer.NoteMode.CharaMake);
	note2.Space();
	note2.AddHeaderTopic("feats".lang());
	chara.elements.AddNote(note2, (Element e) => e is Feat, null, ElementContainer.NoteMode.CharaMake, addRaceFeat: true); 
	chara.elements.AddNote(note2, (Element e) => e is Feat && e.id != 1220, null, ElementContainer.NoteMode.CharaMake, addRaceFeat: true); 
	note2.Build();
	if (!addShadow)
	{

@@ -209,50 +206,6 @@ public void ListModes()

cs
			.SetTitles("wStartMode");
	}

	public void ListDifficulties() 
	{ 
		TooltipManager.Instance.HideTooltips(immediate: true); 
		TooltipManager.Instance.disableHide = "note"; 
		bool first = true; 
		EMono.ui.AddLayer<LayerList>().SetPivot(0.5f, 0.2f).SetSize(260f) 
			.SetList2(EMono.setting.start.difficulties, (GameDifficultySetting a) => a.Name, delegate(GameDifficultySetting a, ItemGeneral b) 
			{ 
				EMono.game.idDifficulty = a.ID; 
				textDifficulty.SetText(listDifficulties[EMono.game.idDifficulty]); 
				Refresh(); 
			}, delegate(GameDifficultySetting a, ItemGeneral item) 
			{ 
				UIButton b2 = item.button1; 
				b2.SetTooltip(delegate(UITooltip t) 
				{ 
					t.note.Clear(); 
					t.note.AddHeader(a.Name); 
					t.note.Space(8); 
					t.note.AddText("NoteText_medium", "vow_" + a.ID).Hyphenate(); 
					t.note.Space(8); 
					t.note.Build(); 
				}); 
				if (first) 
				{ 
					TooltipManager.Instance.GetComponent<CanvasGroup>().alpha = 0f; 
					TooltipManager.Instance.GetComponent<CanvasGroup>().DOFade(1f, 0.3f); 
					EMono.core.actionsNextFrame.Add(delegate
					{ 
						b2.ShowTooltipForced(); 
					}); 
				} 
				first = false; 
			}) 
			.SetTitles("wDifficulty"); 
		RectTransform rectTransform = EMono.ui.GetLayer<LayerList>().windows[0].Rect(); 
		rectTransform.pivot = new Vector2(0.5f, 0.5f); 
		rectTransform.anchoredPosition = posList2; 
		TweenUtil.Tween(0.3f, null, delegate
		{ 
			UIButton.TryShowTip(); 
		}); 
	} 

	public void RerollAlias()
	{
		chara._alias = AliasGen.GetRandomAlias();

WindowChara

@@ -270,8 +270,7 @@ public void RefreshStatic()

cs
	@object = Portrait.modPortraitBGFs.GetItem(chara.GetStr(24) ?? "BGF_1").GetObject();
	@object.texture.filterMode = FilterMode.Bilinear;
	portrait.imageFrame.sprite = @object;
	string text = Lang.GetList("difficulties_title")[EClass.game.idDifficulty]; 
	window.SetCaption(((text.IsEmpty() || !chara.IsPC) ? "" : (text + " - ")) + chara.NameBraced); 
	window.SetCaption(chara.NameBraced); 
	listAttaribute.Clear();
	listAttaribute.callbacks = new UIList.Callback<Element, ButtonElement>
	{