using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Serialization;
using JetBrains.Annotations;
using MilkShake;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Profiling;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
public class AchievementDisplay : MonoBehaviour
{
public enum WinState
{
Won = -3,
Lost,
Draw
}
public GameObject achievementPrefab;
public Transform achievementParent;
private int achievementsPerPage = 8;
private int nAchievements;
private int nPages;
private int currentPage;
private Achievement[] achievements = (Achievement[])(object)new Achievement[0];
private void OnEnable()
{
currentPage = 0;
if (achievements.Length < 1)
{
achievements = SteamUserStats.Achievements.ToArray();
}
nAchievements = achievements.Length;
nPages = Mathf.FloorToInt((float)nAchievements / (float)achievementsPerPage);
LoadPage(currentPage);
}
private void LoadPage(int page)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
for (int num = achievementParent.childCount - 1; num >= 0; num--)
{
Object.Destroy((Object)(object)((Component)achievementParent.GetChild(num)).gameObject);
}
int num2 = achievementsPerPage * page;
for (int i = num2; i < achievements.Length; i++)
{
Object.Instantiate<GameObject>(achievementPrefab, achievementParent).GetComponent<AchievementPrefab>().SetAchievement(achievements[i]);
if (i >= num2 + achievementsPerPage - 1)
{
break;
}
}
}
public void NextPage(int dir)
{
if ((dir >= 0 || currentPage != 0) && (dir <= 0 || currentPage < nPages))
{
currentPage += dir;
LoadPage(currentPage);
}
}
}
public class AchievementManager : MonoBehaviour
{
public static AchievementManager Instance;
public InventoryItem[] gems;
private void Awake()
{
Instance = this;
SteamUserStats.OnAchievementProgress += AchievementChanged;
}
private void Start()
{
GameStarted();
}
private void AchievementChanged(Achievement ach, int currentProgress, int progress)
{
if (((Achievement)(ref ach)).State)
{
((Achievement)(ref ach)).Trigger(true);
Debug.Log((object)(((Achievement)(ref ach)).Name + " WAS UNLOCKED!"));
}
}
public void CheckGameOverAchievements(int endState)
{
if (!CanUseAchievements())
{
return;
}
bool onlyRock = GameManager.instance.onlyRock;
bool damageTaken = GameManager.instance.damageTaken;
bool powerupsPickedup = GameManager.instance.powerupsPickedup;
int currentDay = GameManager.instance.currentDay;
GameSettings.GameMode gameMode = GameManager.gameSettings.gameMode;
GameSettings.Difficulty difficulty = GameManager.gameSettings.difficulty;
if (gameMode == GameSettings.GameMode.Survival && endState == -3)
{
switch (difficulty)
{
case GameSettings.Difficulty.Easy:
SteamUserStats.AddStat("WinsEasy", 1);
Debug.Log((object)("Game finished on Easy: " + SteamUserStats.GetStatInt("WinsEasy")));
break;
case GameSettings.Difficulty.Normal:
SteamUserStats.AddStat("WinsNormal", 1);
Debug.Log((object)("Game finished on normal: " + SteamUserStats.GetStatInt("WinsNormal")));
break;
case GameSettings.Difficulty.Gamer:
SteamUserStats.AddStat("WinsGamer", 1);
Debug.Log((object)("Game finished on Gamer: " + SteamUserStats.GetStatInt("WinsGamer")));
if (currentDay < 10)
{
SteamUserStats.AddStat("GamerMove", 1);
Debug.Log((object)("Game finished on Gamer in less than 10 days: " + SteamUserStats.GetStatInt("GamerMove")));
}
break;
}
if (currentDay < 8)
{
SteamUserStats.AddStat("Speedrunner", 1);
Debug.Log((object)("Game finished in less than 8 days: " + SteamUserStats.GetStatInt("Speedrunner")));
}
if (!powerupsPickedup)
{
SteamUserStats.AddStat("NoPowerups", 1);
Debug.Log((object)("Game finished without powerups: " + SteamUserStats.GetStatInt("NoPowerups")));
}
if (!damageTaken && difficulty >= GameSettings.Difficulty.Normal)
{
switch (NetworkController.Instance.nPlayers)
{
case 1:
SteamUserStats.AddStat("Untouchable", 1);
Debug.Log((object)("game finished without taking damage 1: " + SteamUserStats.GetStatInt("Untouchable")));
break;
case 2:
SteamUserStats.AddStat("Dream Team", 1);
Debug.Log((object)("game finished without taking 2: " + SteamUserStats.GetStatInt("Dream Team")));
break;
case 4:
SteamUserStats.AddStat("The bois", 1);
Debug.Log((object)("game finished without taking damage 4: " + SteamUserStats.GetStatInt("The bois")));
break;
case 8:
SteamUserStats.AddStat("Sweat and tears", 1);
Debug.Log((object)("game finished without taking damage 8: " + SteamUserStats.GetStatInt("Sweat and tears")));
break;
}
}
if (onlyRock)
{
SteamUserStats.AddStat("Caveman", 1);
Debug.Log((object)("game finished using only a rock: " + SteamUserStats.GetStatInt("Caveman")));
}
if (difficulty >= GameSettings.Difficulty.Normal && onlyRock && !damageTaken && !powerupsPickedup)
{
SteamUserStats.AddStat("Muck", 1);
Debug.Log((object)("Literally did the impossible: " + SteamUserStats.GetStatInt("Muck")));
}
SteamUserStats.AddStat("GamesWon", 1);
Debug.Log((object)("GamesWon: " + SteamUserStats.GetStatInt("GamesWon")));
}
SteamUserStats.StoreStats();
}
public void LeaveMuck()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Set sail", 1);
Debug.Log((object)("Leaving muck. Left: " + SteamUserStats.GetStatInt("Set sail")));
SteamUserStats.StoreStats();
}
}
public void AddKill(PlayerStatus.WeaponHitType type, Mob mob)
{
if (CanUseAchievements() && !mob.countedKill)
{
mob.countedKill = true;
bool flag = mob.IsBuff();
string name = mob.mobType.name;
Debug.Log((object)("Is buff: " + flag));
SteamUserStats.AddStat("Kills", 1);
SteamUserStats.AddStat("TotalKills", 1);
if (type == PlayerStatus.WeaponHitType.Ranged)
{
SteamUserStats.AddStat("BowKills", 1);
}
if (flag)
{
Debug.Log((object)"Is buff so adding kills");
SteamUserStats.AddStat("BuffKills", 1);
}
if (name == "Cow")
{
SteamUserStats.AddStat("Cow Kills", 1);
}
if (name == "Big Chunk")
{
SteamUserStats.AddStat("BigChunkKills", 1);
CheckAllBossesKilled();
}
if (name == "Gronk")
{
SteamUserStats.AddStat("GronkKills", 1);
CheckAllBossesKilled();
}
if (name == "Guardian")
{
SteamUserStats.AddStat("GuardianKills", 1);
CheckAllBossesKilled();
}
if (name == "Chief")
{
SteamUserStats.AddStat("ChiefKills", 1);
CheckAllBossesKilled();
}
if (name == "Goblin")
{
SteamUserStats.AddStat("GoblinKills", 1);
}
if (name == "Woodman")
{
SteamUserStats.AddStat("WoodmanKills", 1);
}
int statInt = SteamUserStats.GetStatInt("Kills");
int statInt2 = SteamUserStats.GetStatInt("TotalKills");
int statInt3 = SteamUserStats.GetStatInt("BowKills");
int statInt4 = SteamUserStats.GetStatInt("BuffKills");
int statInt5 = SteamUserStats.GetStatInt("Cow Kills");
int statInt6 = SteamUserStats.GetStatInt("BigChunkKills");
int statInt7 = SteamUserStats.GetStatInt("GronkKills");
int statInt8 = SteamUserStats.GetStatInt("GuardianKills");
int statInt9 = SteamUserStats.GetStatInt("GoblinKills");
int statInt10 = SteamUserStats.GetStatInt("WoodmanKills");
Debug.Log((object)("Killcount: " + statInt + ", allkills: " + statInt2 + ", bowkills: " + statInt3 + ", buffkills: " + statInt4 + ", Cow Kills: " + statInt5 + ", chunks: " + statInt6 + ", gronks: " + statInt7 + ", guardians: " + statInt8 + ", goblins: " + statInt9 + "Woodman kills: " + statInt10));
SteamUserStats.StoreStats();
}
}
private void CheckAllBossesKilled()
{
int statInt = SteamUserStats.GetStatInt("BigChunkKills");
int statInt2 = SteamUserStats.GetStatInt("GronkKills");
int statInt3 = SteamUserStats.GetStatInt("GuardianKills");
int statInt4 = SteamUserStats.GetStatInt("ChiefKills");
if (statInt3 > 0 && statInt2 > 0 && statInt > 0 && statInt4 > 0)
{
SteamUserStats.AddStat("Fearless", 1);
Debug.Log((object)("All bosses killed: " + SteamUserStats.GetStatInt("Fearless")));
}
}
public void StartBattleTotem()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Battle totems started", 1);
Debug.Log((object)("battle totems started: " + SteamUserStats.GetStatInt("Battle totems started")));
SteamUserStats.StoreStats();
}
}
public void ReviveTeammate()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Revives", 1);
Debug.Log((object)("Revives: " + SteamUserStats.GetStatInt("Revives")));
SteamUserStats.StoreStats();
}
}
public void AddDeath(PlayerStatus.DamageType deathCause)
{
if (CanUseAchievements())
{
Debug.Log((object)("Cause of death: " + deathCause));
if (deathCause == PlayerStatus.DamageType.Drown)
{
SteamUserStats.AddStat("Drown", 1);
Debug.Log((object)("Drowned: " + SteamUserStats.GetStatInt("Drown")));
}
SteamUserStats.AddStat("Deaths", 1);
SteamUserStats.AddStat("TotalDeaths", 1);
Debug.Log((object)("Deaths: " + SteamUserStats.GetStatInt("Deaths")));
Debug.Log((object)("TotalDeaths: " + SteamUserStats.GetStatInt("TotalDeaths")));
SteamUserStats.StoreStats();
}
}
public bool CanUseAchievements()
{
if (!Object.op_Implicit((Object)(object)SteamManager.Instance) || !SteamClient.IsValid)
{
return false;
}
return true;
}
public void OpenChest()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Chests opened", 1);
SteamUserStats.AddStat("TotalChestsOpened", 1);
Debug.Log((object)("Chests opened: " + SteamUserStats.GetStatInt("Chests opened")));
SteamUserStats.AddStat("Chests opened", 1);
SteamUserStats.StoreStats();
}
}
public void ItemCrafted(InventoryItem item, int craftAmount)
{
if (CanUseAchievements())
{
if (item.name == "Coin")
{
SteamUserStats.AddStat("CoinsCrafted", craftAmount);
Debug.Log((object)("Coins crafted: " + SteamUserStats.GetStatInt("CoinsCrafted")));
}
SteamUserStats.StoreStats();
}
}
public void BuildItem(int buildId)
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Builds", 1);
Debug.Log((object)("Builds: " + SteamUserStats.GetStatInt("Builds")));
SteamUserStats.StoreStats();
}
}
public void NewDay(int currentDay)
{
if (CanUseAchievements())
{
int statInt = SteamUserStats.GetStatInt("Longest survived");
if (currentDay > statInt)
{
SteamUserStats.SetStat("Longest survived", currentDay);
}
Debug.Log((object)("Max sruvived days: " + SteamUserStats.GetStatInt("Longest survived")));
SteamUserStats.StoreStats();
}
}
public void WieldedWeapon(InventoryItem item)
{
if (CanUseAchievements())
{
if (item.name == "Night Blade")
{
SteamUserStats.AddStat("The Black Swordsman", 1);
Debug.Log((object)("The Black Swordsman: " + SteamUserStats.GetStatInt("The Black Swordsman")));
}
SteamUserStats.StoreStats();
}
}
public void PickupPowerup(string powerupName)
{
if (CanUseAchievements())
{
if (powerupName == "Danis Milk" && PowerupInventory.Instance.GetAmount("Danis Milk") >= 10)
{
SteamUserStats.AddStat("Milkman", 1);
Debug.Log((object)("Milkman: " + SteamUserStats.GetStatInt("Milkman")));
}
SteamUserStats.StoreStats();
}
}
public void MoveDistance(int groundDist, int waterDist)
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Move Distance", groundDist);
if (waterDist > 0)
{
SteamUserStats.AddStat("Swim distance", waterDist);
}
Debug.Log((object)("Move dist: " + SteamUserStats.GetStatInt("Move Distance") + ", added this one: " + groundDist));
Debug.Log((object)("swim dist: " + SteamUserStats.GetStatInt("Swim distance") + ", added this one: " + waterDist));
SteamUserStats.StoreStats();
}
}
public void EatFood(InventoryItem item)
{
if (CanUseAchievements())
{
if (item.name == "Gulpon Shroom")
{
SteamUserStats.AddStat("Red shrooms eaten", 1);
Debug.Log((object)("Red shrooms eaten: " + SteamUserStats.GetStatInt("Red shrooms eaten")));
}
SteamUserStats.StoreStats();
}
}
public void AddPlayerKill()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Friendly Kills", 1);
Debug.Log((object)("Friendly Kills: " + SteamUserStats.GetStatInt("Friendly Kills")));
SteamUserStats.StoreStats();
}
}
public void Jump()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Jumps", 1);
Debug.Log((object)("Jumps: " + SteamUserStats.GetStatInt("Jumps")));
SteamUserStats.StoreStats();
}
}
public void PickupItem(InventoryItem item)
{
if (!CanUseAchievements())
{
return;
}
InventoryItem[] array = gems;
foreach (InventoryItem inventoryItem in array)
{
if (!((Object)(object)item != (Object)null) || inventoryItem.id != item.id)
{
continue;
}
Debug.Log((object)"Found gem, testing");
bool flag = true;
InventoryItem[] array2 = gems;
foreach (InventoryItem inventoryItem2 in array2)
{
if (inventoryItem2.id != item.id && !InventoryUI.Instance.HasItem(inventoryItem2))
{
Debug.Log((object)("Couldnt find item: " + inventoryItem2.name));
flag = false;
break;
}
}
if (flag)
{
SteamUserStats.AddStat("AllGems", 1);
Debug.Log((object)("AllGems: " + SteamUserStats.GetStatInt("AllGems")));
}
break;
}
SteamUserStats.StoreStats();
}
public void Karlson()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("Karlson monitor", 1);
Debug.Log((object)("Karlson monitor: " + SteamUserStats.GetStatInt("Karlson monitor")));
SteamUserStats.StoreStats();
}
}
private void GameStarted()
{
SteamUserStats.AddStat("Muck started", 1);
Debug.Log((object)("Muck started: " + SteamUserStats.GetStatInt("Muck started")));
SteamUserStats.StoreStats();
}
public void StartGame(GameSettings.Difficulty d)
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("GamesStarted", 1);
Debug.Log((object)("GamesStarted: " + SteamUserStats.GetStatInt("GamesStarted")));
switch (d)
{
case GameSettings.Difficulty.Easy:
SteamUserStats.AddStat("Easy", 1);
Debug.Log((object)("Easy: " + SteamUserStats.GetStatInt("Easy")));
break;
case GameSettings.Difficulty.Normal:
SteamUserStats.AddStat("Normal", 1);
Debug.Log((object)("Normal: " + SteamUserStats.GetStatInt("Normal")));
break;
case GameSettings.Difficulty.Gamer:
SteamUserStats.AddStat("Gamer", 1);
Debug.Log((object)("Gamer: " + SteamUserStats.GetStatInt("Gamer")));
break;
}
SteamUserStats.StoreStats();
}
}
public void OpenChiefChest()
{
if (CanUseAchievements())
{
SteamUserStats.AddStat("ChiefChests", 1);
Debug.Log((object)("ChiefChests: " + SteamUserStats.GetStatInt("ChiefChests")));
SteamUserStats.StoreStats();
}
}
}
public class AchievementPrefab : MonoBehaviour
{
public RawImage img;
public TextMeshProUGUI title;
public TextMeshProUGUI desc;
public void SetAchievement(Achievement a)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((Achievement)(ref a)).GetIcon().HasValue)
{
Debug.LogError((object)"no img");
}
else
{
Image value = ((Achievement)(ref a)).GetIcon().Value;
img.texture = (Texture)(object)GetSteamImageAsTexture2D(value);
}
((TMP_Text)title).text = ((Achievement)(ref a)).Name;
((TMP_Text)desc).text = ((Achievement)(ref a)).Description;
}
public static Texture2D GetSteamImageAsTexture2D(Image img)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Texture2D val = new Texture2D((int)img.Width, (int)img.Height, (TextureFormat)4, false, true);
val.LoadRawTextureData(img.Data);
val.Apply();
return val;
}
}
public class AddToResources : MonoBehaviour
{
public bool chest;
private void Start()
{
int nextId = ResourceManager.Instance.GetNextId();
((Component)this).GetComponent<Hitable>().SetId(nextId);
ResourceManager.Instance.AddObject(nextId, ((Component)this).gameObject);
Object.Destroy((Object)(object)this);
if (chest)
{
Chest componentInChildren = ((Component)this).GetComponentInChildren<Chest>();
ChestManager.Instance.AddChest(componentInChildren, nextId);
}
((Component)this).transform.SetParent((Transform)null);
}
}
public class Arrow : MonoBehaviour
{
private Rigidbody rb;
public AudioSource audio;
public TrailRenderer trail;
public GameObject hitFx;
public bool fallingWhileShooting;
public float speedWhileShooting;
private bool done;
public InventoryItem item { get; set; }
public int damage { get; set; }
public bool otherPlayersArrow { get; set; }
private void Awake()
{
rb = ((Component)this).GetComponent<Rigidbody>();
}
private void Update()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.rotation = Quaternion.LookRotation(rb.velocity);
}
private void OnCollisionEnter(Collision other)
{
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: 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_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
if (done)
{
return;
}
done = true;
int layer = other.gameObject.layer;
if (!otherPlayersArrow && (layer == LayerMask.NameToLayer("Player") || layer == LayerMask.NameToLayer("Enemy")))
{
Hitable componentInChildren = ((Component)other.transform.root).GetComponentInChildren<Hitable>();
if (!Object.op_Implicit((Object)(object)componentInChildren))
{
return;
}
GameManager.instance.onlyRock = false;
PowerupCalculations.DamageResult damageMultiplier = PowerupCalculations.Instance.GetDamageMultiplier(fallingWhileShooting, speedWhileShooting);
float damageMultiplier2 = damageMultiplier.damageMultiplier;
bool flag = damageMultiplier.crit;
float lifesteal = damageMultiplier.lifesteal;
int num = (int)((float)damage * damageMultiplier2);
Mob component = ((Component)componentInChildren).GetComponent<Mob>();
if (Object.op_Implicit((Object)(object)component) && item.attackTypes != null && component.mobType.weaknesses != null)
{
MobType.Weakness[] weaknesses = component.mobType.weaknesses;
foreach (MobType.Weakness weakness in weaknesses)
{
MobType.Weakness[] attackTypes = item.attackTypes;
foreach (MobType.Weakness weakness2 in attackTypes)
{
Debug.LogError((object)string.Concat("checking: ", weakness, ", a: ", weakness2));
if (weakness2 == weakness)
{
flag = true;
num *= 2;
}
}
}
}
Vector3 pos = other.collider.ClosestPoint(((Component)this).transform.position);
HitEffect hitEffect = HitEffect.Normal;
if (damageMultiplier.sniped)
{
hitEffect = HitEffect.Big;
}
else if (flag)
{
hitEffect = HitEffect.Crit;
}
else if (damageMultiplier.falling)
{
hitEffect = HitEffect.Falling;
}
componentInChildren.Hit(num, 1f, (int)hitEffect, pos, 1);
PlayerStatus.Instance.Heal(Mathf.CeilToInt((float)num * lifesteal));
if (damageMultiplier.sniped)
{
PowerupCalculations.Instance.HitEffect(PowerupCalculations.Instance.sniperSfx);
}
if (flag)
{
PowerupInventory.Instance.StartJuice();
}
if (damageMultiplier2 > 0f && damageMultiplier.hammerMultiplier > 0f)
{
int num2 = 0;
PowerupCalculations.Instance.SpawnOnHitEffect(num2, owner: true, pos, (int)((float)num * damageMultiplier.hammerMultiplier));
ClientSend.SpawnEffect(num2, pos);
}
}
StopArrow(other);
}
private void StopArrow(Collision other)
{
//IL_005c: 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_0068: 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)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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)
rb.isKinematic = true;
((Component)this).transform.SetParent(other.transform);
done = true;
((Component)this).gameObject.AddComponent<DestroyObject>().time = 10f;
Object.Destroy((Object)(object)this);
Object.Destroy((Object)(object)audio);
trail.emitting = false;
Vector3 position = ((Component)this).transform.position;
Vector3 val = -((Component)this).transform.forward;
ParticleSystem component = Object.Instantiate<GameObject>(hitFx, position, Quaternion.LookRotation(val)).GetComponent<ParticleSystem>();
Renderer component2 = other.gameObject.GetComponent<Renderer>();
Material val2 = null;
if ((Object)(object)component2 != (Object)null)
{
val2 = component2.material;
}
else
{
SkinnedMeshRenderer componentInChildren = ((Component)other.transform.root).GetComponentInChildren<SkinnedMeshRenderer>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
val2 = ((Renderer)componentInChildren).material;
}
}
if (Object.op_Implicit((Object)(object)val2))
{
((Component)component).GetComponent<Renderer>().material = val2;
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class AudioFreqController : MonoBehaviour
{
public AudioLowPassFilter filter;
private void Update()
{
if (Object.op_Implicit((Object)(object)PlayerStatus.Instance))
{
float num = 0f;
if (PlayerStatus.Instance.hp <= 0f)
{
num = 1f;
}
else
{
float num2 = 0.75f;
int num3 = PlayerStatus.Instance.HpAndShield();
int num4 = PlayerStatus.Instance.MaxHpAndShield();
num = (float)num3 / (float)num4;
num = ((!(num > num2)) ? ((float)num3 / ((float)num4 * num2)) : 1f);
}
if (PlayerMovement.Instance.IsUnderWater())
{
num = 0.05f;
}
filter.cutoffFrequency = Mathf.Lerp(filter.cutoffFrequency, 22000f * num, Time.deltaTime * 8f);
}
}
}
public class Billboard : MonoBehaviour
{
private Vector3 defaultScale;
public bool xz;
public bool affectScale;
private Transform t;
private void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
defaultScale = ((Component)this).transform.localScale;
}
private void Update()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)t))
{
if ((Object)(object)t == (Object)null || !((Component)t).gameObject.activeInHierarchy)
{
if (Object.op_Implicit((Object)(object)PlayerMovement.Instance))
{
t = PlayerMovement.Instance.playerCam;
}
else if (Object.op_Implicit((Object)(object)Camera.main))
{
t = ((Component)Camera.main).transform;
}
}
return;
}
((Component)this).transform.LookAt(t);
if (!xz)
{
Transform transform = ((Component)this).transform;
Quaternion rotation = ((Component)this).transform.rotation;
transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y + 180f, 0f);
}
if (affectScale)
{
((Component)this).transform.localScale = defaultScale;
}
}
}
public class BillyInteract : MonoBehaviour, SharedObject, Interactable
{
public int id;
public void SetId(int id)
{
this.id = id;
}
public int GetId()
{
return id;
}
public void Interact()
{
Application.OpenURL("https://store.steampowered.com/app/1228610/KARLSON/");
AchievementManager.Instance.Karlson();
}
public void LocalExecute()
{
}
public void AllExecute()
{
}
public void ServerExecute(int fromClient = -1)
{
}
public void RemoveObject()
{
}
public string GetName()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return $"<size=40%>Press {InputManager.interact} to wishlist KARLSON now gamer!";
}
public bool IsStarted()
{
return false;
}
}
public class BillySpawner : MonoBehaviour
{
[Serializable]
public class WeightedSpawn
{
public GameObject prefab;
public float weight;
}
public WeightedSpawn[] structurePrefabs;
private int mapChunkSize;
private float worldEdgeBuffer = 0.6f;
public int maxCaves = 50;
public int minCaves = 3;
protected ConsistentRandom randomGen;
public LayerMask whatIsTerrain;
private List<GameObject> structures;
public bool dontAddToResourceManager;
private Vector3[] shrines;
private float totalWeight;
public float worldScale { get; set; } = 12f;
private void Start()
{
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
structures = new List<GameObject>();
randomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
shrines = (Vector3[])(object)new Vector3[maxCaves];
mapChunkSize = MapGenerator.mapChunkSize;
worldScale *= worldEdgeBuffer;
WeightedSpawn[] array = structurePrefabs;
foreach (WeightedSpawn weightedSpawn in array)
{
totalWeight += weightedSpawn.weight;
}
int num = 0;
int num2 = 0;
RaycastHit hit = default(RaycastHit);
while (num < maxCaves)
{
num2++;
float num3 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
float num4 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
Vector3 val = new Vector3(num3, 0f, num4) * worldScale;
val.y = 200f;
Debug.DrawLine(val, val + Vector3.down * 500f, Color.cyan, 50f);
if (Physics.Raycast(val, Vector3.down, ref hit, 500f, LayerMask.op_Implicit(whatIsTerrain)))
{
if (WorldUtility.WorldHeightToBiome(((RaycastHit)(ref hit)).point.y) != TextureData.TerrainType.Grass || Mathf.Abs(Vector3.Angle(Vector3.up, ((RaycastHit)(ref hit)).normal)) > 15f)
{
continue;
}
shrines[num] = ((RaycastHit)(ref hit)).point;
num++;
GameObject val2 = FindObjectToSpawn(structurePrefabs, totalWeight);
GameObject val3 = Object.Instantiate<GameObject>(val2, ((RaycastHit)(ref hit)).point, val2.transform.rotation);
if (!dontAddToResourceManager)
{
val3.GetComponentInChildren<SharedObject>().SetId(ResourceManager.Instance.GetNextId());
}
structures.Add(val3);
Process(val3, hit);
}
if ((num2 > maxCaves * 2 && num >= minCaves) || num2 > maxCaves * 10)
{
break;
}
}
if (!dontAddToResourceManager)
{
ResourceManager.Instance.AddResources(structures);
}
}
public virtual void Process(GameObject newStructure, RaycastHit hit)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
newStructure.transform.rotation = Quaternion.LookRotation(((RaycastHit)(ref hit)).normal);
}
private void OnDrawGizmos()
{
}
public GameObject FindObjectToSpawn(WeightedSpawn[] structurePrefabs, float totalWeight)
{
float num = (float)randomGen.NextDouble();
float num2 = 0f;
for (int i = 0; i < structurePrefabs.Length; i++)
{
num2 += structurePrefabs[i].weight;
if (num < num2 / totalWeight)
{
return structurePrefabs[i].prefab;
}
}
return structurePrefabs[0].prefab;
}
}
public class Boat : MonoBehaviour
{
public enum BoatStatus
{
Hidden,
Marked,
Found,
LeftIsland
}
public enum BoatPackets
{
MarkShip,
FindShip,
MarkGems,
FinishBoat
}
public BoatStatus status;
public static Boat Instance;
public InventoryItem mapItem;
public InventoryItem gemMap;
public GameObject objectivePing;
public ObjectivePing boatPing;
private ConsistentRandom rand;
public SpawnChestsInLocations chestSpawner;
public GameObject[] holes;
public Texture gemTexture;
public Texture boatTexture;
private bool gemsDiscovered;
public List<ShrineGuardian> guardians;
public CountPlayersOnBoat countPlayers;
private float heightUnderWater = 3f;
private Rigidbody rb;
public Transform dragonSpawnPos;
public Camera cinematicCamera;
public MobType dragonBoss;
public Transform rbTransform;
public GameObject waterSfx;
public Transform dragonLandingPosition;
public Transform[] landingNodes;
public GameObject wheel;
private bool sinking;
private float amp = 20f;
private FinishGameInteract wheelInteract;
public ObjectivePing wheelPing;
private Component[] repairs;
public Map.MapMarker boatMapMarker;
public float waterHeight { get; set; }
private void Start()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
rb = ((Component)this).GetComponentInChildren<Rigidbody>();
guardians = new List<ShrineGuardian>();
rand = new ConsistentRandom(GameManager.GetSeed());
Instance = this;
((MonoBehaviour)this).InvokeRepeating("CheckFound", 0.5f, 1f);
boatPing = Object.Instantiate<GameObject>(objectivePing, ((Component)this).transform.position, Quaternion.identity).GetComponent<ObjectivePing>();
boatPing.SetText("?");
((Component)boatPing).gameObject.SetActive(false);
RaycastHit val = default(RaycastHit);
for (int i = 0; i < holes.Length; i++)
{
if (rand.NextDouble() > 0.5)
{
Object.Destroy((Object)(object)holes[i]);
continue;
}
Vector3 position = holes[i].transform.position;
float y = position.y;
if (Physics.Raycast(position + Vector3.up * 10f, Vector3.down, ref val, 50f, LayerMask.op_Implicit(GameManager.instance.whatIsGround)) && ((RaycastHit)(ref val)).point.y > y)
{
Object.Destroy((Object)(object)holes[i]);
}
}
repairs = ((Component)this).gameObject.GetComponentsInChildren(typeof(RepairInteract), true);
Component[] array = repairs;
for (int j = 0; j < array.Length; j++)
{
RepairInteract repairInteract = (RepairInteract)(object)array[j];
int nextId = ResourceManager.Instance.GetNextId();
repairInteract.SetId(nextId);
ResourceManager.Instance.AddObject(nextId, ((Component)repairInteract).gameObject);
}
if (LocalClient.serverOwner)
{
((MonoBehaviour)this).InvokeRepeating("SlowUpdate", 1f, 1f);
}
array = repairs;
for (int j = 0; j < array.Length; j++)
{
_ = (RepairInteract)(object)array[j];
}
((Object)((Component)this).gameObject).name = "Boat";
}
private void SlowUpdate()
{
if (CheckBoatFullyRepaired())
{
SendBoatFinished();
((MonoBehaviour)this).CancelInvoke("SlowUpdate");
}
}
private void SendMarkShip()
{
MarkShip();
ClientSend.SendShipStatus(BoatPackets.MarkShip);
}
private void SendShipFound()
{
Debug.LogError((object)"Found ship. Not sending");
FindShip();
ClientSend.SendShipStatus(BoatPackets.FindShip);
}
private void SendMarkGems()
{
MarkGems();
ClientSend.SendShipStatus(BoatPackets.MarkGems);
}
private void SendBoatFinished()
{
int nextId = ResourceManager.Instance.GetNextId();
BoatFinished(nextId);
ClientSend.SendShipStatus(BoatPackets.FinishBoat, nextId);
}
public void UpdateShipStatus(BoatPackets p, int interactId)
{
switch (p)
{
case BoatPackets.MarkShip:
MarkShip();
break;
case BoatPackets.FindShip:
FindShip();
break;
case BoatPackets.MarkGems:
MarkGems();
break;
case BoatPackets.FinishBoat:
BoatFinished(interactId);
break;
}
}
public void LeaveIsland()
{
if (status != BoatStatus.LeftIsland)
{
status = BoatStatus.LeftIsland;
GameManager.instance.boatLeft = true;
sinking = true;
Object.Destroy((Object)(object)((Component)wheelInteract).gameObject);
Object.Destroy((Object)(object)((Component)wheelPing).gameObject);
PlayerStatus.Instance.EnterOcean();
AchievementManager.Instance.LeaveMuck();
}
}
private void FixedUpdate()
{
if (sinking)
{
MoveBoat();
}
}
private void MoveBoat()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
float num = 2f;
Vector3 val = Vector3.up * num * Time.deltaTime;
Transform water = World.Instance.water;
water.position += val;
float y = World.Instance.water.position.y;
if (rb.position.y < y - heightUnderWater)
{
if (!waterSfx.activeInHierarchy)
{
waterSfx.SetActive(true);
}
rb.MovePosition(new Vector3(((Component)this).transform.position.x, y - heightUnderWater, ((Component)this).transform.position.z));
}
if (!(y > 85f))
{
return;
}
sinking = false;
if (!LocalClient.serverOwner)
{
return;
}
float bossMultiplier = 0.85f + 0.15f * (float)GameManager.instance.GetPlayersAlive();
int nextId = MobManager.Instance.GetNextId();
MobSpawner.Instance.ServerSpawnNewMob(nextId, dragonBoss.id, dragonSpawnPos.position, 1f, bossMultiplier);
List<Mob> list = new List<Mob>();
foreach (Mob value in MobManager.Instance.mobs.Values)
{
list.Add(value);
}
for (int i = 0; i < list.Count; i++)
{
list[i].hitable.Hit(list[i].hitable.maxHp, 1f, 2, ((Component)list[i]).transform.position, -1);
}
}
public void BoatFinished(int interactId)
{
//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)
wheel.SetActive(true);
wheelPing = Object.Instantiate<GameObject>(objectivePing, wheel.transform.position, Quaternion.identity).GetComponent<ObjectivePing>();
wheelPing.SetText("");
wheelInteract = wheel.AddComponent<FinishGameInteract>();
wheelInteract.SetId(interactId);
ResourceManager.Instance.AddObject(interactId, ((Component)wheelInteract).gameObject);
}
public bool CheckBoatFullyRepaired()
{
Component[] array = repairs;
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)array[i] == (Object)null))
{
return false;
}
}
return true;
}
public void CheckForMap()
{
if (status == BoatStatus.Hidden)
{
foreach (InventoryCell cell in InventoryUI.Instance.cells)
{
if (!((Object)(object)cell.currentItem == (Object)null) && cell.currentItem.id == mapItem.id)
{
SendMarkShip();
}
}
}
if (gemsDiscovered)
{
return;
}
foreach (InventoryCell cell2 in InventoryUI.Instance.cells)
{
if (!((Object)(object)cell2.currentItem == (Object)null) && cell2.currentItem.id == gemMap.id)
{
SendMarkGems();
}
}
}
private void MarkGems()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
gemsDiscovered = true;
foreach (ShrineGuardian guardian in guardians)
{
if ((Object)(object)guardian != (Object)null)
{
Map.Instance.AddMarker(((Component)guardian).transform, Map.MarkerType.Gem, gemTexture, Guardian.TypeToColor(guardian.type), "?");
Map.Instance.AddMarker(((Component)guardian).transform, Map.MarkerType.Gem, gemTexture, Guardian.TypeToColor(guardian.type), "?");
}
}
ChatBox.Instance.AppendMessage(-1, $"<color=orange>Guardians <color=white>have been located (\"{InputManager.map}\" to open map)", "");
}
private void CheckFound()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if ((status == BoatStatus.Hidden || status == BoatStatus.Marked) && Object.op_Implicit((Object)(object)PlayerMovement.Instance) && Vector3.Distance(((Component)PlayerMovement.Instance).transform.position, ((Component)this).transform.position) < 40f)
{
SendShipFound();
}
}
public void FindShip()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
status = BoatStatus.Found;
Object.Destroy((Object)(object)((Component)boatPing).gameObject);
Map.Instance.AddMarker(((Component)this).transform, Map.MarkerType.Other, boatTexture, Color.white, "Shipwreck");
ChatBox.Instance.AppendMessage(-1, $"<color=orange>Broken Ship <color=white>has been located (\"{InputManager.map}\" to open map)", "");
}
public void MarkShip()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
status = BoatStatus.Marked;
((Component)boatPing).gameObject.SetActive(true);
ChatBox.Instance.AppendMessage(-1, $"Something has been marked on your map... (\"{InputManager.map}\" to open map)", "");
Map.Instance.AddMarker(((Component)this).transform, Map.MarkerType.Other, null, Color.white);
}
}
public class BoatCamera : MonoBehaviour
{
private Transform target;
private Transform dragonTransform;
private void Awake()
{
target = Boat.Instance.rbTransform;
dragonTransform = ((Component)Dragon.Instance).transform;
((MonoBehaviour)this).Invoke("StopCamera", 5f);
}
private void StopCamera()
{
((Component)this).gameObject.SetActive(false);
}
private void Update()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)this).transform != (Object)(object)dragonTransform && dragonTransform.position.y > ((Component)target).transform.position.y)
{
target = dragonTransform;
}
Quaternion val = Quaternion.LookRotation(target.position - ((Component)this).transform.position);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val, Time.deltaTime * 6f);
}
}
public class BobMob : Mob
{
public enum DragonState
{
Flying,
Landing,
Grounded
}
private int landingNode;
private float t;
private float speed = 50f;
public DragonState state { get; set; }
public Vector3 desiredPos { get; set; }
public ProjectileAttackNoGravity projectileController { get; set; }
private void Awake()
{
projectileController = ((Component)this).GetComponent<ProjectileAttackNoGravity>();
state = DragonState.Flying;
base.hitable = ((Component)this).GetComponent<Hitable>();
base.animator = ((Component)this).GetComponent<Animator>();
if (LocalClient.serverOwner)
{
if (mobType.behaviour == MobType.MobBehaviour.Enemy)
{
((Component)this).gameObject.AddComponent<MobServerEnemy>();
}
else if (mobType.behaviour == MobType.MobBehaviour.Neutral)
{
((Component)this).gameObject.AddComponent<MobServerNeutral>();
}
else if (mobType.behaviour == MobType.MobBehaviour.EnemyMeleeAndRanged)
{
((Component)this).gameObject.AddComponent<MobServerEnemyMeleeAndRanged>();
}
else if (mobType.behaviour == MobType.MobBehaviour.Dragon)
{
((Component)this).gameObject.AddComponent<MobServerDragon>();
}
}
base.attackTimes = new float[attackAnimations.Length];
for (int i = 0; i < attackAnimations.Length; i++)
{
base.attackTimes[i] = attackAnimations[i].length;
}
}
protected override void Animate()
{
}
public override void SetTarget(int targetId)
{
base.targetPlayerId = targetId;
base.target = ((Component)GameManager.players[base.targetPlayerId]).transform;
}
public void StartLanding()
{
landingNode = 0;
state = DragonState.Landing;
}
public void GroundedToFlight()
{
state = DragonState.Flying;
base.animator.SetBool("Landed", false);
}
public void DragonUpdate(DragonState state)
{
switch (state)
{
case DragonState.Landing:
StartLanding();
break;
case DragonState.Flying:
GroundedToFlight();
break;
}
}
public override void ExtraUpdate()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val;
switch (state)
{
case DragonState.Flying:
{
Transform transform4 = ((Component)this).transform;
Quaternion rotation3 = ((Component)this).transform.rotation;
val = desiredPos - ((Component)this).transform.position;
transform4.rotation = Quaternion.Slerp(rotation3, Quaternion.LookRotation(((Vector3)(ref val)).normalized), Time.deltaTime * 0.6f);
Transform transform5 = ((Component)this).transform;
transform5.position += ((Component)this).transform.forward * speed * Time.deltaTime;
break;
}
case DragonState.Landing:
if (landingNode < 2)
{
Vector3 position = Boat.Instance.landingNodes[landingNode].position;
Transform transform2 = ((Component)this).transform;
Quaternion rotation2 = ((Component)this).transform.rotation;
val = position - ((Component)this).transform.position;
transform2.rotation = Quaternion.Slerp(rotation2, Quaternion.LookRotation(((Vector3)(ref val)).normalized), Time.deltaTime * 6f);
Transform transform3 = ((Component)this).transform;
transform3.position += ((Component)this).transform.forward * speed * 1.3f * Time.deltaTime;
if (Vector3.Distance(((Component)this).transform.position, position) < 10f)
{
landingNode++;
}
if (landingNode > 1)
{
state = DragonState.Grounded;
CameraShaker.Instance.StepShake(1f);
}
}
break;
case DragonState.Grounded:
{
Transform transform = ((Component)this).transform;
Quaternion rotation = ((Component)this).transform.rotation;
val = Boat.Instance.dragonLandingPosition.forward;
transform.rotation = Quaternion.Slerp(rotation, Quaternion.LookRotation(((Vector3)(ref val)).normalized), Time.deltaTime * 2f);
((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, desiredPos, Time.deltaTime * 2f);
base.animator.SetBool("Landed", true);
break;
}
}
}
private void LateUpdate()
{
}
public override void Attack(int targetPlayerId, int attackAnimationIndex)
{
((MonoBehaviour)this).Invoke("FinishAttacking", base.attackTimes[attackAnimationIndex]);
base.animator.Play(((Object)attackAnimations[attackAnimationIndex]).name);
base.targetPlayerId = targetPlayerId;
}
protected override void FinishAttacking()
{
}
public override void SetDestination(Vector3 dest)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
desiredPos = dest;
}
}
public class BossUI : MonoBehaviour
{
public TextMeshProUGUI bossName;
public TextMeshProUGUI hpText;
public RawImage hpBar;
public Mob currentBoss;
private HitableMob hitableMob;
private int desiredHp;
public Transform layout;
private Vector3 desiredScale;
public static BossUI Instance;
private float currentHp;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
((Component)layout).transform.localScale = Vector3.zero;
desiredScale = Vector3.zero;
}
public void SetBoss(Mob b)
{
//IL_0076: 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)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)currentBoss != (Object)null))
{
currentBoss = b;
((TMP_Text)bossName).text = "";
if (b.IsBuff())
{
TextMeshProUGUI obj = bossName;
((TMP_Text)obj).text = ((TMP_Text)obj).text + "Buff ";
}
TextMeshProUGUI obj2 = bossName;
((TMP_Text)obj2).text = ((TMP_Text)obj2).text + ((Component)b).GetComponent<Hitable>().entityName;
currentHp = 0f;
desiredScale = Vector3.one;
hitableMob = ((Component)b).GetComponent<HitableMob>();
((Component)layout).gameObject.SetActive(true);
layout.localScale = Vector3.zero;
}
}
private void Update()
{
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)currentBoss == (Object)null)
{
if (((Component)layout).gameObject.activeInHierarchy)
{
((Component)layout).gameObject.SetActive(false);
if (DayCycle.time < 0.5f)
{
MusicController.Instance.StopSong();
}
}
}
else
{
currentHp = Mathf.Lerp(currentHp, (float)hitableMob.hp, Time.deltaTime * 10f);
((TMP_Text)hpText).text = Mathf.RoundToInt(currentHp) + " / " + hitableMob.maxHp;
float num = (float)hitableMob.hp / (float)hitableMob.maxHp;
((Component)hpBar).transform.localScale = new Vector3(num, 1f, 1f);
((Component)layout).transform.localScale = Vector3.Lerp(((Component)layout).transform.localScale, desiredScale, Time.deltaTime * 10f);
}
}
}
public class BuildDestruction : MonoBehaviour
{
public bool connectedToGround;
public bool directlyGrounded;
public bool started;
public bool destroyed;
private List<BuildDestruction> otherBuilds = new List<BuildDestruction>();
private BoxCollider trigger;
private void Awake()
{
((MonoBehaviour)this).Invoke("CheckDirectlyGrounded", 2f);
}
private void Start()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
BoxCollider[] components = ((Component)this).GetComponents<BoxCollider>();
foreach (BoxCollider val in components)
{
if (((Collider)val).isTrigger)
{
trigger = val;
break;
}
}
BoxCollider obj = trigger;
obj.size *= 1.1f;
}
private void Update()
{
}
private void OnDestroy()
{
destroyed = true;
List<BuildDestruction> list = new List<BuildDestruction>();
list.Add(this);
for (int num = otherBuilds.Count - 1; num >= 0; num--)
{
if (!((Object)(object)otherBuilds[num] == (Object)null) && !otherBuilds[num].IsDirectlyGrounded(list))
{
otherBuilds[num].DestroyBuild();
}
}
}
private void DestroyBuild()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
Hitable component = ((Component)this).GetComponent<Hitable>();
component.Hit(component.hp, 1f, 1, ((Component)this).transform.position, -1);
}
public bool IsDirectlyGrounded(List<BuildDestruction> alreadyChecked)
{
if (directlyGrounded)
{
return true;
}
foreach (BuildDestruction otherBuild in otherBuilds)
{
if (!((Object)(object)otherBuild == (Object)null) && !alreadyChecked.Contains(otherBuild))
{
alreadyChecked.Add(otherBuild);
if (otherBuild.IsDirectlyGrounded(alreadyChecked))
{
return true;
}
}
}
return false;
}
private void CheckDirectlyGrounded()
{
Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
Object.Destroy((Object)(object)trigger);
Object.Destroy((Object)(object)component);
}
private void OnTriggerEnter(Collider collision)
{
if (((Component)collision).gameObject.layer == LayerMask.NameToLayer("Ground"))
{
directlyGrounded = true;
connectedToGround = true;
}
if (((Component)collision).CompareTag("Build"))
{
BuildDestruction component = ((Component)collision).GetComponent<BuildDestruction>();
if (!otherBuilds.Contains(component))
{
MonoBehaviour.print((object)("added a build: " + ((Object)((Component)collision).gameObject).name));
otherBuilds.Add(component);
}
}
}
private void OnDrawGizmos()
{
}
}
public class BuildDoor : MonoBehaviour
{
[Serializable]
public class Door
{
public Hitable hitable;
public DoorInteractable doorInteractable;
public void SetId(int id)
{
hitable.SetId(id);
doorInteractable.SetId(id);
ResourceManager.Instance.AddObject(id, ((Component)hitable).gameObject);
}
}
public Door[] doors;
}
public class BuildInfo : MonoBehaviour
{
public int ownerId = -1;
}
public class BuildManager : MonoBehaviour
{
public int gridSize = 2;
private int gridWidth = 10;
public LayerMask whatIsGround;
private Transform playerCam;
private InventoryItem currentItem;
public GameObject buildFx;
public GameObject ghostItem;
private Renderer renderer;
private MeshFilter filter;
public int yRotation;
public GameObject rotateText;
public static BuildManager Instance;
private Vector3 lastPosition;
private bool canBuild;
private Vector3[] ghostExtents;
private Collider ghostCollider;
private string debugInfo;
private int rotationAngle = 45;
private int id;
private void Awake()
{
Instance = this;
filter = ghostItem.GetComponent<MeshFilter>();
renderer = ghostItem.GetComponent<Renderer>();
}
private void SetNewItem()
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
filter.mesh = currentItem.mesh;
Material material = renderer.material;
material.mainTexture = currentItem.material.mainTexture;
renderer.material = material;
Object.Destroy((Object)(object)ghostItem.GetComponent<BoxCollider>());
ghostCollider = (Collider)(object)ghostItem.AddComponent<BoxCollider>();
BuildSnappingInfo component = currentItem.prefab.GetComponent<BuildSnappingInfo>();
if (Object.op_Implicit((Object)(object)component))
{
ghostExtents = component.position;
}
else
{
ghostExtents = (Vector3[])(object)new Vector3[0];
}
ghostItem.transform.localScale = Vector3.one * (float)gridSize;
if (!currentItem.grid)
{
ghostItem.transform.localScale = Vector3.one;
}
}
private void Update()
{
NewestBuild();
}
private void NewestBuild()
{
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: 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_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_047e: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: 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_040c: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_0417: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_0448: Unknown result type (might be due to invalid IL or missing references)
//IL_044a: Unknown result type (might be due to invalid IL or missing references)
debugInfo = "";
if (!Object.op_Implicit((Object)(object)currentItem) || (Object)(object)currentItem != (Object)(object)Hotbar.Instance.currentItem)
{
currentItem = Hotbar.Instance.currentItem;
if (!Object.op_Implicit((Object)(object)currentItem) || !canBuild)
{
if (ghostItem.activeInHierarchy)
{
ghostItem.SetActive(false);
rotateText.SetActive(false);
}
return;
}
}
if (!currentItem.buildable)
{
ghostItem.SetActive(false);
rotateText.SetActive(false);
canBuild = false;
return;
}
if (!Object.op_Implicit((Object)(object)playerCam))
{
if (!Object.op_Implicit((Object)(object)PlayerMovement.Instance))
{
return;
}
playerCam = PlayerMovement.Instance.playerCam;
}
if (!ghostItem.activeInHierarchy)
{
ghostItem.SetActive(true);
rotateText.SetActive(true);
}
SetNewItem();
Bounds bounds = filter.mesh.bounds;
Vector3 val = ((Bounds)(ref bounds)).extents;
if (currentItem.grid)
{
val *= (float)gridSize;
}
ghostItem.transform.rotation = Quaternion.Euler(0f, (float)yRotation, 0f);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(new Ray(playerCam.position, playerCam.forward), ref val2, 12f, LayerMask.op_Implicit(whatIsGround)))
{
if (((Component)((RaycastHit)(ref val2)).collider).CompareTag("Ignore"))
{
canBuild = false;
ghostItem.SetActive(false);
return;
}
Vector3 point = ((RaycastHit)(ref val2)).point;
Vector3 up = Vector3.up;
float y = val.y;
bounds = filter.mesh.bounds;
Vector3 position = point + up * (y - ((Bounds)(ref bounds)).center.y);
bounds = filter.mesh.bounds;
_ = ((Bounds)(ref bounds)).center;
BuildSnappingInfo component = ((Component)((RaycastHit)(ref val2)).collider).GetComponent<BuildSnappingInfo>();
if (((Component)((RaycastHit)(ref val2)).collider).gameObject.CompareTag("Build") && currentItem.grid && (Object)(object)component != (Object)null)
{
position = ((RaycastHit)(ref val2)).point;
float num = 3f;
float num2 = float.PositiveInfinity;
Vector3 val3 = Vector3.zero;
Vector3[] position2 = component.position;
foreach (Vector3 val4 in position2)
{
Vector3 point2 = ((Component)((RaycastHit)(ref val2)).collider).transform.position + val4 * (float)gridSize;
point2 = RotateAroundPivot(point2, ((Component)((RaycastHit)(ref val2)).collider).transform.position, new Vector3(0f, ((Component)((RaycastHit)(ref val2)).collider).transform.eulerAngles.y, 0f));
Vector3 val5 = point2 - ((Component)((RaycastHit)(ref val2)).collider).transform.position;
Vector3 val6 = ((Vector3)(ref val5)).normalized;
Vector3 zero = Vector3.zero;
if (zero.y > 0f)
{
zero.y = 1f;
}
else if (zero.y < 0f)
{
zero.y = -1f;
}
val6 += ((RaycastHit)(ref val2)).normal;
val6 = ((Vector3)(ref val6)).normalized * (float)gridSize / 2f;
if (!(Vector3.Distance(((RaycastHit)(ref val2)).point, point2) < num))
{
continue;
}
ghostItem.transform.position = point2;
Vector3[] array = ghostExtents;
foreach (Vector3 val7 in array)
{
Vector3 point3 = ghostItem.transform.position + val7 * (float)gridSize;
point3 = RotateAroundPivot(point3, ((Component)ghostCollider).transform.position, new Vector3(0f, (float)yRotation, 0f));
float num3 = Vector3.Distance(point3 - val6, point2);
if (num3 < num2)
{
num2 = num3;
val3 = point3 - ghostItem.transform.position;
position = point2;
}
}
}
position += val3;
}
canBuild = true;
lastPosition = position;
ghostItem.transform.position = position;
}
else
{
ghostItem.SetActive(false);
canBuild = false;
}
}
private void OnDrawGizmos()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (ghostExtents != null)
{
Vector3[] array = ghostExtents;
foreach (Vector3 val in array)
{
Gizmos.color = Color.blue;
Vector3 point = ghostItem.transform.position + val * (float)gridSize;
point = RotateAroundPivot(point, ((Component)ghostCollider).transform.position, new Vector3(0f, (float)yRotation, 0f));
Gizmos.DrawCube(point, Vector3.one);
}
}
}
private Vector3 RotateAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = point - pivot;
val = Quaternion.Euler(angles) * val;
point = val + pivot;
return point;
}
public void RotateBuild(int dir)
{
yRotation -= dir * rotationAngle;
}
public void RequestBuildItem()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (CanBuild() && canBuild)
{
Hotbar.Instance.UseItem(1);
Gun.Instance.Build();
ClientSend.RequestBuild(currentItem.id, lastPosition, yRotation);
}
}
public bool CanBuild()
{
if (!Object.op_Implicit((Object)(object)currentItem))
{
return false;
}
if (!currentItem.buildable)
{
return false;
}
if (currentItem.amount <= 0)
{
return false;
}
return true;
}
public GameObject BuildItem(int buildOwner, int itemID, int objectId, Vector3 position, int yRotation)
{
//IL_0023: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
InventoryItem inventoryItem = ItemManager.Instance.allItems[itemID];
GameObject val = Object.Instantiate<GameObject>(inventoryItem.prefab);
val.transform.position = position;
val.transform.rotation = Quaternion.Euler(0f, (float)yRotation, 0f);
val.AddComponent<BuildInfo>().ownerId = buildOwner;
if (Object.op_Implicit((Object)(object)buildFx))
{
Object.Instantiate<GameObject>(buildFx, position, Quaternion.identity);
}
if (inventoryItem.grid)
{
HitableTree component = val.GetComponent<HitableTree>();
component.SetDefaultScale(Vector3.one * (float)gridSize);
component.PopIn();
}
val.GetComponent<Hitable>().SetId(objectId);
ResourceManager.Instance.AddObject(objectId, val);
ResourceManager.Instance.AddBuild(objectId, val);
BuildDoor component2 = val.GetComponent<BuildDoor>();
if ((Object)(object)component2 != (Object)null)
{
BuildDoor.Door[] doors = component2.doors;
foreach (BuildDoor.Door door in doors)
{
if (LocalClient.serverOwner)
{
door.SetId(ResourceManager.Instance.GetNextId());
}
else
{
door.SetId(objectId++);
}
}
}
if (inventoryItem.type == InventoryItem.ItemType.Storage)
{
Chest componentInChildren = val.GetComponentInChildren<Chest>();
ChestManager.Instance.AddChest(componentInChildren, objectId);
}
if (buildOwner == LocalClient.instance.myId)
{
MonoBehaviour.print((object)"i built something");
if (inventoryItem.type == InventoryItem.ItemType.Station)
{
UiEvents.Instance.StationUnlock(itemID);
if (Object.op_Implicit((Object)(object)Tutorial.Instance) && inventoryItem.name == "Workbench")
{
Tutorial.Instance.stationPlaced = true;
}
}
}
if (buildOwner == LocalClient.instance.myId)
{
AchievementManager.Instance.BuildItem(itemID);
}
return val;
}
public int GetNextBuildId()
{
return ResourceManager.Instance.GetNextId();
}
}
[ExecuteInEditMode]
public class BuildSnappingInfo : MonoBehaviour
{
public Vector3[] position;
public bool half;
private void OnDrawGizmos()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Gizmos.color = Color.red;
Vector3[] array = position;
foreach (Vector3 val in array)
{
Gizmos.DrawCube(((Component)this).transform.position + val * 1f, Vector3.one * 0.1f);
}
}
}
public class ButtonSfx : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerClickHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
}
public void OnPointerClick(PointerEventData eventData)
{
UiSfx.Instance.PlayClick();
}
}
public class CameraLookAt : MonoBehaviour
{
public Transform target;
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = Quaternion.LookRotation(target.position - ((Component)this).transform.position);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val, Time.deltaTime * 6.4f);
}
}
public class CameraShaker : MonoBehaviour
{
public ShakePreset damagePreset;
public ShakePreset chargePreset;
public ShakePreset stepShakePreset;
private Shaker shaker;
public static CameraShaker Instance;
private void Awake()
{
Instance = this;
shaker = ((Component)this).GetComponent<Shaker>();
}
public void DamageShake(float shakeRatio)
{
if (CurrentSettings.cameraShake)
{
shakeRatio *= 2f;
shakeRatio = Mathf.Clamp(shakeRatio, 0.2f, 1f);
shaker.Shake((IShakeParameters)(object)damagePreset, (int?)null).StrengthScale = shakeRatio;
}
}
public void StepShake(float shakeRatio)
{
if (CurrentSettings.cameraShake)
{
shaker.Shake((IShakeParameters)(object)stepShakePreset, (int?)null).StrengthScale = shakeRatio;
}
}
public void ChargeShake(float shakeRatio)
{
if (CurrentSettings.cameraShake)
{
shakeRatio = Mathf.Clamp(shakeRatio, 0.2f, 1f);
shaker.Shake((IShakeParameters)(object)chargePreset, (int?)null).StrengthScale = shakeRatio;
}
}
public void ShakeWithPreset(ShakePreset preset)
{
if (CurrentSettings.cameraShake)
{
shaker.Shake((IShakeParameters)(object)preset, (int?)null);
}
}
public void ShakeWithPresetAndRatio(ShakePreset preset, float shakeRatio)
{
if (CurrentSettings.cameraShake)
{
shakeRatio *= 2f;
shakeRatio = Mathf.Clamp(shakeRatio, 0.2f, 1f);
shaker.Shake((IShakeParameters)(object)preset, (int?)null).StrengthScale = shakeRatio;
}
}
}
public class CampSpawner : MonoBehaviour
{
[Serializable]
public class WeightedSpawn
{
public GameObject prefab;
public float weight;
}
public WeightedSpawn[] structurePrefabs;
private int mapChunkSize;
private float worldEdgeBuffer = 0.6f;
public int maxCaves = 50;
public int minCaves = 3;
protected ConsistentRandom randomGen;
public static ConsistentRandom woodmanRandomGen;
public LayerMask whatIsTerrain;
private List<GameObject> structures;
public bool dontAddToResourceManager;
public StructureSpawner houses;
private Vector3[] shrines;
private float totalWeight;
public float worldScale { get; set; } = 12f;
private void Start()
{
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
structures = new List<GameObject>();
randomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
woodmanRandomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
shrines = (Vector3[])(object)new Vector3[maxCaves];
mapChunkSize = MapGenerator.mapChunkSize;
worldScale *= worldEdgeBuffer;
WeightedSpawn[] array = structurePrefabs;
foreach (WeightedSpawn weightedSpawn in array)
{
totalWeight += weightedSpawn.weight;
}
int num = 0;
int num2 = 0;
RaycastHit hit = default(RaycastHit);
while (num < maxCaves)
{
num2++;
float num3 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
float num4 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
Vector3 val = new Vector3(num3, 0f, num4) * worldScale;
val.y = 200f;
Debug.DrawLine(val, val + Vector3.down * 500f, Color.cyan, 50f);
if (Physics.Raycast(val, Vector3.down, ref hit, 500f, LayerMask.op_Implicit(whatIsTerrain)))
{
if (WorldUtility.WorldHeightToBiome(((RaycastHit)(ref hit)).point.y) != TextureData.TerrainType.Grass || Mathf.Abs(Vector3.Angle(Vector3.up, ((RaycastHit)(ref hit)).normal)) > 15f)
{
continue;
}
shrines[num] = ((RaycastHit)(ref hit)).point;
num++;
GameObject val2 = FindObjectToSpawn(structurePrefabs, totalWeight);
GameObject val3 = Object.Instantiate<GameObject>(val2, ((RaycastHit)(ref hit)).point, val2.transform.rotation);
if (!dontAddToResourceManager)
{
val3.GetComponentInChildren<SharedObject>().SetId(ResourceManager.Instance.GetNextId());
}
structures.Add(val3);
Process(val3, hit);
}
if ((num2 > maxCaves * 2 && num >= minCaves) || num2 > maxCaves * 10)
{
break;
}
}
if (!dontAddToResourceManager)
{
ResourceManager.Instance.AddResources(structures);
}
}
public virtual void Process(GameObject newStructure, RaycastHit hit)
{
GenerateCamp component = newStructure.GetComponent<GenerateCamp>();
component.houseSpawner = houses;
component.MakeCamp(randomGen);
}
private void OnDrawGizmos()
{
}
public GameObject FindObjectToSpawn(WeightedSpawn[] structurePrefabs, float totalWeight)
{
float num = (float)randomGen.NextDouble();
float num2 = 0f;
for (int i = 0; i < structurePrefabs.Length; i++)
{
num2 += structurePrefabs[i].weight;
if (num < num2 / totalWeight)
{
return structurePrefabs[i].prefab;
}
}
return structurePrefabs[0].prefab;
}
}
public class CauldronUI : InventoryExtensions
{
public InventoryCell[] ingredientCells;
public InventoryCell fuelCell;
public InventoryCell resultCell;
public InventoryItem.ProcessType processType;
public InventoryItem[] processableFood;
private bool processing;
private float currentProcessTime;
private float totalProcessTime;
private float timeToProcess;
public RawImage processBar;
public static CauldronUI Instance;
public InventoryCell[] synchedCells;
private float closedTime;
private float closedProgress;
private void Awake()
{
Instance = this;
((Component)this).gameObject.SetActive(false);
}
public void CopyChest(Chest c)
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
if (!((Component)this).gameObject.activeInHierarchy)
{
return;
}
InventoryItem[] cells = OtherInput.Instance.currentChest.cells;
for (int i = 0; i < cells.Length; i++)
{
if (i < synchedCells.Length)
{
if (c.locked[i])
{
((Behaviour)synchedCells[i]).enabled = false;
}
else
{
((Behaviour)synchedCells[i]).enabled = true;
}
if ((Object)(object)cells[i] != (Object)null)
{
synchedCells[i].currentItem = Object.Instantiate<InventoryItem>(cells[i]);
}
else
{
synchedCells[i].currentItem = null;
}
synchedCells[i].UpdateCell();
}
}
((Component)processBar).transform.localScale = new Vector3(((CauldronSync)OtherInput.Instance.currentChest).ProgressRatio(), 1f, 1f);
}
public override void UpdateCraftables()
{
}
private void OnDisable()
{
}
private void OnEnable()
{
}
private void Update()
{
}
private void StopProcessing()
{
}
public void ProcessItem()
{
}
private void UseMaterial(InventoryCell cell)
{
}
private void UseFuel(InventoryCell cell)
{
}
private void AddMaterial(InventoryCell cell, InventoryItem processedItem)
{
}
public InventoryItem CanProcess()
{
return null;
}
public InventoryItem FindItemByIngredients(InventoryCell[] iCells)
{
return null;
}
private bool NoIngredients()
{
return false;
}
}
public class Cave : MonoBehaviour
{
public TextureData textureData;
public SpawnChestsInLocations chestSpawner;
private MeshRenderer rend;
private ConsistentRandom rand;
public void SetCave(ConsistentRandom rand)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
this.rand = rand;
rend = ((Component)this).GetComponent<MeshRenderer>();
Color color = ((Renderer)rend).material.color;
Color tint = textureData.layers[2].tint;
Color color2 = (color + tint) / 2f;
((Renderer)rend).material.color = color2;
chestSpawner.SetChests(rand);
SpawnResourcesInLocations[] componentsInChildren = ((Component)this).GetComponentsInChildren<SpawnResourcesInLocations>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].SetResources(rand);
}
}
}
public class CaveSpawner : MonoBehaviour
{
[Serializable]
public class WeightedSpawn
{
public GameObject prefab;
public float weight;
}
public WeightedSpawn[] structurePrefabs;
private int mapChunkSize;
private float worldEdgeBuffer = 0.6f;
public int maxCaves = 50;
public int minCaves = 3;
protected ConsistentRandom randomGen;
public LayerMask whatIsTerrain;
private List<GameObject> structures;
public bool dontAddToResourceManager;
private Vector3[] shrines;
private float totalWeight;
public float worldScale { get; set; } = 12f;
private void Start()
{
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
structures = new List<GameObject>();
randomGen = new ConsistentRandom(GameManager.GetSeed() + ResourceManager.GetNextGenOffset());
shrines = (Vector3[])(object)new Vector3[maxCaves];
mapChunkSize = MapGenerator.mapChunkSize;
worldScale *= worldEdgeBuffer;
WeightedSpawn[] array = structurePrefabs;
foreach (WeightedSpawn weightedSpawn in array)
{
totalWeight += weightedSpawn.weight;
}
int num = 0;
int num2 = 0;
RaycastHit hit = default(RaycastHit);
while (num < maxCaves)
{
num2++;
float num3 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
float num4 = (float)(randomGen.NextDouble() * 2.0 - 1.0) * (float)mapChunkSize / 2f;
Vector3 val = new Vector3(num3, 0f, num4) * worldScale;
val.y = 200f;
Debug.DrawLine(val, val + Vector3.down * 500f, Color.cyan, 50f);
if (Physics.Raycast(val, Vector3.down, ref hit, 500f, LayerMask.op_Implicit(whatIsTerrain)))
{
if (WorldUtility.WorldHeightToBiome(((RaycastHit)(ref hit)).point.y) != TextureData.TerrainType.Grass || Mathf.Abs(Vector3.Angle(Vector3.up, ((RaycastHit)(ref hit)).normal)) > 15f)
{
continue;
}
shrines[num] = ((RaycastHit)(ref hit)).point;
num++;
GameObject val2 = FindObjectToSpawn(structurePrefabs, totalWeight);
GameObject val3 = Object.Instantiate<GameObject>(val2, ((RaycastHit)(ref hit)).point, val2.transform.rotation);
if (!dontAddToResourceManager)
{
val3.GetComponentInChildren<SharedObject>().SetId(ResourceManager.Instance.GetNextId());
}
structures.Add(val3);
Process(val3, hit);
}
if ((num2 > maxCaves * 2 && num >= minCaves) || num2 > maxCaves * 10)
{
break;
}
}
if (!dontAddToResourceManager)
{
ResourceManager.Instance.AddResources(structures);
}
}
public virtual void Process(GameObject newStructure, RaycastHit hit)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
Cave component = newStructure.GetComponent<Cave>();
((Component)component).transform.rotation = Quaternion.Euler(-90f, (float)(randomGen.Next() * 360), 0f);
component.SetCave(randomGen);
}
private void OnDrawGizmos()
{
}
public GameObject FindObjectToSpawn(WeightedSpawn[] structurePrefabs, float totalWeight)
{
float num = (float)randomGen.NextDouble();
float num2 = 0f;
for (int i = 0; i < structurePrefabs.Length; i++)
{
num2 += structurePrefabs[i].weight;
if (num < num2 / totalWeight)
{
return structurePrefabs[i].prefab;
}
}
return structurePrefabs[0].prefab;
}
}
public class ChatBox : MonoBehaviour
{
public Image overlay;
public TMP_InputField inputField;
public TextMeshProUGUI messages;
public Color localPlayer;
public Color onlinePlayer;
public Color deadPlayer;
private Color console = Color.cyan;
private int maxMsgLength = 120;
private int maxChars = 800;
private int purgeAmount = 400;
public static ChatBox Instance;
public TextAsset profanityList;
private List<string> profanity;
public string[] commands = new string[5] { "seed", "ping", "debug", "kill", "kick" };
public bool typing { get; set; }
private void Awake()
{
Instance = this;
HideChat();
profanity = new List<string>();
string[] array = profanityList.text.Split(new char[1] { '\n' });
foreach (string input in array)
{
profanity.Add(RemoveWhitespace(input));
}
}
public static string RemoveWhitespace(string input)
{
return new string((from c in input.ToCharArray()
where !char.IsWhiteSpace(c)
select c).ToArray());
}
public void AppendMessage(int fromUser, string message, string fromUsername)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
string text = TrimMessage(message);
string text2 = "\n";
if (fromUser != -1)
{
string text3 = "<color=";
text3 = ((fromUser == LocalClient.instance.myId) ? (text3 + "#" + ColorUtility.ToHtmlStringRGB(localPlayer) + ">") : ((!GameManager.players[fromUser].dead) ? (text3 + "#" + ColorUtility.ToHtmlStringRGB(onlinePlayer) + ">") : (text3 + "#" + ColorUtility.ToHtmlStringRGB(deadPlayer) + ">")));
text2 += text3;
}
if (GameManager.gameSettings.gameMode != GameSettings.GameMode.Versus || fromUser == -1 || !GameManager.players[fromUser].dead || PlayerStatus.Instance.IsPlayerDead())
{
if (fromUser != -1 || (fromUser == -1 && fromUsername != ""))
{
text2 = text2 + fromUsername + ": ";
}
text2 += text;
TextMeshProUGUI obj = messages;
((TMP_Text)obj).text = ((TMP_Text)obj).text + text2;
int length = ((TMP_Text)messages).text.Length;
if (length > maxChars)
{
int startIndex = length - purgeAmount;
((TMP_Text)messages).text = ((TMP_Text)messages).text.Substring(startIndex);
}
ShowChat();
if (!typing)
{
((MonoBehaviour)this).CancelInvoke("HideChat");
((MonoBehaviour)this).Invoke("HideChat", 5f);
}
}
}
public void SendMessage(string message)
{
typing = false;
message = TrimMessage(message);
if (message == "")
{
return;
}
if (message[0] == '/')
{
ChatCommand(message);
return;
}
foreach (string item in profanity)
{
message = Regex.Replace(message, item, "muck");
}
AppendMessage(0, message, GameManager.players[LocalClient.instance.myId].username);
ClientSend.SendChatMessage(message);
ClearMessage();
}
private void ClearMessage()
{
inputField.text = "";
((Selectable)inputField).interactable = false;
}
private void ChatCommand(string message)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (message.Length <= 0)
{
return;
}
string text = message.Split(new char[1] { ' ' })[0].Substring(1);
ClearMessage();
string text2 = "#" + ColorUtility.ToHtmlStringRGB(console);
switch (text)
{
case "seed":
{
int seed = GameManager.gameSettings.Seed;
AppendMessage(-1, "<color=" + text2 + ">Seed: " + seed + " (copied to clipboard)<color=white>", "");
GUIUtility.systemCopyBuffer = string.Concat(seed);
break;
}
case "ping":
AppendMessage(-1, "<color=" + text2 + ">pong<color=white>", "");
break;
case "debug":
DebugNet.Instance.ToggleConsole();
break;
case "kill":
PlayerStatus.Instance.Damage(0, 0, ignoreProtection: true);
break;
case "kick":
{
int startIndex = message.IndexOf(" ", StringComparison.Ordinal) + 1;
string username = message.Substring(startIndex);
if (!GameManager.instance.KickPlayer(username))
{
AppendMessage(0, "Failed to kick player...", GameManager.players[LocalClient.instance.myId].username);
}
break;
}
}
}
private string TrimMessage(string message)
{
if (string.IsNullOrEmpty(message))
{
return "";
}
return message.Substring(0, Mathf.Min(message.Length, maxMsgLength));
}
private void UserInput()
{
if (Input.GetKeyDown((KeyCode)13))
{
if (typing)
{
SendMessage(inputField.text);
}
else
{
ShowChat();
((Selectable)inputField).interactable = true;
((Selectable)inputField).Select();
typing = true;
}
}
if (typing && !inputField.isFocused)
{
((Selectable)inputField).Select();
}
if (Input.GetKeyDown((KeyCode)27) && typing)
{
ClearMessage();
typing = false;
((MonoBehaviour)this).CancelInvoke("HideChat");
((MonoBehaviour)this).Invoke("HideChat", 5f);
}
}
private void Update()
{
UserInput();
}
private void HideChat()
{
if (!typing)
{
typing = false;
((Graphic)overlay).CrossFadeAlpha(0f, 1f, true);
((Graphic)messages).CrossFadeAlpha(0f, 1f, true);
((Graphic)((Component)inputField).GetComponent<Image>()).CrossFadeAlpha(0f, 1f, true);
((Graphic)((Component)inputField).GetComponentInChildren<TextMeshProUGUI>()).CrossFadeAlpha(0f, 1f, true);
}
}
private void ShowChat()
{
((Graphic)overlay).CrossFadeAlpha(1f, 0.2f, true);
((Graphic)messages).CrossFadeAlpha(1f, 0.2f, true);
((Graphic)((Component)inputField).GetComponent<Image>()).CrossFadeAlpha(0.2f, 1f, true);
((Graphic)((Component)inputField).GetComponentInChildren<TextMeshProUGUI>()).CrossFadeAlpha(0.2f, 1f, true);
}
}
public class Chest : MonoBehaviour
{
public InventoryItem[] cells;
public int chestSize = 21;
public bool inUse;
public bool[] locked;
private Animator animator;
public int id { get; set; }
private void Start()
{
locked = new bool[chestSize];
animator = ((Component)this).GetComponent<Animator>();
if (cells == null || cells.Length == 0)
{
cells = new InventoryItem[chestSize];
}
}
public void Use(bool b)
{
if (Object.op_Implicit((Object)(object)animator))
{
animator.SetBool("Use", b);
}
inUse = b;
}
public bool IsUsed()
{
return inUse;
}
public virtual void UpdateCraftables()
{
}
public void InitChest(List<InventoryItem> items, ConsistentRandom rand)
{
cells = new InventoryItem[chestSize];
List<int> list = new List<int>();
for (int i = 0; i < chestSize; i++)
{
list.Add(i);
}
foreach (InventoryItem item in items)
{
int num = rand.Next(0, list.Count);
list.Remove(num);
cells[num] = item;
}
}
}
public class ChestSfx : MonoBehaviour
{
public AudioClip open;
public AudioClip close;
private AudioSource audio;
private void Awake()
{
audio = ((Component)this).GetComponent<AudioSource>();
}
public void OpenChest()
{
audio.clip = open;
audio.Play();
}
public void CloseChest()
{
audio.clip = close;
audio.Play();
}
}
public class ChiefChestInteract : ChestInteract
{
public bool alreadyOpened;
public int mobZoneId;
protected override void WhenOpened()
{
if (!alreadyOpened)
{
alreadyOpened = true;
if (Object.op_Implicit((Object)(object)AchievementManager.Instance))
{
AchievementManager.Instance.OpenChiefChest();
}
}
}
}
public class CinematicCamera : MonoBehaviour
{
public Transform target;
public float speed;
private void Update()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.LookAt(target);
((Component)this).transform.RotateAround(target.position, Vector3.up, speed);
}
}
public class ColorAtmosphere : MonoBehaviour
{
[Header("Ground / Grass")]
public TextureData textureData;
public Color defaultGrassColor;
public Color[] colorRange;
public Color[] grassColorRange;
public Color groundColor;
public Color grassColor;
public Material grass;
[Header("Fog")]
public DayCycle dayCycle;
public Color[]