Decompiled source of WobblyLifePlusFix v2.0.2

WobblyLifePlus.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace WobblyLifePlus;

[BepInPlugin("com.wobblylife.plus", "WobblyLife+", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
	public struct FoodData
	{
		public float h;

		public float t;

		public float f;

		public FoodData(float hh, float tt, float ff = 0f)
		{
			h = hh;
			t = tt;
			f = ff;
		}
	}

	[Serializable]
	public class BusinessData
	{
		public string businessId;

		public string businessName;

		public string businessType;

		public int purchasePrice;

		public int dailyIncome;

		public int dailyExpenses;

		public bool isOwned;

		public int ownerSaveSlot;

		public int ownerCharSlot;

		public bool hasJobs;

		public float workerBonus;

		public int activeWorkerCount;

		public Vector3 triggerPosition;
	}

	[Serializable]
	public class CharacterFullData
	{
		public int age = 18;

		public string name = "";

		public bool nameGenerated = false;

		public float ageTimer = 0f;

		public float health = 100f;

		public float hunger = 100f;

		public float thirst = 100f;

		public float fatigue = 0f;

		public int hospitalDebt = 0;

		public int totalDeaths = 0;

		public int totalFoodEaten = 0;

		public int houseCount = 0;

		public List<int> houseCosts = new List<int>();

		public List<BusinessOwnedEntry> businesses = new List<BusinessOwnedEntry>();
	}

	[Serializable]
	public class BusinessOwnedEntry
	{
		public string businessId;

		public int activeWorkerCount;
	}

	[Serializable]
	public class GlobalBusinessData
	{
		public List<GlobalBusinessEntry> businesses = new List<GlobalBusinessEntry>();
	}

	[Serializable]
	public class GlobalBusinessEntry
	{
		public string businessId;

		public bool isOwned;

		public int ownerSaveSlot;

		public int ownerCharSlot;
	}

	[HarmonyPatch(typeof(JobMission), "ServerJobCompleted", new Type[] { typeof(PlayerController) })]
	private class Patch_JobMission_ServerJobCompleted
	{
		private static void Postfix(JobMission __instance, PlayerController playerController)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || (Object)(object)playerController == (Object)null)
			{
				return;
			}
			JobDispensorBehaviour jobDispensor = __instance.GetJobDispensor();
			if ((Object)(object)jobDispensor == (Object)null)
			{
				return;
			}
			int playerSlot = GetPlayerSlot(playerController);
			if (playerSlot < 0 || playerSlot >= maxPlayers)
			{
				return;
			}
			BusinessData businessData = null;
			Vector3 position = ((Component)jobDispensor).transform.position;
			foreach (BusinessData allBusiness in allBusinesses)
			{
				if (!allBusiness.hasJobs || !(Vector3.Distance(position, allBusiness.triggerPosition) < 100f))
				{
					continue;
				}
				businessData = allBusiness;
				break;
			}
			if (businessData == null || !businessData.isOwned || (businessData.ownerSaveSlot == playerSaveSlot[playerSlot] && businessData.ownerCharSlot == playerCharSlot[playerSlot]))
			{
				return;
			}
			int num = 35;
			int num2 = -1;
			for (int i = 0; i < maxPlayers; i++)
			{
				if (bInitialized[i] && playerSaveSlot[i] == businessData.ownerSaveSlot && playerCharSlot[i] == businessData.ownerCharSlot)
				{
					num2 = i;
					break;
				}
			}
			if (num2 >= 0 && (Object)(object)localCharacters[num2] != (Object)null)
			{
				MethodInfo method = ((object)localCharacters[num2]).GetType().GetMethod("GetPlayerController", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method != null)
				{
					object? obj = method.Invoke(localCharacters[num2], null);
					Component val = (Component)((obj is Component) ? obj : null);
					if ((Object)(object)val != (Object)null)
					{
						MethodInfo method2 = ((object)val).GetType().GetMethod("GetPlayerControllerEmployment", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						if (method2 != null)
						{
							object? obj2 = method2.Invoke(val, null);
							Component val2 = (Component)((obj2 is Component) ? obj2 : null);
							if ((Object)(object)val2 != (Object)null)
							{
								MethodInfo method3 = ((object)val2).GetType().GetMethod("UpdateMoney", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
								if (method3 != null)
								{
									method3.Invoke(val2, new object[1] { -num });
								}
							}
						}
					}
				}
			}
			businessData.activeWorkerCount++;
			Plugin plugin = Object.FindObjectOfType<Plugin>();
			if ((Object)(object)plugin != (Object)null)
			{
				plugin.SaveAll();
			}
		}
	}

	private const float SECONDS_PER_YEAR = 1314000f;

	private const float GAME_DAY_DURATION = 3600f;

	public static int maxPlayers = 4;

	public static int maxSaveSlots = 5;

	public static int maxCharSlots = 4;

	public static float[][] health = new float[5][]
	{
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f }
	};

	public static float[][] hunger = new float[5][]
	{
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f }
	};

	public static float[][] thirst = new float[5][]
	{
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f },
		new float[4] { 100f, 100f, 100f, 100f }
	};

	public static float[][] fatigue = new float[5][]
	{
		new float[4],
		new float[4],
		new float[4],
		new float[4],
		new float[4]
	};

	public static float maxFatigue = 100f;

	public static int[][] hospitalDebt = new int[5][]
	{
		new int[4],
		new int[4],
		new int[4],
		new int[4],
		new int[4]
	};

	public static int[][] playerAge = new int[5][]
	{
		new int[4] { 18, 18, 18, 18 },
		new int[4] { 18, 18, 18, 18 },
		new int[4] { 18, 18, 18, 18 },
		new int[4] { 18, 18, 18, 18 },
		new int[4] { 18, 18, 18, 18 }
	};

	public static float[][] ageTimers = new float[5][]
	{
		new float[4],
		new float[4],
		new float[4],
		new float[4],
		new float[4]
	};

	public static bool[][] bDead = new bool[5][]
	{
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4]
	};

	public static bool[][] bDying = new bool[5][]
	{
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4]
	};

	public static bool[][] bFatigueCollapse = new bool[5][]
	{
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4]
	};

	public static bool[][] bDeathByAge = new bool[5][]
	{
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4]
	};

	public static bool[][] bShowingLifeSummary = new bool[5][]
	{
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4]
	};

	public static int[][] totalDeaths = new int[5][]
	{
		new int[4],
		new int[4],
		new int[4],
		new int[4],
		new int[4]
	};

	public static int[][] totalFoodEaten = new int[5][]
	{
		new int[4],
		new int[4],
		new int[4],
		new int[4],
		new int[4]
	};

	public static string[][] playerNames = new string[5][]
	{
		new string[4] { "", "", "", "" },
		new string[4] { "", "", "", "" },
		new string[4] { "", "", "", "" },
		new string[4] { "", "", "", "" },
		new string[4] { "", "", "", "" }
	};

	public static bool[][] namesGenerated = new bool[5][]
	{
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4],
		new bool[4]
	};

	public static int[][] playerHouseCount = new int[5][]
	{
		new int[4],
		new int[4],
		new int[4],
		new int[4],
		new int[4]
	};

	public static Component[] localCharacters = (Component[])(object)new Component[4];

	public static int[] playerSaveSlot = new int[4] { -1, -1, -1, -1 };

	public static int[] playerCharSlot = new int[4] { -1, -1, -1, -1 };

	public static bool[] bInitialized = new bool[4];

	public static bool[] wasDead = new bool[4];

	public static bool[] needsHospitalTeleport = new bool[4];

	public static bool[] firstSpawn = new bool[4] { true, true, true, true };

	public static int[] lastKnownMoney = new int[4] { -1, -1, -1, -1 };

	public static List<BusinessData> allBusinesses = new List<BusinessData>();

	private float dailyCycleTimer = 0f;

	private List<GameObject> businessSigns = new List<GameObject>();

	private bool signsSpawned = false;

	private string[] notificationMessage = new string[4];

	private float[] notificationTimer = new float[4];

	private bool[] notificationIsError = new bool[4];

	private float housingCheckTimer = 0f;

	private float autoSaveTimer = 0f;

	private BusinessData[] nearestBusiness = new BusinessData[4];

	private bool[] isNearBusiness = new bool[4];

	private GUIStyle labelStyle;

	private GUIStyle debtStyle;

	private GUIStyle ageStyle;

	private Texture2D redTex;

	private Texture2D orangeTex;

	private Texture2D blueTex;

	private Texture2D bgTex;

	private Texture2D fatigueTex;

	private float[] eatCooldown = new float[4];

	private Vector3 hospitalPos = new Vector3(-158.6f, 48.4f, 12f);

	private Vector3 metroStationPos = new Vector3(4.5f, 31.4f, -268.3f);

	private float nextPlayerScan = 0f;

	private float vitalsTimer = 0f;

	private float debtCheckTimer = 0f;

	private float[] hungerTimer = new float[4];

	private float[] thirstTimer = new float[4];

	private Dictionary<int, int>[] playerHouseCosts = new Dictionary<int, int>[5]
	{
		new Dictionary<int, int>(),
		new Dictionary<int, int>(),
		new Dictionary<int, int>(),
		new Dictionary<int, int>(),
		new Dictionary<int, int>()
	};

	private string[] firstNames = new string[100]
	{
		"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "Thomas", "Charles",
		"Christopher", "Daniel", "Matthew", "Anthony", "Mark", "Donald", "Steven", "Paul", "Andrew", "Joshua",
		"Kenneth", "Kevin", "Brian", "George", "Edward", "Ronald", "Timothy", "Jason", "Jeffrey", "Ryan",
		"Jacob", "Gary", "Nicholas", "Eric", "Jonathan", "Stephen", "Larry", "Justin", "Scott", "Brandon",
		"Benjamin", "Samuel", "Raymond", "Gregory", "Frank", "Alexander", "Patrick", "Jack", "Dennis", "Jerry",
		"Tyler", "Aaron", "Jose", "Adam", "Nathan", "Henry", "Douglas", "Zachary", "Peter", "Kyle",
		"Walter", "Ethan", "Jeremy", "Harold", "Keith", "Christian", "Roger", "Noah", "Gerald", "Carl",
		"Terry", "Sean", "Austin", "Arthur", "Lawrence", "Jesse", "Dylan", "Bryan", "Joe", "Jordan",
		"Billy", "Bruce", "Albert", "Willie", "Gabriel", "Logan", "Alan", "Juan", "Wayne", "Roy",
		"Ralph", "Randy", "Eugene", "Vincent", "Russell", "Elijah", "Louis", "Bobby", "Philip", "Johnny"
	};

	private string[] lastNames = new string[100]
	{
		"Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Rodriguez", "Martinez",
		"Hernandez", "Lopez", "Gonzalez", "Wilson", "Anderson", "Thomas", "Taylor", "Moore", "Jackson", "Martin",
		"Lee", "Perez", "Thompson", "White", "Harris", "Sanchez", "Clark", "Ramirez", "Lewis", "Robinson",
		"Walker", "Young", "Allen", "King", "Wright", "Scott", "Torres", "Nguyen", "Hill", "Flores",
		"Green", "Adams", "Nelson", "Baker", "Hall", "Rivera", "Campbell", "Mitchell", "Carter", "Roberts",
		"Gomez", "Phillips", "Evans", "Turner", "Diaz", "Parker", "Cruz", "Edwards", "Collins", "Reyes",
		"Stewart", "Morris", "Morales", "Murphy", "Cook", "Rogers", "Gutierrez", "Ortiz", "Morgan", "Cooper",
		"Peterson", "Bailey", "Reed", "Kelly", "Howard", "Ramos", "Kim", "Cox", "Ward", "Richardson",
		"Watson", "Brooks", "Chavez", "Wood", "James", "Bennett", "Gray", "Mendoza", "Ruiz", "Hughes",
		"Price", "Alvarez", "Castillo", "Sanders", "Patel", "Myers", "Long", "Ross", "Foster", "Jimenez"
	};

	public static Dictionary<string, FoodData> foodDB = new Dictionary<string, FoodData>
	{
		{
			"PropShop_Pizza",
			new FoodData(40f, 5f)
		},
		{
			"PropShop_Burger",
			new FoodData(35f, 5f)
		},
		{
			"PropShop_Donut",
			new FoodData(15f, -5f)
		},
		{
			"PropShop_HotDog",
			new FoodData(30f, 5f)
		},
		{
			"PropShop_Steak",
			new FoodData(50f, 0f)
		},
		{
			"PropShop_Banana",
			new FoodData(10f, 5f)
		},
		{
			"PropShop_Apple",
			new FoodData(10f, 5f)
		},
		{
			"PropShop_Sandwich",
			new FoodData(25f, 5f)
		},
		{
			"PropShop_Baguette",
			new FoodData(30f, -5f)
		},
		{
			"PropShop_Fries",
			new FoodData(20f, 0f)
		},
		{
			"PropShop_Chicken",
			new FoodData(35f, 0f)
		},
		{
			"PropShop_Fish",
			new FoodData(30f, 5f)
		},
		{
			"PropShop_CakeSlice",
			new FoodData(25f, -5f)
		},
		{
			"PropShop_Cheese",
			new FoodData(15f, 0f)
		},
		{
			"PropShop_Ham",
			new FoodData(20f, 0f)
		},
		{
			"PropShop_Lettuce",
			new FoodData(5f, 10f)
		},
		{
			"PropShop_Tomato",
			new FoodData(5f, 10f)
		},
		{
			"PropShop_Carrot",
			new FoodData(10f, 5f)
		},
		{
			"PropShop_CauliFlower",
			new FoodData(10f, 5f)
		},
		{
			"PropShop_SweetCorn",
			new FoodData(15f, 5f)
		},
		{
			"PropShop_Bean",
			new FoodData(15f, 0f)
		},
		{
			"PropShop_WaterMelon",
			new FoodData(15f, 25f)
		},
		{
			"PropShop_BottleWater",
			new FoodData(0f, 50f)
		},
		{
			"PropShop_SodaPop",
			new FoodData(5f, 35f)
		},
		{
			"PropShop_Milk",
			new FoodData(10f, 30f)
		},
		{
			"PropShop_Bread",
			new FoodData(15f, -10f)
		},
		{
			"PropShop_CrispyCrisps",
			new FoodData(10f, -5f)
		},
		{
			"PropShop_PopCorn",
			new FoodData(15f, -5f)
		},
		{
			"PropShop_Cereal",
			new FoodData(20f, -10f)
		},
		{
			"PropShop_Croissant",
			new FoodData(20f, -5f)
		},
		{
			"PropShop_LargeCake",
			new FoodData(50f, -10f)
		},
		{
			"PropShop_Chocolate",
			new FoodData(15f, -5f)
		},
		{
			"PropShop_ChocolateLolly",
			new FoodData(10f, -5f)
		},
		{
			"PropShop_Eclair",
			new FoodData(20f, -5f)
		},
		{
			"PropShop_IceCreamCone",
			new FoodData(10f, 5f)
		},
		{
			"PropShop_IceCreamSoft",
			new FoodData(15f, 5f)
		},
		{
			"PropShop_IceCreamTub",
			new FoodData(30f, 5f)
		},
		{
			"PropShop_IceSlice",
			new FoodData(10f, 10f)
		},
		{
			"PropShop_IceLolly",
			new FoodData(10f, 10f)
		},
		{
			"PropShop_TwoStickIceLolly",
			new FoodData(15f, 10f)
		},
		{
			"PropShop_JamJar",
			new FoodData(10f, 0f)
		},
		{
			"PropShop_Barrito",
			new FoodData(35f, 0f)
		},
		{
			"PropShop_VeggieSausage",
			new FoodData(20f, 5f)
		},
		{
			"Space_PropShop_EnergyDrink",
			new FoodData(5f, 40f, -30f)
		},
		{
			"SpaceDiner_Drink_Coffee",
			new FoodData(5f, 25f, -25f)
		},
		{
			"SpaceDiner_Drink_Water",
			new FoodData(0f, 50f)
		},
		{
			"SpaceDiner_Drink_Soda",
			new FoodData(5f, 30f)
		},
		{
			"SpaceDiner_Drink_Milkshake",
			new FoodData(10f, 30f, -10f)
		},
		{
			"SpaceDiner_Food_Burger",
			new FoodData(35f, 5f)
		},
		{
			"SpaceDiner_Food_Chips",
			new FoodData(20f, 0f)
		},
		{
			"SpaceDiner_Food_Pancakes",
			new FoodData(25f, 5f)
		},
		{
			"SpaceDiner_Food_Pizza",
			new FoodData(40f, 5f)
		},
		{
			"SpaceDiner_Food_Spaghetti",
			new FoodData(35f, 5f)
		}
	};

	private void Awake()
	{
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Expected O, but got Unknown
		for (int i = 0; i < maxSaveSlots; i++)
		{
			for (int j = 0; j < maxCharSlots; j++)
			{
				health[i][j] = 100f;
				hunger[i][j] = 100f;
				thirst[i][j] = 100f;
				playerAge[i][j] = 18;
				playerNames[i][j] = "";
				namesGenerated[i][j] = false;
			}
		}
		for (int k = 0; k < maxPlayers; k++)
		{
			notificationMessage[k] = "";
			notificationTimer[k] = 0f;
			nearestBusiness[k] = null;
			isNearBusiness[k] = false;
			playerSaveSlot[k] = -1;
			playerCharSlot[k] = -1;
		}
		InitializeBusinesses();
		LoadGlobalBusinesses();
		Harmony val = new Harmony("com.wobblylife.plus");
		val.PatchAll();
		Debug.Log((object)"[WobblyLife+] v2.0.0 - Economy Overhaul Ready");
	}

	private string GetCharFilePath(int saveSlot, int charSlot)
	{
		return Path.Combine(Paths.PluginPath, $"WobblyLifePlus_Slot{saveSlot}_Char{charSlot}.json");
	}

	private string GetGlobalBusinessPath()
	{
		return Path.Combine(Paths.PluginPath, "WobblyLifePlus_GlobalBusinesses.json");
	}

	private void LoadGlobalBusinesses()
	{
		string globalBusinessPath = GetGlobalBusinessPath();
		if (!File.Exists(globalBusinessPath))
		{
			return;
		}
		try
		{
			GlobalBusinessData globalBusinessData = JsonUtility.FromJson<GlobalBusinessData>(File.ReadAllText(globalBusinessPath));
			if (globalBusinessData == null || globalBusinessData.businesses == null)
			{
				return;
			}
			foreach (GlobalBusinessEntry e in globalBusinessData.businesses)
			{
				List<BusinessData> list = allBusinesses;
				Predicate<BusinessData> match = (BusinessData b) => b.businessId == e.businessId;
				BusinessData businessData = list.Find(match);
				if (businessData != null)
				{
					businessData.isOwned = e.isOwned;
					businessData.ownerSaveSlot = e.ownerSaveSlot;
					businessData.ownerCharSlot = e.ownerCharSlot;
				}
			}
		}
		catch
		{
		}
	}

	private void SaveGlobalBusinesses()
	{
		GlobalBusinessData globalBusinessData = new GlobalBusinessData();
		foreach (BusinessData allBusiness in allBusinesses)
		{
			globalBusinessData.businesses.Add(new GlobalBusinessEntry
			{
				businessId = allBusiness.businessId,
				isOwned = allBusiness.isOwned,
				ownerSaveSlot = allBusiness.ownerSaveSlot,
				ownerCharSlot = allBusiness.ownerCharSlot
			});
		}
		try
		{
			File.WriteAllText(GetGlobalBusinessPath(), JsonUtility.ToJson((object)globalBusinessData, true));
		}
		catch
		{
		}
	}

	private void LoadCharacter(int saveSlot, int charSlot)
	{
		string charFilePath = GetCharFilePath(saveSlot, charSlot);
		if (!File.Exists(charFilePath))
		{
			GenerateNameForCharacter(saveSlot, charSlot);
			SaveCharacter(saveSlot, charSlot);
			return;
		}
		try
		{
			CharacterFullData characterFullData = JsonUtility.FromJson<CharacterFullData>(File.ReadAllText(charFilePath));
			if (characterFullData == null)
			{
				GenerateNameForCharacter(saveSlot, charSlot);
				SaveCharacter(saveSlot, charSlot);
				return;
			}
			if (!string.IsNullOrEmpty(characterFullData.name))
			{
				playerNames[saveSlot][charSlot] = characterFullData.name;
				namesGenerated[saveSlot][charSlot] = characterFullData.nameGenerated;
			}
			else
			{
				GenerateNameForCharacter(saveSlot, charSlot);
			}
			playerAge[saveSlot][charSlot] = characterFullData.age;
			ageTimers[saveSlot][charSlot] = characterFullData.ageTimer;
			health[saveSlot][charSlot] = characterFullData.health;
			hunger[saveSlot][charSlot] = characterFullData.hunger;
			thirst[saveSlot][charSlot] = characterFullData.thirst;
			fatigue[saveSlot][charSlot] = characterFullData.fatigue;
			hospitalDebt[saveSlot][charSlot] = characterFullData.hospitalDebt;
			totalDeaths[saveSlot][charSlot] = characterFullData.totalDeaths;
			totalFoodEaten[saveSlot][charSlot] = characterFullData.totalFoodEaten;
			playerHouseCount[saveSlot][charSlot] = characterFullData.houseCount;
			playerHouseCosts[saveSlot].Clear();
			if (characterFullData.houseCosts != null)
			{
				for (int i = 0; i < characterFullData.houseCosts.Count; i++)
				{
					playerHouseCosts[saveSlot][i] = characterFullData.houseCosts[i];
				}
			}
			if (characterFullData.businesses == null)
			{
				return;
			}
			foreach (BusinessOwnedEntry be in characterFullData.businesses)
			{
				List<BusinessData> list = allBusinesses;
				Predicate<BusinessData> match = (BusinessData b) => b.businessId == be.businessId;
				BusinessData businessData = list.Find(match);
				if (businessData != null && businessData.isOwned && businessData.ownerSaveSlot == saveSlot && businessData.ownerCharSlot == charSlot)
				{
					businessData.activeWorkerCount = be.activeWorkerCount;
				}
			}
		}
		catch
		{
			GenerateNameForCharacter(saveSlot, charSlot);
			SaveCharacter(saveSlot, charSlot);
		}
	}

	public void SaveCharacter(int saveSlot, int charSlot)
	{
		CharacterFullData characterFullData = new CharacterFullData();
		characterFullData.age = playerAge[saveSlot][charSlot];
		characterFullData.name = playerNames[saveSlot][charSlot];
		characterFullData.nameGenerated = namesGenerated[saveSlot][charSlot];
		characterFullData.ageTimer = ageTimers[saveSlot][charSlot];
		characterFullData.health = health[saveSlot][charSlot];
		characterFullData.hunger = hunger[saveSlot][charSlot];
		characterFullData.thirst = thirst[saveSlot][charSlot];
		characterFullData.fatigue = fatigue[saveSlot][charSlot];
		characterFullData.hospitalDebt = hospitalDebt[saveSlot][charSlot];
		characterFullData.totalDeaths = totalDeaths[saveSlot][charSlot];
		characterFullData.totalFoodEaten = totalFoodEaten[saveSlot][charSlot];
		characterFullData.houseCount = playerHouseCount[saveSlot][charSlot];
		CharacterFullData characterFullData2 = characterFullData;
		if (playerHouseCosts[saveSlot] != null)
		{
			foreach (KeyValuePair<int, int> item in playerHouseCosts[saveSlot])
			{
				characterFullData2.houseCosts.Add(item.Value);
			}
		}
		foreach (BusinessData allBusiness in allBusinesses)
		{
			if (allBusiness.isOwned && allBusiness.ownerSaveSlot == saveSlot && allBusiness.ownerCharSlot == charSlot)
			{
				characterFullData2.businesses.Add(new BusinessOwnedEntry
				{
					businessId = allBusiness.businessId,
					activeWorkerCount = allBusiness.activeWorkerCount
				});
			}
		}
		try
		{
			File.WriteAllText(GetCharFilePath(saveSlot, charSlot), JsonUtility.ToJson((object)characterFullData2, true));
		}
		catch
		{
		}
	}

	public void SaveAll()
	{
		SaveGlobalBusinesses();
		for (int i = 0; i < maxSaveSlots; i++)
		{
			for (int j = 0; j < maxCharSlots; j++)
			{
				SaveCharacter(i, j);
			}
		}
	}

	private void GenerateNameForCharacter(int saveSlot, int charSlot)
	{
		if (!namesGenerated[saveSlot][charSlot] || string.IsNullOrEmpty(playerNames[saveSlot][charSlot]))
		{
			playerNames[saveSlot][charSlot] = firstNames[Random.Range(0, firstNames.Length)] + " " + lastNames[Random.Range(0, lastNames.Length)];
			namesGenerated[saveSlot][charSlot] = true;
		}
	}

	private void InitializeBusinesses()
	{
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0661: Unknown result type (might be due to invalid IL or missing references)
		//IL_0666: Unknown result type (might be due to invalid IL or missing references)
		//IL_070c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0711: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0862: Unknown result type (might be due to invalid IL or missing references)
		//IL_0867: Unknown result type (might be due to invalid IL or missing references)
		//IL_090d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0912: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a68: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b13: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bbe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c64: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d0f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d14: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dbf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e65: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e6a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f10: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f15: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fbb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc0: Unknown result type (might be due to invalid IL or missing references)
		//IL_1066: Unknown result type (might be due to invalid IL or missing references)
		//IL_106b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1111: Unknown result type (might be due to invalid IL or missing references)
		//IL_1116: Unknown result type (might be due to invalid IL or missing references)
		//IL_11bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1267: Unknown result type (might be due to invalid IL or missing references)
		//IL_126c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1312: Unknown result type (might be due to invalid IL or missing references)
		//IL_1317: Unknown result type (might be due to invalid IL or missing references)
		//IL_13bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_13c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_1468: Unknown result type (might be due to invalid IL or missing references)
		//IL_146d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1513: Unknown result type (might be due to invalid IL or missing references)
		//IL_1518: Unknown result type (might be due to invalid IL or missing references)
		//IL_15be: Unknown result type (might be due to invalid IL or missing references)
		//IL_15c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1669: Unknown result type (might be due to invalid IL or missing references)
		//IL_166e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1714: Unknown result type (might be due to invalid IL or missing references)
		//IL_1719: Unknown result type (might be due to invalid IL or missing references)
		//IL_17bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_17c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_186a: Unknown result type (might be due to invalid IL or missing references)
		//IL_186f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1915: Unknown result type (might be due to invalid IL or missing references)
		//IL_191a: Unknown result type (might be due to invalid IL or missing references)
		//IL_19c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_19c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a6b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a70: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b16: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1bc1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1bc6: Unknown result type (might be due to invalid IL or missing references)
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_pizza",
			businessName = "Wobbly Pizza",
			businessType = "pizzeria",
			purchasePrice = 12000,
			dailyIncome = 900,
			dailyExpenses = 350,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-21.11f, 39.89f, -339.04f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_burger",
			businessName = "Wobbly Burger",
			businessType = "diner",
			purchasePrice = 10000,
			dailyIncome = 800,
			dailyExpenses = 300,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-131.35f, 39.37f, -153.61f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_tv",
			businessName = "Wobbly TV",
			businessType = "tv_station",
			purchasePrice = 35000,
			dailyIncome = 2500,
			dailyExpenses = 1100,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-315.47f, 39.39f, -92.16f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_disco",
			businessName = "Wobbly Disco",
			businessType = "disco_club",
			purchasePrice = 20000,
			dailyIncome = 1600,
			dailyExpenses = 700,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-287.78f, 39.39f, -224.28f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "city_taxi",
			businessName = "City Taxi",
			businessType = "taxi",
			purchasePrice = 8000,
			dailyIncome = 700,
			dailyExpenses = 300,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-222.72f, 39.36f, -188.41f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "the_wobbly_marina",
			businessName = "The Wobbly Marina",
			businessType = "marina",
			purchasePrice = 15000,
			dailyIncome = 1100,
			dailyExpenses = 450,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(740.54f, 7.33f, -103.81f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "post_office",
			businessName = "Post Office",
			businessType = "post_office",
			purchasePrice = 12000,
			dailyIncome = 950,
			dailyExpenses = 400,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(524.79f, 35.33f, 34.5f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "village_taxi",
			businessName = "Village Taxi",
			businessType = "taxi",
			purchasePrice = 8000,
			dailyIncome = 700,
			dailyExpenses = 300,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(267.67f, 21.69f, 263.11f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "dock_bait",
			businessName = "Dock Bait",
			businessType = "marina",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-818.48f, 7.73f, -441.13f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "paradise_taxi",
			businessName = "Paradise Taxi",
			businessType = "taxi",
			purchasePrice = 8000,
			dailyIncome = 700,
			dailyExpenses = 300,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(556.99f, 12.06f, -1236.02f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "ice_cream_world",
			businessName = "Ice-Cream World",
			businessType = "cafe",
			purchasePrice = 8000,
			dailyIncome = 650,
			dailyExpenses = 280,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(476.39f, 13.54f, -1193.53f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "farm",
			businessName = "Farm",
			businessType = "farm",
			purchasePrice = 25000,
			dailyIncome = 1800,
			dailyExpenses = 800,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-1157.55f, 56.8f, -29.63f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "sawmill",
			businessName = "Sawmill",
			businessType = "sawmill",
			purchasePrice = 18000,
			dailyIncome = 1300,
			dailyExpenses = 550,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-1055.44f, 57.09f, 803.66f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "jungle_bait",
			businessName = "Jungle Bait",
			businessType = "marina",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(1378.74f, 8.41f, 579.04f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "pine_design_furniture",
			businessName = "Pine Design Furniture",
			businessType = "furniture_store",
			purchasePrice = 15000,
			dailyIncome = 1100,
			dailyExpenses = 500,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = true,
			workerBonus = 0.25f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-751.17f, 122.32f, 670.76f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "park",
			businessName = "Park",
			businessType = "amusement_park",
			purchasePrice = 75000,
			dailyIncome = 4200,
			dailyExpenses = 2000,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-200.35f, 40.13f, -378.59f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "main_gas",
			businessName = "Main Gas",
			businessType = "gas_station",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-113.21f, 40.05f, -319.5f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "cars_for_sale",
			businessName = "Cars For Sale",
			businessType = "car_dealership",
			purchasePrice = 60000,
			dailyIncome = 3500,
			dailyExpenses = 1600,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-116.48f, 40.05f, -256.47f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "squishy_electronics",
			businessName = "Squishy Electronics",
			businessType = "electronics_store",
			purchasePrice = 20000,
			dailyIncome = 1400,
			dailyExpenses = 650,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-131.25f, 39.39f, -183.7f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_cinema",
			businessName = "Wobbly Cinema",
			businessType = "cinema",
			purchasePrice = 30000,
			dailyIncome = 2000,
			dailyExpenses = 900,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-116.06f, 39.73f, -84.15f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "streetwear_urbanstyle",
			businessName = "StreetWear UrbanStyle",
			businessType = "clothing_store",
			purchasePrice = 15000,
			dailyIncome = 1100,
			dailyExpenses = 500,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-239.04f, 39.39f, -54.3f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_bank",
			businessName = "Wobbly Bank",
			businessType = "bank",
			purchasePrice = 150000,
			dailyIncome = 7500,
			dailyExpenses = 2800,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-306.33f, 39.93f, -163.99f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "el_wobbles",
			businessName = "El Wobbles",
			businessType = "drink_bar",
			purchasePrice = 15000,
			dailyIncome = 1200,
			dailyExpenses = 550,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-227.11f, 39.39f, -224.51f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_museum",
			businessName = "Wobbly Museum",
			businessType = "museum",
			purchasePrice = 55000,
			dailyIncome = 3200,
			dailyExpenses = 1400,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-576.32f, 53.04f, -270.59f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_bowling",
			businessName = "Wobbly Bowling",
			businessType = "bowling_club",
			purchasePrice = 25000,
			dailyIncome = 1700,
			dailyExpenses = 750,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-453.71f, 66.48f, -0.42f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "disaster_drive_gas",
			businessName = "Disaster Drive Gas",
			businessType = "gas_station",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-509.13f, 90.3f, 200.89f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_mall",
			businessName = "Wobbly Mall",
			businessType = "mall",
			purchasePrice = 45000,
			dailyIncome = 2800,
			dailyExpenses = 1200,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(281.15f, 40.15f, -213.32f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_mall_gas",
			businessName = "Wobbly Mall Gas",
			businessType = "gas_station",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(318.24f, 39.95f, -148.56f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "fresh_fur_fashion",
			businessName = "Fresh Fur Fashion",
			businessType = "clothing_store",
			purchasePrice = 15000,
			dailyIncome = 1100,
			dailyExpenses = 500,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-728.81f, 122.29f, 670.69f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "mayors_assistent",
			businessName = "Mayor's Assistant",
			businessType = "mayor_office",
			purchasePrice = 100000,
			dailyIncome = 5000,
			dailyExpenses = 2000,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-383.12f, 47.75f, -321.4f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "bus_station",
			businessName = "Bus Station",
			businessType = "bus_station",
			purchasePrice = 20000,
			dailyIncome = 1500,
			dailyExpenses = 650,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-427.51f, 40.11f, -405.29f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "swimming_pool",
			businessName = "Swimming Pool",
			businessType = "swimming_pool",
			purchasePrice = 20000,
			dailyIncome = 1500,
			dailyExpenses = 700,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-484.84f, 42.09f, -415.82f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "groceries",
			businessName = "Groceries",
			businessType = "grocery_store",
			purchasePrice = 10000,
			dailyIncome = 750,
			dailyExpenses = 350,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-279.57f, 40.13f, -346.69f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "beachside_boutique",
			businessName = "Beachside Boutique",
			businessType = "clothing_store",
			purchasePrice = 15000,
			dailyIncome = 1100,
			dailyExpenses = 500,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(473.38f, 15.73f, -1057.58f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "pets_away_from_home",
			businessName = "Pets Away From Home",
			businessType = "pet_store",
			purchasePrice = 12000,
			dailyIncome = 900,
			dailyExpenses = 400,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(518.75f, 14.82f, -1078.05f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "the_coffe_bean_kiosk",
			businessName = "The Coffee Bean Kiosk",
			businessType = "cafe",
			purchasePrice = 5000,
			dailyIncome = 400,
			dailyExpenses = 180,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(399.48f, 15.73f, -1113.79f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "paradise_gas",
			businessName = "Paradise Gas",
			businessType = "gas_station",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(707.77f, 33.3f, -1009.39f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "magic_motors",
			businessName = "Magic Motors",
			businessType = "car_dealership",
			purchasePrice = 60000,
			dailyIncome = 3500,
			dailyExpenses = 1600,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(767.59f, 39.12f, -915.64f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "wobbly_golf",
			businessName = "Wobbly Golf",
			businessType = "golf_club",
			purchasePrice = 100000,
			dailyIncome = 5000,
			dailyExpenses = 2200,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(1066.59f, 86.09f, -901.77f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "pets",
			businessName = "Pets",
			businessType = "pet_store",
			purchasePrice = 12000,
			dailyIncome = 900,
			dailyExpenses = 400,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-1006.37f, 57.11f, 373.69f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "mountains_gas",
			businessName = "Mountains Gas",
			businessType = "gas_station",
			purchasePrice = 8000,
			dailyIncome = 600,
			dailyExpenses = 250,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(-539.25f, 157.45f, 742.79f)
		});
		allBusinesses.Add(new BusinessData
		{
			businessId = "sawmill_express",
			businessName = "Sawmill Express",
			businessType = "sawmill",
			purchasePrice = 18000,
			dailyIncome = 1300,
			dailyExpenses = 550,
			isOwned = false,
			ownerSaveSlot = -1,
			ownerCharSlot = -1,
			hasJobs = false,
			workerBonus = 0f,
			activeWorkerCount = 0,
			triggerPosition = new Vector3(0f, 0f, 0f)
		});
	}

	private void OnDestroy()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		SaveAll();
		new Harmony("com.wobblylife.plus").UnpatchSelf();
		DestroyAllSigns();
	}

	private void OnApplicationQuit()
	{
		SaveAll();
	}

	private void DestroyAllSigns()
	{
		foreach (GameObject businessSign in businessSigns)
		{
			if ((Object)(object)businessSign != (Object)null)
			{
				Object.Destroy((Object)(object)businessSign);
			}
		}
		businessSigns.Clear();
		signsSpawned = false;
	}

	private void Update()
	{
		float time = Time.time;
		if (time >= nextPlayerScan)
		{
			nextPlayerScan = time + 3f;
			ScanPlayers();
		}
		for (int i = 0; i < maxPlayers; i++)
		{
			if (bInitialized[i] && playerSaveSlot[i] >= 0 && playerCharSlot[i] >= 0 && string.IsNullOrEmpty(playerNames[playerSaveSlot[i]][playerCharSlot[i]]))
			{
				LoadCharacter(playerSaveSlot[i], playerCharSlot[i]);
			}
		}
		if (!signsSpawned && bInitialized[0])
		{
			SpawnBusinessSigns();
		}
		if (signsSpawned && !HasAnyPlayer())
		{
			DestroyAllSigns();
		}
		debtCheckTimer += Time.deltaTime;
		if (debtCheckTimer >= 2f)
		{
			debtCheckTimer = 0f;
			CheckDebtRepayment();
		}
		dailyCycleTimer += Time.deltaTime;
		if (dailyCycleTimer >= 3600f)
		{
			dailyCycleTimer = 0f;
			ProcessDailyBusinessCycle();
		}
		housingCheckTimer += Time.deltaTime;
		if (housingCheckTimer >= 10f)
		{
			housingCheckTimer = 0f;
			CheckHousing();
		}
		autoSaveTimer += Time.deltaTime;
		if (autoSaveTimer >= 60f)
		{
			autoSaveTimer = 0f;
			if (HasAnyPlayer())
			{
				SaveAll();
			}
		}
		for (int j = 0; j < maxPlayers; j++)
		{
			if (notificationTimer[j] > 0f)
			{
				notificationTimer[j] -= Time.deltaTime;
			}
		}
		for (int i = 0; i < maxPlayers; i++)
		{
			int num = playerSaveSlot[i];
			int num2 = playerCharSlot[i];
			if (!bInitialized[i] || num < 0 || num2 < 0 || bShowingLifeSummary[num][num2])
			{
				continue;
			}
			ageTimers[num][num2] += Time.deltaTime;
			if (ageTimers[num][num2] >= 1314000f)
			{
				ageTimers[num][num2] = 0f;
				playerAge[num][num2]++;
				if (playerAge[num][num2] >= 65 && playerAge[num][num2] % 30 == 0)
				{
					ChargePlayer(i, 50);
				}
				if (playerAge[num][num2] >= 65 && !bDying[num][num2] && !bDead[num][num2] && Random.value < (float)(playerAge[num][num2] - 65) * 0.02f)
				{
					bDeathByAge[num][num2] = true;
					bShowingLifeSummary[num][num2] = true;
					((MonoBehaviour)this).StartCoroutine(DeathByAgeSequence(num, num2, i));
				}
			}
			if (!((Object)(object)localCharacters[i] != (Object)null))
			{
				continue;
			}
			MethodInfo method = ((object)localCharacters[i]).GetType().GetMethod("IsDead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null && (bool)method.Invoke(localCharacters[i], null))
			{
				if (!wasDead[i])
				{
					totalDeaths[num][num2]++;
					if (!bDeathByAge[num][num2])
					{
						int playerMoney = GetPlayerMoney(i);
						int num3 = 100;
						if (playerMoney >= num3)
						{
							ChargePlayer(i, -num3);
						}
						else
						{
							if (playerMoney > 0)
							{
								ChargePlayer(i, -playerMoney);
							}
							hospitalDebt[num][num2] += num3 - playerMoney;
						}
					}
					health[num][num2] = 100f;
					hunger[num][num2] = 100f;
					thirst[num][num2] = 100f;
					fatigue[num][num2] = 0f;
					bDead[num][num2] = false;
					bDying[num][num2] = false;
					needsHospitalTeleport[i] = true;
					SaveCharacter(num, num2);
				}
				wasDead[i] = true;
			}
			else
			{
				wasDead[i] = false;
			}
			MethodInfo method2 = ((object)localCharacters[i]).GetType().GetMethod("IsSleeping", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method2 != null && (bool)method2.Invoke(localCharacters[i], null) && fatigue[num][num2] > 0f)
			{
				fatigue[num][num2] = Mathf.Max(fatigue[num][num2] - 3f, 0f);
				if (fatigue[num][num2] <= 0f)
				{
					bFatigueCollapse[num][num2] = false;
				}
			}
		}
		CheckAllBusinessInteraction();
		vitalsTimer += Time.deltaTime;
		if (vitalsTimer >= 1f)
		{
			vitalsTimer = 0f;
			UpdateVitals();
		}
		for (int j = 0; j < maxPlayers; j++)
		{
			eatCooldown[j] -= Time.deltaTime;
		}
		for (int i = 0; i < maxPlayers; i++)
		{
			int num = playerSaveSlot[i];
			int num2 = playerCharSlot[i];
			if (!bInitialized[i] || num < 0 || bDying[num][num2] || eatCooldown[i] > 0f || bFatigueCollapse[num][num2] || bShowingLifeSummary[num][num2])
			{
				continue;
			}
			bool flag = i == 0 && Input.GetKeyDown((KeyCode)102);
			if (!flag)
			{
				try
				{
					flag = Input.GetKeyDown("joystick " + (i + 1) + " button 0");
				}
				catch
				{
				}
			}
			if (flag)
			{
				TryEatFood(i);
			}
		}
	}

	private bool HasAnyPlayer()
	{
		for (int i = 0; i < maxPlayers; i++)
		{
			if (bInitialized[i])
			{
				return true;
			}
		}
		return false;
	}

	private int GetCurrentSaveSlot()
	{
		try
		{
			ComputerSaveGameManager instance = SaveGameManager.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				SaveSlotInfoData activeSlotData = ((SaveGameManager)instance).GetActiveSlotData();
				if (activeSlotData != null)
				{
					return activeSlotData.GetSaveSlot() - 1;
				}
			}
		}
		catch
		{
		}
		return 0;
	}

	private void ScanPlayers()
	{
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < maxPlayers; i++)
		{
			if (bInitialized[i] && ((Object)(object)localCharacters[i] == (Object)null || (Object)(object)localCharacters[i].gameObject == (Object)null))
			{
				bInitialized[i] = false;
				localCharacters[i] = null;
			}
		}
		int currentSaveSlot = GetCurrentSaveSlot();
		MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(true);
		foreach (MonoBehaviour val in array)
		{
			if ((Object)(object)val == (Object)null || ((object)val).GetType().Name != "GameInstance")
			{
				continue;
			}
			MethodInfo method = ((object)val).GetType().GetMethod("GetPlayerCharacters", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method == null || !(method.Invoke(val, null) is IList list))
			{
				continue;
			}
			bool[] array2 = new bool[maxPlayers];
			foreach (object item in list)
			{
				if (item == null)
				{
					continue;
				}
				Component val2 = (Component)((item is Component) ? item : null);
				if ((Object)(object)val2 == (Object)null || (Object)(object)val2.gameObject == (Object)null)
				{
					continue;
				}
				MethodInfo method2 = ((object)val2).GetType().GetMethod("GetPlayerController", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method2 == null)
				{
					continue;
				}
				object? obj = method2.Invoke(val2, null);
				Component val3 = (Component)((obj is Component) ? obj : null);
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				MethodInfo method3 = ((object)val3).GetType().GetMethod("IsLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (method3 == null || !(bool)method3.Invoke(val3, null))
				{
					continue;
				}
				MethodInfo method4 = ((object)val3).GetType().GetMethod("GetLocalPlayerid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				int i = 0;
				if (method4 != null)
				{
					i = (int)method4.Invoke(val3, null);
				}
				if (i >= maxPlayers)
				{
					continue;
				}
				array2[i] = true;
				int num = 0;
				Type type = Type.GetType("LocalPlayerManager, Game");
				if (type != null)
				{
					MethodInfo method5 = type.GetMethod("GetPlayerSelectedSlot", BindingFlags.Static | BindingFlags.Public);
					if (method5 != null)
					{
						num = (int)method5.Invoke(null, new object[1] { i });
					}
				}
				if (num < 0)
				{
					num = 0;
				}
				if (playerSaveSlot[i] != currentSaveSlot || playerCharSlot[i] != num)
				{
					if (playerSaveSlot[i] >= 0 && playerCharSlot[i] >= 0)
					{
						SaveCharacter(playerSaveSlot[i], playerCharSlot[i]);
					}
					playerSaveSlot[i] = currentSaveSlot;
					playerCharSlot[i] = num;
					LoadCharacter(currentSaveSlot, num);
				}
				if (!((Object)(object)localCharacters[i] != (Object)(object)val2))
				{
					continue;
				}
				if (firstSpawn[i])
				{
					firstSpawn[i] = false;
				}
				else if (needsHospitalTeleport[i])
				{
					needsHospitalTeleport[i] = false;
					MethodInfo method6 = ((object)val2).GetType().GetMethod("SetPlayerPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (method6 != null)
					{
						method6.Invoke(val2, new object[1] { hospitalPos });
					}
				}
				localCharacters[i] = val2;
				bInitialized[i] = true;
			}
			for (int k = 0; k < maxPlayers; k++)
			{
				if (!array2[k] && bInitialized[k])
				{
					if (playerSaveSlot[k] >= 0 && playerCharSlot[k] >= 0)
					{
						SaveCharacter(playerSaveSlot[k], playerCharSlot[k]);
					}
					bInitialized[k] = false;
					localCharacters[k] = null;
				}
			}
			break;
		}
	}

	private void CheckAllBusinessInteraction()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < maxPlayers; i++)
		{
			if (!bInitialized[i] || (Object)(object)localCharacters[i] == (Object)null)
			{
				isNearBusiness[i] = false;
				nearestBusiness[i] = null;
				continue;
			}
			Vector3 playerPos = GetPlayerPos(i);
			if (playerPos == Vector3.zero)
			{
				isNearBusiness[i] = false;
				nearestBusiness[i] = null;
				continue;
			}
			BusinessData businessData = null;
			float num = 5f;
			foreach (BusinessData allBusiness in allBusinesses)
			{
				float num2 = Vector3.Distance(playerPos, allBusiness.triggerPosition);
				if (num2 < num)
				{
					num = num2;
					businessData = allBusiness;
				}
			}
			nearestBusiness[i] = businessData;
			isNearBusiness[i] = businessData != null;
			if (businessData == null)
			{
				continue;
			}
			bool keyDown = Input.GetKeyDown((KeyCode)102);
			if (!keyDown)
			{
				try
				{
					keyDown = Input.GetKeyDown("joystick " + (i + 1) + " button 3");
				}
				catch
				{
				}
			}
			if (keyDown)
			{
				int num3 = playerSaveSlot[i];
				int num4 = playerCharSlot[i];
				if (businessData.isOwned && businessData.ownerSaveSlot == num3 && businessData.ownerCharSlot == num4)
				{
					SellBusiness(i, businessData);
				}
				else if (!businessData.isOwned)
				{
					BuyBusiness(i, businessData);
				}
			}
		}
	}

	private void BuyBusiness(int pid, BusinessData biz)
	{
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		if (!biz.isOwned && !((Object)(object)localCharacters[pid] == (Object)null))
		{
			int playerMoney = GetPlayerMoney(pid);
			if (playerMoney < biz.purchasePrice)
			{
				ShowNotification(pid, "Need $" + (biz.purchasePrice - playerMoney) + " more!", err: true);
				return;
			}
			ChargePlayer(pid, -biz.purchasePrice);
			biz.isOwned = true;
			biz.ownerSaveSlot = playerSaveSlot[pid];
			biz.ownerCharSlot = playerCharSlot[pid];
			UpdateSignColor(biz.businessId, Color.green);
			ShowNotification(pid, "Purchased " + biz.businessName + "!", err: false);
			SaveAll();
		}
	}

	private void SellBusiness(int pid, BusinessData biz)
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		if (biz.isOwned && biz.ownerSaveSlot == playerSaveSlot[pid] && biz.ownerCharSlot == playerCharSlot[pid])
		{
			int num = Mathf.RoundToInt((float)biz.purchasePrice * 0.7f);
			ChargePlayer(pid, num);
			biz.isOwned = false;
			biz.ownerSaveSlot = -1;
			biz.ownerCharSlot = -1;
			biz.activeWorkerCount = 0;
			UpdateSignColor(biz.businessId, biz.hasJobs ? Color.yellow : Color.white);
			ShowNotification(pid, "Sold " + biz.businessName + " for $" + num + "!", err: false);
			SaveAll();
		}
	}

	private void SpawnBusinessSigns()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Expected O, but got Unknown
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Expected O, but got Unknown
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		if (signsSpawned)
		{
			return;
		}
		DestroyAllSigns();
		foreach (BusinessData allBusiness in allBusinesses)
		{
			if (!(allBusiness.triggerPosition == Vector3.zero))
			{
				GameObject val = GameObject.CreatePrimitive((PrimitiveType)2);
				val.transform.position = allBusiness.triggerPosition;
				val.transform.localScale = new Vector3(0.15f, 1.5f, 0.15f);
				Object.Destroy((Object)(object)val.GetComponent<Collider>());
				GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3);
				val2.transform.position = allBusiness.triggerPosition + new Vector3(0f, 1.2f, 0f);
				val2.transform.localScale = new Vector3(0.6f, 0.4f, 0.05f);
				Renderer component = val2.GetComponent<Renderer>();
				if ((Object)(object)component != (Object)null)
				{
					Color color = (allBusiness.isOwned ? Color.green : (allBusiness.hasJobs ? Color.yellow : Color.white));
					Material val3 = new Material(Shader.Find("Standard"));
					val3.color = color;
					component.material = val3;
				}
				GameObject val4 = new GameObject("Sign_" + allBusiness.businessId);
				val4.transform.position = allBusiness.triggerPosition;
				val.transform.SetParent(val4.transform);
				val2.transform.SetParent(val4.transform);
				businessSigns.Add(val4);
			}
		}
		signsSpawned = true;
	}

	private void ProcessDailyBusinessCycle()
	{
		for (int i = 0; i < maxPlayers; i++)
		{
			if (!bInitialized[i])
			{
				continue;
			}
			int num = playerSaveSlot[i];
			if (num < 0)
			{
				continue;
			}
			int num2 = playerCharSlot[i];
			foreach (BusinessData allBusiness in allBusinesses)
			{
				if (allBusiness.isOwned && allBusiness.ownerSaveSlot == num && allBusiness.ownerCharSlot == num2)
				{
					float num3 = 1f + (float)allBusiness.activeWorkerCount * allBusiness.workerBonus;
					int num4 = Mathf.RoundToInt((float)allBusiness.dailyIncome * num3);
					int num5 = num4 - allBusiness.dailyExpenses;
					if (num5 != 0)
					{
						ChargePlayer(i, num5);
					}
				}
			}
			int num6 = CalculateHousingCost(num);
			if (num6 > 0)
			{
				ChargePlayer(i, -num6);
			}
		}
		SaveAll();
	}

	private int CalculateHousingCost(int ss)
	{
		int num = 0;
		if (playerHouseCosts[ss] == null)
		{
			return 0;
		}
		foreach (KeyValuePair<int, int> item in playerHouseCosts[ss])
		{
			int value = item.Value;
			num = ((value > 600) ? ((value > 750) ? ((value > 1000) ? ((value > 1500) ? ((value > 2000) ? ((value > 5000) ? ((value > 8000) ? ((value > 10000) ? (num + 200) : (num + 180)) : (num + 120)) : (num + 80)) : (num + 40)) : (num + 30)) : (num + 20)) : (num + 15)) : (num + 10));
		}
		return num;
	}

	private void CheckHousing()
	{
		for (int i = 0; i < maxPlayers; i++)
		{
			if (!bInitialized[i] || (Object)(object)localCharacters[i] == (Object)null)
			{
				continue;
			}
			int num = playerSaveSlot[i];
			if (num < 0)
			{
				continue;
			}
			Dictionary<int, int> playerHousesWithCosts = GetPlayerHousesWithCosts(i);
			bool flag = playerHousesWithCosts.Count != playerHouseCosts[num].Count;
			if (!flag)
			{
				foreach (KeyValuePair<int, int> item in playerHousesWithCosts)
				{
					if (!playerHouseCosts[num].ContainsKey(item.Key) || playerHouseCosts[num][item.Key] != item.Value)
					{
						flag = true;
						break;
					}
				}
			}
			if (flag)
			{
				playerHouseCosts[num] = playerHousesWithCosts;
				playerHouseCount[num][playerCharSlot[i]] = playerHousesWithCosts.Count;
				SaveCharacter(num, playerCharSlot[i]);
			}
		}
	}

	private Dictionary<int, int> GetPlayerHousesWithCosts(int pid)
	{
		Dictionary<int, int> dictionary = new Dictionary<int, int>();
		if ((Object)(object)localCharacters[pid] == (Object)null)
		{
			return dictionary;
		}
		try
		{
			MethodInfo method = ((object)localCharacters[pid]).GetType().GetMethod("GetPlayerController", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method == null)
			{
				return dictionary;
			}
			object? obj = method.Invoke(localCharacters[pid], null);
			PlayerController val = (PlayerController)((obj is PlayerController) ? obj : null);
			if ((Object)(object)val == (Object)null)
			{
				return dictionary;
			}
			BuyableHouse[] array = Object.FindObjectsOfType<BuyableHouse>();
			BuyableHouse[] array2 = array;
			foreach (BuyableHouse val2 in array2)
			{
				if (!((Object)(object)val2 == (Object)null) && val2.IsHouseOwner(val))
				{
					dictionary[((object)val2).GetHashCode()] = val2.GetHousePrice();
				}
			}
		}
		catch
		{
		}
		return dictionary;
	}

	private IEnumerator DeathByAgeSequence(int ss, int cs, int pid)
	{
		bDying[ss][cs] = true;
		bDead[ss][cs] = true;
		yield return (object)new WaitForSeconds(5f);
		playerAge[ss][cs] = 18;
		ageTimers[ss][cs] = 0f;
		health[ss][cs] = 100f;
		hunger[ss][cs] = 100f;
		thirst[ss][cs] = 100f;
		fatigue[ss][cs] = 0f;
		bDead[ss][cs] = false;
		bDying[ss][cs] = false;
		bDeathByAge[ss][cs] = false;
		playerNames[ss][cs] = firstNames[Random.Range(0, firstNames.Length)] + " " + lastNames[Random.Range(0, lastNames.Length)];
		namesGenerated[ss][cs] = true;
		totalDeaths[ss][cs] = 0;
		totalFoodEaten[ss][cs] = 0;
		if (pid >= 0)
		{
			firstSpawn[pid] = true;
		}
		SaveAll();
		yield return (object)new WaitForSeconds(3f);
		bShowingLifeSummary[ss][cs] = false;
	}

	private int GetPlayerMoney(int pid)
	{
		if ((Object)(object)localCharacters[pid] == (Object)null)
		{
			return 0;
		}
		MethodInfo method = ((object)localCharacters[pid]).GetType().GetMethod("GetPlayerController", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method == null)
		{
			return 0;
		}
		object? obj = method.Invoke(localCharacters[pid], null);
		Component val = (Component)((obj is Component) ? obj : null);
		if ((Object)(object)val == (Object)null)
		{
			return 0;
		}
		MethodInfo method2 = ((object)val).GetType().GetMethod("GetPlayerControllerEmployment", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method2 == null)
		{
			return 0;
		}
		object? obj2 = method2.Invoke(val, null);
		Component val2 = (Component)((obj2 is Component) ? obj2 : null);
		if ((Object)(object)val2 == (Object)null)
		{
			return 0;
		}
		MethodInfo method3 = ((object)val2).GetType().GetMethod("GetLocalMoney", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		return (method3 != null) ? ((int)method3.Invoke(val2, null)) : 0;
	}

	private void ChargePlayer(int pid, int amount)
	{
		if ((Object)(object)localCharacters[pid] == (Object)null)
		{
			return;
		}
		MethodInfo method = ((object)localCharacters[pid]).GetType().GetMethod("GetPlayerController", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method == null)
		{
			return;
		}
		object? obj = method.Invoke(localCharacters[pid], null);
		Component val = (Component)((obj is Component) ? obj : null);
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		MethodInfo method2 = ((object)val).GetType().GetMethod("GetPlayerControllerEmployment", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method2 == null)
		{
			return;
		}
		object? obj2 = method2.Invoke(val, null);
		Component val2 = (Component)((obj2 is Component) ? obj2 : null);
		if (!((Object)(object)val2 == (Object)null))
		{
			MethodInfo method3 = ((object)val2).GetType().GetMethod("UpdateMoney", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method3 != null)
			{
				method3.Invoke(val2, new object[1] { amount });
			}
		}
	}

	private void UpdateVitals()
	{
		for (int i = 0; i < maxPlayers; i++)
		{
			if (!bInitialized[i])
			{
				continue;
			}
			int num = playerSaveSlot[i];
			int num2 = playerCharSlot[i];
			if (num < 0 || bDying[num][num2] || bDead[num][num2] || bShowingLifeSummary[num][num2])
			{
				continue;
			}
			hunger[num][num2] -= 0.028f;
			thirst[num][num2] -= 0.037f;
			if (hunger[num][num2] <= 0f)
			{
				hungerTimer[i] += 1f;
				if (hungerTimer[i] >= 30f)
				{
					hungerTimer[i] = 0f;
					health[num][num2] -= 3f;
				}
			}
			else
			{
				hungerTimer[i] = 0f;
			}
			if (thirst[num][num2] <= 0f)
			{
				thirstTimer[i] += 1f;
				if (thirstTimer[i] >= 30f)
				{
					thirstTimer[i] = 0f;
					health[num][num2] -= 5f;
				}
			}
			else
			{
				thirstTimer[i] = 0f;
			}
			if (!bFatigueCollapse[num][num2])
			{
				fatigue[num][num2] += 0.028f;
				if (fatigue[num][num2] >= maxFatigue)
				{
					fatigue[num][num2] = maxFatigue;
					((MonoBehaviour)this).StartCoroutine(FatigueCollapse(num, num2));
				}
			}
			if (health[num][num2] <= 0f && !bDead[num][num2] && !bDying[num][num2])
			{
				((MonoBehaviour)this).StartCoroutine(DeathSequence(num, num2));
			}
		}
	}

	private IEnumerator FatigueCollapse(int ss, int cs)
	{
		bFatigueCollapse[ss][cs] = true;
		yield return (object)new WaitForSeconds(3f);
		fatigue[ss][cs] = 90f;
		bFatigueCollapse[ss][cs] = false;
	}

	private IEnumerator DeathSequence(int ss, int cs)
	{
		bDying[ss][cs] = true;
		bDead[ss][cs] = true;
		yield return (object)new WaitForSeconds(5f);
		health[ss][cs] = 100f;
		hunger[ss][cs] = 100f;
		thirst[ss][cs] = 100f;
		fatigue[ss][cs] = 0f;
		bDead[ss][cs] = false;
		bDying[ss][cs] = false;
	}

	private void CheckDebtRepayment()
	{
		for (int i = 0; i < maxPlayers; i++)
		{
			if (!bInitialized[i])
			{
				continue;
			}
			int num = playerSaveSlot[i];
			int num2 = playerCharSlot[i];
			if (num >= 0 && hospitalDebt[num][num2] > 0)
			{
				int playerMoney = GetPlayerMoney(i);
				if (lastKnownMoney[i] >= 0 && playerMoney > lastKnownMoney[i])
				{
					int num3 = playerMoney - lastKnownMoney[i];
					int num4 = Mathf.Min(num3, hospitalDebt[num][num2]);
					hospitalDebt[num][num2] -= num4;
					ChargePlayer(i, -num4);
				}
				lastKnownMoney[i] = playerMoney;
			}
		}
	}

	private void TryEatFood(int pid)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)localCharacters[pid] == (Object)null)
		{
			return;
		}
		Vector3 playerPos = GetPlayerPos(pid);
		if (playerPos == Vector3.zero)
		{
			return;
		}
		GameObject[] array = Object.FindObjectsOfType<GameObject>();
		GameObject val = null;
		float num = 5f;
		string key = "";
		GameObject[] array2 = array;
		foreach (GameObject val2 in array2)
		{
			if ((Object)(object)val2 == (Object)null)
			{
				continue;
			}
			float num2 = Vector3.Distance(playerPos, val2.transform.position);
			if (num2 >= num)
			{
				continue;
			}
			foreach (string key2 in foodDB.Keys)
			{
				if (((Object)val2).name.IndexOf(key2, StringComparison.OrdinalIgnoreCase) >= 0)
				{
					num = num2;
					val = val2;
					key = key2;
					break;
				}
			}
		}
		if ((Object)(object)val != (Object)null && foodDB.ContainsKey(key))
		{
			FoodData foodData = foodDB[key];
			int num3 = playerSaveSlot[pid];
			int num4 = playerCharSlot[pid];
			hunger[num3][num4] = Mathf.Clamp(hunger[num3][num4] + foodData.h, 0f, 100f);
			thirst[num3][num4] = Mathf.Clamp(thirst[num3][num4] + foodData.t, 0f, 100f);
			totalFoodEaten[num3][num4]++;
			Object.Destroy((Object)(object)val);
			eatCooldown[pid] = 0.5f;
		}
	}

	private Vector3 GetPlayerPos(int pid)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)localCharacters[pid] == (Object)null)
		{
			return Vector3.zero;
		}
		MethodInfo method = ((object)localCharacters[pid]).GetType().GetMethod("GetPlayerBody", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method != null)
		{
			object? obj = method.Invoke(localCharacters[pid], null);
			Component val = (Component)((obj is Component) ? obj : null);
			if ((Object)(object)val != (Object)null)
			{
				return val.transform.position;
			}
		}
		return localCharacters[pid].gameObject.transform.position;
	}

	private void UpdateSignColor(string bid, Color c)
	{
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		foreach (GameObject businessSign in businessSigns)
		{
			if (!(((Object)businessSign).name == "Sign_" + bid))
			{
				continue;
			}
			Renderer[] componentsInChildren = businessSign.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if ((Object)(object)val.material != (Object)null)
				{
					val.material.color = c;
				}
			}
			break;
		}
	}

	private void ShowNotification(int pid, string msg, bool err)
	{
		notificationMessage[pid] = msg;
		notificationIsError[pid] = err;
		notificationTimer[pid] = 4f;
	}

	private static int GetPlayerSlot(PlayerController pc)
	{
		if ((Object)(object)pc == (Object)null)
		{
			return -1;
		}
		MethodInfo method = ((object)pc).GetType().GetMethod("GetLocalPlayerid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		return (method != null) ? ((int)method.Invoke(pc, null)) : (-1);
	}

	private void OnGUI()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		//IL_0570: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_068a: Unknown result type (might be due to invalid IL or missing references)
		//IL_066f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0690: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d2: Expected O, but got Unknown
		//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_072f: Unknown result type (might be due to invalid IL or missing references)
		if (labelStyle == null)
		{
			labelStyle = new GUIStyle();
			labelStyle.normal.textColor = Color.white;
			labelStyle.fontSize = 9;
			labelStyle.fontStyle = (FontStyle)1;
			labelStyle.alignment = (TextAnchor)4;
			debtStyle = new GUIStyle();
			debtStyle.normal.textColor = new Color(1f, 0.3f, 0.3f);
			debtStyle.fontSize = 9;
			debtStyle.fontStyle = (FontStyle)1;
			debtStyle.alignment = (TextAnchor)4;
			ageStyle = new GUIStyle();
			ageStyle.normal.textColor = new Color(0.7f, 0.7f, 1f);
			ageStyle.fontSize = 9;
			ageStyle.fontStyle = (FontStyle)1;
			ageStyle.alignment = (TextAnchor)4;
			redTex = MakeTex(1, 1, new Color(0.85f, 0.15f, 0.15f));
			orangeTex = MakeTex(1, 1, new Color(1f, 0.55f, 0.1f));
			blueTex = MakeTex(1, 1, new Color(0.15f, 0.5f, 1f));
			bgTex = MakeTex(1, 1, new Color(0.05f, 0.05f, 0.05f, 0.75f));
			fatigueTex = MakeTex(1, 1, new Color(0.5f, 0.4f, 0.9f));
		}
		int num = 0;
		for (int i = 0; i < maxPlayers; i++)
		{
			if (bInitialized[i])
			{
				num++;
			}
		}
		for (int j = 0; j < maxPlayers; j++)
		{
			if (!bInitialized[j])
			{
				continue;
			}
			int num2 = playerSaveSlot[j];
			int num3 = playerCharSlot[j];
			if (num2 < 0 || bShowingLifeSummary[num2][num3])
			{
				continue;
			}
			float num4 = 140f;
			float num5 = 14f;
			float num6 = 20f;
			float num7 = Screen.width;
			float num8 = Screen.height;
			float num9 = 20f;
			float num10 = 20f;
			switch (num)
			{
			case 1:
				num9 = num7 - num4 - 20f;
				num10 = num8 - 155f;
				break;
			case 2:
				num9 = ((j == 0) ? (num7 / 2f - num4 - 20f) : (num7 - num4 - 20f));
				num10 = num8 - 155f;
				break;
			case 3:
				switch (j)
				{
				case 0:
					num9 = num7 / 2f - num4 - 20f;
					num10 = num8 - 155f;
					break;
				case 1:
					num9 = num7 - num4 - 20f;
					num10 = num8 - 155f;
					break;
				default:
					num9 = num7 - num4 - 20f;
					num10 = num8 / 2f - 80f;
					break;
				}
				break;
			default:
				switch (j)
				{
				case 0:
					num9 = num7 / 2f - num4 - 20f;
					num10 = num8 - 155f;
					break;
				case 1:
					num9 = num7 - num4 - 20f;
					num10 = num8 - 155f;
					break;
				case 2:
					num9 = num7 / 2f - num4 - 20f;
					num10 = num8 / 2f - 80f;
					break;
				case 3:
					num9 = num7 - num4 - 20f;
					num10 = num8 / 2f - 80f;
					break;
				}
				break;
			}
			GUI.Box(new Rect(num9 - 3f, num10 - 18f, num4 + 45f, 140f), "");
			GUI.Label(new Rect(num9, num10 - 18f, num4, 16f), playerNames[num2][num3], labelStyle);
			DrawBar(num9, num10, num4, num5, health[num2][num3] / 100f, redTex, "HP:" + (int)health[num2][num3]);
			DrawBar(num9, num10 + num6, num4, num5, hunger[num2][num3] / 100f, orangeTex, "H:" + (int)hunger[num2][num3]);
			DrawBar(num9, num10 + num6 * 2f, num4, num5, thirst[num2][num3] / 100f, blueTex, "T:" + (int)thirst[num2][num3]);
			DrawBar(num9, num10 + num6 * 3f, num4, num5, fatigue[num2][num3] / maxFatigue, fatigueTex, "Fatigue:" + (int)fatigue[num2][num3] + "%");
			GUI.Label(new Rect(num9, num10 + num6 * 4f + 4f, num4, num5), "Age: " + playerAge[num2][num3], ageStyle);
			if (hospitalDebt[num2][num3] > 0)
			{
				GUI.Label(new Rect(num9, num10 + num6 * 5f + 4f, num4, num5), "Debt: $" + hospitalDebt[num2][num3], debtStyle);
			}
			if (isNearBusiness[j] && nearestBusiness[j] != null)
			{
				DrawBusinessUI(j, num);
			}
			if (notificationTimer[j] > 0f && !string.IsNullOrEmpty(notificationMessage[j]))
			{
				float num11 = 400f;
				float num12 = 45f;
				Color c = (notificationIsError[j] ? new Color(0.8f, 0.2f, 0.2f, 0.9f) : new Color(0.2f, 0.7f, 0.2f, 0.9f));
				GUI.DrawTexture(new Rect((num7 - num11) / 2f, num8 - num12 - 30f, num11, num12), (Texture)(object)MakeTex(1, 1, c));
				GUIStyle val = new GUIStyle(GUI.skin.label);
				val.alignment = (TextAnchor)4;
				val.fontSize = 13;
				val.fontStyle = (FontStyle)1;
				val.normal.textColor = Color.white;
				val.wordWrap = true;
				GUI.Label(new Rect((num7 - num11) / 2f + 5f, num8 - num12 - 30f, num11 - 10f, num12), notificationMessage[j], val);
			}
		}
	}

	private void DrawBusinessUI(int pid, int ac)
	{
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Expected O, but got Unknown
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Expected O, but got Unknown
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Expected O, but got Unknown
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Expected O, but got Unknown
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0422: Unknown result type (might be due to invalid IL or missing references)
		//IL_045f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_051a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_055d: Unknown result type (might be due to invalid IL or missing references)
		//IL_058f: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0638: Unknown result type (might be due to invalid IL or missing references)
		//IL_0631: Unknown result type (might be due to invalid IL or missing references)
		//IL_0660: Unknown result type (might be due to invalid IL or missing references)
		//IL_069a: Unknown result type (might be due to invalid IL or missing references)
		BusinessData businessData = nearestBusiness[pid];
		if (businessData == null)
		{
			return;
		}
		int playerMoney = GetPlayerMoney(pid);
		float num = 320f;
		float num2 = (businessData.isOwned ? 170f : 230f);
		float num3 = Screen.width;
		float num4 = Screen.height;
		float num5 = Mathf.Clamp(ac switch
		{
			1 => num3 / 2f, 
			2 => (pid == 0) ? (num3 / 4f) : (num3 * 3f / 4f), 
			3 => (pid == 0) ? (num3 / 4f) : (num3 * 3f / 4f), 
			_ => (pid % 2 == 0) ? (num3 / 4f) : (num3 * 3f / 4f), 
		} - num / 2f, 5f, num3 - num - 5f);
		float num6 = Mathf.Clamp((num4 - num2) / 2f, 5f, num4 - num2 - 5f);
		GUI.Box(new Rect(num5, num6, num, num2), "");
		GUIStyle val = new GUIStyle(GUI.skin.label);
		val.alignment = (TextAnchor)4;
		val.fontStyle = (FontStyle)1;
		val.fontSize = 16;
		val.normal.textColor = (businessData.isOwned ? Color.green : Color.yellow);
		GUIStyle val2 = new GUIStyle(GUI.skin.label);
		val2.fontSize = 12;
		val2.alignment = (TextAnchor)4;
		val2.normal.textColor = Color.white;
		GUIStyle val3 = new GUIStyle(GUI.skin.label);
		val3.fontSize = 13;
		val3.fontStyle = (FontStyle)1;
		val3.alignment = (TextAnchor)4;
		GUIStyle val4 = new GUIStyle(GUI.skin.label);
		val4.fontSize = 11;
		val4.alignment = (TextAnchor)4;
		val4.normal.textColor = new Color(0.7f, 0.7f, 1f);
		GUI.Label(new Rect(num5, num6 + 8f, num, 25f), businessData.businessName, val);
		if (businessData.isOwned && businessData.ownerSaveSlot >= 0)
		{
			string text = playerNames[businessData.ownerSaveSlot][businessData.ownerCharSlot];
			if (string.IsNullOrEmpty(text))
			{
				text = "S" + (businessData.ownerSaveSlot + 1) + "C" + (businessData.ownerCharSlot + 1);
			}
			if (businessData.ownerSaveSlot == playerSaveSlot[pid] && businessData.ownerCharSlot == playerCharSlot[pid])
			{
				text = "YOU";
			}
			GUI.Label(new Rect(num5, num6 + 33f, num, 18f), "Owner: " + text, val4);
		}
		float num7 = (businessData.isOwned ? (num6 + 55f) : (num6 + 50f));
		if (businessData.isOwned && businessData.ownerSaveSlot == playerSaveSlot[pid] && businessData.ownerCharSlot == playerCharSlot[pid])
		{
			float num8 = 1f + (float)businessData.activeWorkerCount * businessData.workerBonus;
			int num9 = Mathf.RoundToInt((float)businessData.dailyIncome * num8);
			int num10 = num9 - businessData.dailyExpenses;
			GUI.Label(new Rect(num5, num7, num, 22f), "Workers: " + businessData.activeWorkerCount, val2);
			GUI.Label(new Rect(num5, num7 + 25f, num, 22f), "Profit: $" + num10 + "/day", val2);
			GUI.Label(new Rect(num5, num7 + 50f, num, 22f), "Sell: $" + Mathf.RoundToInt((float)businessData.purchasePrice * 0.7f), val2);
			GUI.backgroundColor = new Color(1f, 0.5f, 0.3f);
			if (GUI.Button(new Rect(num5 + 60f, num7 + 80f, num - 120f, 28f), "SELL [F/Y]"))
			{
				SellBusiness(pid, businessData);
			}
			GUI.backgroundColor = Color.white;
			return;
		}
		if (businessData.isOwned)
		{
			GUI.Label(new Rect(num5, num7, num, 22f), "Owned by " + playerNames[businessData.ownerSaveSlot][businessData.ownerCharSlot], val2);
			return;
		}
		val3.normal.textColor = ((playerMoney >= businessData.purchasePrice) ? Color.green : Color.red);
		GUI.Label(new Rect(num5, num7, num, 22f), "Balance: $" + playerMoney, val3);
		GUI.Label(new Rect(num5, num7 + 30f, num, 22f), "Price: $" + businessData.purchasePrice, val2);
		GUI.Label(new Rect(num5, num7 + 55f, num, 22f), "Income: $" + businessData.dailyIncome + "/d", val2);
		GUI.Label(new Rect(num5, num7 + 80f, num, 22f), "Expenses: $" + businessData.dailyExpenses + "/d", val2);
		GUI.Label(new Rect(num5, num7 + 105f, num, 22f), businessData.hasJobs ? "WORK AVAILABLE" : "PASSIVE", val2);
		bool flag = playerMoney >= businessData.purchasePrice;
		GUI.backgroundColor = (flag ? Color.green : Color.red);
		if (GUI.Button(new Rect(num5 + 45f, num7 + 135f, num - 90f, 30f), flag ? "BUY [F/Y]" : "CANNOT AFFORD") && flag)
		{
			BuyBusiness(pid, businessData);
		}
		GUI.backgroundColor = Color.white;
	}

	private void DrawBar(float x, float y, float w, float h, float f, Texture2D tex, string l)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		GUI.DrawTexture(new Rect(x, y, w, h), (Texture)(object)bgTex);
		GUI.DrawTexture(new Rect(x, y, w * Mathf.Clamp01(f), h), (Texture)(object)tex);
		GUI.Label(new Rect(x, y - 1f, w, h), l, labelStyle);
	}

	private Texture2D MakeTex(int w, int h, Color c)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		Color[] array = (Color[])(object)new Color[w * h];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = c;
		}
		Texture2D val = new Texture2D(w, h);
		val.SetPixels(array);
		val.Apply();
		return val;
	}
}