using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DripRemix.Handlers;
using OBJImporter;
using Reptile;
using Reptile.Phone;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BRC-DripRemix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BRC-DripRemix")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a8395581-4eea-4793-bb1c-ea718aa90e0f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7", FrameworkDisplayName = "")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace OBJImporter
{
public class OBJCharWordReader
{
public char[] word;
public int wordSize;
public bool endReached;
private StreamReader reader;
private int bufferSize;
private char[] buffer;
public char currentChar;
private int currentPosition = 0;
private int maxPosition = 0;
public OBJCharWordReader(StreamReader reader, int bufferSize)
{
this.reader = reader;
this.bufferSize = bufferSize;
buffer = new char[this.bufferSize];
word = new char[this.bufferSize];
MoveNext();
}
public void SkipWhitespaces()
{
while (char.IsWhiteSpace(currentChar))
{
MoveNext();
}
}
public void SkipWhitespaces(out bool newLinePassed)
{
newLinePassed = false;
while (char.IsWhiteSpace(currentChar))
{
if (currentChar == '\r' || currentChar == '\n')
{
newLinePassed = true;
}
MoveNext();
}
}
public void SkipUntilNewLine()
{
while (currentChar != 0 && currentChar != '\n' && currentChar != '\r')
{
MoveNext();
}
SkipNewLineSymbols();
}
public void ReadUntilWhiteSpace()
{
wordSize = 0;
while (currentChar != 0 && !char.IsWhiteSpace(currentChar))
{
word[wordSize] = currentChar;
wordSize++;
MoveNext();
}
}
public void ReadUntilNewLine()
{
wordSize = 0;
while (currentChar != 0 && currentChar != '\n' && currentChar != '\r')
{
word[wordSize] = currentChar;
wordSize++;
MoveNext();
}
SkipNewLineSymbols();
}
public bool Is(string other)
{
if (other.Length != wordSize)
{
return false;
}
for (int i = 0; i < wordSize; i++)
{
if (word[i] != other[i])
{
return false;
}
}
return true;
}
public string GetString(int startIndex = 0)
{
if (startIndex >= wordSize - 1)
{
return string.Empty;
}
return new string(word, startIndex, wordSize - startIndex);
}
public Vector3 ReadVector()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
SkipWhitespaces();
float num = ReadFloat();
SkipWhitespaces();
float num2 = ReadFloat();
SkipWhitespaces(out var newLinePassed);
float num3 = 0f;
if (!newLinePassed)
{
num3 = ReadFloat();
}
return new Vector3(num, num2, num3);
}
public int ReadInt()
{
int num = 0;
bool flag = currentChar == '-';
if (flag)
{
MoveNext();
}
while (currentChar >= '0' && currentChar <= '9')
{
int num2 = currentChar - 48;
num = num * 10 + num2;
MoveNext();
}
return flag ? (-num) : num;
}
public float ReadFloat()
{
bool flag = currentChar == '-';
if (flag)
{
MoveNext();
}
float num = ReadInt();
if (currentChar == '.' || currentChar == ',')
{
MoveNext();
num += ReadFloatEnd();
if (currentChar == 'e' || currentChar == 'E')
{
MoveNext();
int num2 = ReadInt();
num *= Mathf.Pow(10f, (float)num2);
}
}
if (flag)
{
num = 0f - num;
}
return num;
}
private float ReadFloatEnd()
{
float num = 0f;
float num2 = 0.1f;
while (currentChar >= '0' && currentChar <= '9')
{
int num3 = currentChar - 48;
num += (float)num3 * num2;
num2 *= 0.1f;
MoveNext();
}
return num;
}
private void SkipNewLineSymbols()
{
while (currentChar == '\n' || currentChar == '\r')
{
MoveNext();
}
}
public void MoveNext()
{
currentPosition++;
if (currentPosition >= maxPosition)
{
if (reader.EndOfStream)
{
currentChar = '\0';
endReached = true;
return;
}
currentPosition = 0;
maxPosition = reader.Read(buffer, 0, bufferSize);
}
currentChar = buffer[currentPosition];
}
}
public enum SplitMode
{
None,
Object,
Material
}
public class OBJLoader
{
public SplitMode SplitMode = SplitMode.Object;
internal List<Vector3> Vertices = new List<Vector3>();
internal List<Vector3> Normals = new List<Vector3>();
internal List<Vector2> UVs = new List<Vector2>();
private FileInfo _objInfo;
public Mesh Load(Stream input)
{
//IL_0380: Unknown result type (might be due to invalid IL or missing references)
//IL_0387: Expected O, but got Unknown
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_0128: Unknown result type (might be due to invalid IL or missing references)
StreamReader reader = new StreamReader(input);
Dictionary<string, OBJObjectBuilder> builderDict = new Dictionary<string, OBJObjectBuilder>();
OBJObjectBuilder currentBuilder = null;
string material = "default";
List<int> list = new List<int>();
List<int> list2 = new List<int>();
List<int> list3 = new List<int>();
Action<string> action = delegate(string objectName)
{
if (!builderDict.TryGetValue(objectName, out currentBuilder))
{
currentBuilder = new OBJObjectBuilder(objectName, this);
builderDict[objectName] = currentBuilder;
}
};
action("default");
OBJCharWordReader oBJCharWordReader = new OBJCharWordReader(reader, 4096);
while (true)
{
oBJCharWordReader.SkipWhitespaces();
if (oBJCharWordReader.endReached)
{
break;
}
oBJCharWordReader.ReadUntilWhiteSpace();
if (oBJCharWordReader.Is("#"))
{
oBJCharWordReader.SkipUntilNewLine();
}
else if (oBJCharWordReader.Is("v"))
{
Vertices.Add(oBJCharWordReader.ReadVector());
}
else if (oBJCharWordReader.Is("vn"))
{
Normals.Add(oBJCharWordReader.ReadVector());
}
else if (oBJCharWordReader.Is("vt"))
{
UVs.Add(Vector2.op_Implicit(oBJCharWordReader.ReadVector()));
}
else if (oBJCharWordReader.Is("usemtl"))
{
oBJCharWordReader.SkipWhitespaces();
oBJCharWordReader.ReadUntilNewLine();
string @string = oBJCharWordReader.GetString();
material = @string;
if (SplitMode == SplitMode.Material)
{
action(@string);
}
}
else if ((oBJCharWordReader.Is("o") || oBJCharWordReader.Is("g")) && SplitMode == SplitMode.Object)
{
oBJCharWordReader.ReadUntilNewLine();
string string2 = oBJCharWordReader.GetString(1);
action(string2);
}
else if (oBJCharWordReader.Is("f"))
{
while (true)
{
oBJCharWordReader.SkipWhitespaces(out var newLinePassed);
if (newLinePassed)
{
break;
}
int num = int.MinValue;
int num2 = int.MinValue;
int num3 = int.MinValue;
num = oBJCharWordReader.ReadInt();
if (oBJCharWordReader.currentChar == '/')
{
oBJCharWordReader.MoveNext();
if (oBJCharWordReader.currentChar != '/')
{
num3 = oBJCharWordReader.ReadInt();
}
if (oBJCharWordReader.currentChar == '/')
{
oBJCharWordReader.MoveNext();
num2 = oBJCharWordReader.ReadInt();
}
}
if (num > int.MinValue)
{
if (num < 0)
{
num = Vertices.Count - num;
}
num--;
}
if (num2 > int.MinValue)
{
if (num2 < 0)
{
num2 = Normals.Count - num2;
}
num2--;
}
if (num3 > int.MinValue)
{
if (num3 < 0)
{
num3 = UVs.Count - num3;
}
num3--;
}
list.Add(num);
list2.Add(num2);
list3.Add(num3);
}
currentBuilder.PushFace(material, list, list2, list3);
list.Clear();
list2.Clear();
list3.Clear();
}
else
{
oBJCharWordReader.SkipUntilNewLine();
}
}
Mesh result = new Mesh();
foreach (KeyValuePair<string, OBJObjectBuilder> item in builderDict)
{
if (item.Value.PushedFaceCount != 0)
{
result = item.Value.Build();
}
}
return result;
}
public Mesh Load(string path)
{
string text = null;
_objInfo = new FileInfo(path);
if (!string.IsNullOrEmpty(text) && File.Exists(text))
{
using (FileStream input = new FileStream(path, FileMode.Open))
{
return Load(input);
}
}
using FileStream input2 = new FileStream(path, FileMode.Open);
return Load(input2);
}
}
public static class OBJLoaderHelper
{
public static float FastFloatParse(string input)
{
if (input.Contains("e") || input.Contains("E"))
{
return float.Parse(input, CultureInfo.InvariantCulture);
}
float num = 0f;
int num2 = 0;
int length = input.Length;
if (length == 0)
{
return float.NaN;
}
char c = input[0];
float num3 = 1f;
if (c == '-')
{
num3 = -1f;
num2++;
if (num2 >= length)
{
return float.NaN;
}
}
while (true)
{
if (num2 >= length)
{
return num3 * num;
}
c = input[num2++];
if (c < '0' || c > '9')
{
break;
}
num = num * 10f + (float)(c - 48);
}
if (c != '.' && c != ',')
{
return float.NaN;
}
float num4 = 0.1f;
while (num2 < length)
{
c = input[num2++];
if (c < '0' || c > '9')
{
return float.NaN;
}
num += (float)(c - 48) * num4;
num4 *= 0.1f;
}
return num3 * num;
}
public static int FastIntParse(string input)
{
int num = 0;
bool flag = input[0] == '-';
for (int i = (flag ? 1 : 0); i < input.Length; i++)
{
num = num * 10 + (input[i] - 48);
}
return flag ? (-num) : num;
}
public static Vector3 VectorFromStrArray(string[] cmps)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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)
float num = FastFloatParse(cmps[1]);
float num2 = FastFloatParse(cmps[2]);
if (cmps.Length == 4)
{
float num3 = FastFloatParse(cmps[3]);
return new Vector3(num, num2, num3);
}
return Vector2.op_Implicit(new Vector2(num, num2));
}
public static Color ColorFromStrArray(string[] cmps, float scalar = 1f)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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)
float num = FastFloatParse(cmps[1]) * scalar;
float num2 = FastFloatParse(cmps[2]) * scalar;
float num3 = FastFloatParse(cmps[3]) * scalar;
return new Color(num, num2, num3);
}
}
public class OBJObjectBuilder
{
private class ObjLoopHash
{
public int vertexIndex;
public int normalIndex;
public int uvIndex;
public override bool Equals(object obj)
{
if (!(obj is ObjLoopHash))
{
return false;
}
ObjLoopHash objLoopHash = obj as ObjLoopHash;
return objLoopHash.vertexIndex == vertexIndex && objLoopHash.uvIndex == uvIndex && objLoopHash.normalIndex == normalIndex;
}
public override int GetHashCode()
{
int num = 3;
num = num * 314159 + vertexIndex;
num = num * 314159 + normalIndex;
return num * 314159 + uvIndex;
}
}
private OBJLoader _loader;
private string _name;
private Dictionary<ObjLoopHash, int> _globalIndexRemap = new Dictionary<ObjLoopHash, int>();
private Dictionary<string, List<int>> _materialIndices = new Dictionary<string, List<int>>();
private List<int> _currentIndexList;
private string _lastMaterial = null;
private List<Vector3> _vertices = new List<Vector3>();
private List<Vector3> _normals = new List<Vector3>();
private List<Vector2> _uvs = new List<Vector2>();
private bool recalculateNormals = false;
public int PushedFaceCount { get; private set; } = 0;
public Mesh Build()
{
//IL_0003: 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_0015: 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_0045: Expected O, but got Unknown
int num = 0;
Mesh val = new Mesh
{
name = _name,
indexFormat = (IndexFormat)(_vertices.Count > 65535),
subMeshCount = _materialIndices.Count
};
val.SetVertices(_vertices);
val.SetNormals(_normals);
val.SetUVs(0, _uvs);
foreach (KeyValuePair<string, List<int>> materialIndex in _materialIndices)
{
val.SetTriangles(materialIndex.Value, num);
num++;
}
if (recalculateNormals)
{
val.RecalculateNormals();
}
val.RecalculateTangents();
val.RecalculateBounds();
return val;
}
public void SetMaterial(string name)
{
if (!_materialIndices.TryGetValue(name, out _currentIndexList))
{
_currentIndexList = new List<int>();
_materialIndices[name] = _currentIndexList;
}
}
public void PushFace(string material, List<int> vertexIndices, List<int> normalIndices, List<int> uvIndices)
{
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: 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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
if (vertexIndices.Count < 3)
{
return;
}
if (material != _lastMaterial)
{
SetMaterial(material);
_lastMaterial = material;
}
int[] array = new int[vertexIndices.Count];
for (int i = 0; i < vertexIndices.Count; i++)
{
int num = vertexIndices[i];
int num2 = normalIndices[i];
int num3 = uvIndices[i];
ObjLoopHash key = new ObjLoopHash
{
vertexIndex = num,
normalIndex = num2,
uvIndex = num3
};
int value = -1;
if (!_globalIndexRemap.TryGetValue(key, out value))
{
_globalIndexRemap.Add(key, _vertices.Count);
value = _vertices.Count;
_vertices.Add((num >= 0 && num < _loader.Vertices.Count) ? _loader.Vertices[num] : Vector3.zero);
_normals.Add((num2 >= 0 && num2 < _loader.Normals.Count) ? _loader.Normals[num2] : Vector3.zero);
_uvs.Add((num3 >= 0 && num3 < _loader.UVs.Count) ? _loader.UVs[num3] : Vector2.zero);
if (num2 < 0)
{
recalculateNormals = true;
}
}
array[i] = value;
}
if (array.Length == 3)
{
_currentIndexList.AddRange(new int[3]
{
array[0],
array[1],
array[2]
});
}
else if (array.Length == 4)
{
_currentIndexList.AddRange(new int[3]
{
array[0],
array[1],
array[2]
});
_currentIndexList.AddRange(new int[3]
{
array[2],
array[3],
array[0]
});
}
else if (array.Length > 4)
{
for (int num4 = array.Length - 1; num4 >= 2; num4--)
{
_currentIndexList.AddRange(new int[3]
{
array[0],
array[num4 - 1],
array[num4]
});
}
}
PushedFaceCount++;
}
public OBJObjectBuilder(string name, OBJLoader loader)
{
_name = name;
_loader = loader;
}
}
}
namespace DripRemix
{
public class AssetFolder
{
public DirectoryInfo directory;
public Dictionary<string, Mesh> meshes;
public List<Texture> textures;
public List<Texture> emissions;
public Dictionary<string, string> parameters;
public List<Texture> sprites1;
public List<Texture> sprites2;
public AssetFolder(DirectoryInfo _directory, Dictionary<string, Mesh> _meshes, List<Texture> _textures, List<Texture> _emissions, Dictionary<string, string> _parameters)
{
directory = _directory;
meshes = _meshes;
textures = _textures;
emissions = _emissions;
parameters = _parameters;
sprites1 = new List<Texture>();
sprites2 = new List<Texture>();
}
public AssetFolder(DirectoryInfo _directory, Dictionary<string, Mesh> _meshes, List<Texture> _textures, List<Texture> _emissions, Dictionary<string, string> _parameters, List<Texture> _sprites1, List<Texture> _sprites2)
{
directory = _directory;
meshes = _meshes;
textures = _textures;
emissions = _emissions;
parameters = _parameters;
sprites1 = _sprites1;
sprites2 = _sprites2;
}
public string description()
{
string text = "MISSING_NAME";
string text2 = "MISSING_AUTHOR";
text = parameters["name"];
text2 = parameters["author"];
return "\n • " + text + " by " + text2;
}
}
public static class Infos
{
public const string PLUGIN_ID = "fr.github.andylobjois.brc-dripremix";
public const string PLUGIN_NAME = "DripRemix";
public const string PLUGIN_VERSION = "1.0.9";
}
[BepInPlugin("fr.github.andylobjois.brc-dripremix", "DripRemix", "1.0.9")]
[BepInProcess("Bomb Rush Cyberfunk.exe")]
public class Main : BaseUnityPlugin
{
public enum Check
{
Character,
Gear,
Phone,
Spraycan
}
public static Main Instance;
internal static DirectoryInfo FolderModding = Directory.CreateDirectory(Path.Combine(Paths.GameRootPath, "ModdingFolder", "BRC-DripRemix"));
internal static DirectoryInfo FolderCharacter = FolderModding.CreateSubdirectory("Characters");
internal static DirectoryInfo FolderGears = FolderModding.CreateSubdirectory("Gears");
internal static DirectoryInfo FolderBMX = FolderGears.CreateSubdirectory("Bmx");
internal static DirectoryInfo FolderInline = FolderGears.CreateSubdirectory("Inline");
internal static DirectoryInfo FolderSkateboard = FolderGears.CreateSubdirectory("Skateboard");
internal static DirectoryInfo FolderPhone = FolderGears.CreateSubdirectory("Phones");
internal static DirectoryInfo FolderSpraycan = FolderGears.CreateSubdirectory("Spraycans");
internal ConfigEntry<KeyCode> keyCharacter;
internal ConfigEntry<KeyCode> keyGear;
internal ConfigEntry<KeyCode> keyPhone;
internal ConfigEntry<KeyCode> keySpraycan;
internal ConfigEntry<KeyCode> keyReload;
internal ConfigEntry<KeyCode> keyMeshUp;
internal ConfigEntry<KeyCode> keyMeshDown;
internal ConfigEntry<KeyCode> keyTextureUp;
internal ConfigEntry<KeyCode> keyTextureDown;
public static Save SAVE = new Save();
public int HASH;
public bool GRAFFITIGAME_EDITED = false;
public GameObject PLAYER;
public CharacterVisual PLAYER_VISUAL;
public Phone PLAYER_PHONE;
public Dictionary<string, Material> MATERIALS = new Dictionary<string, Material>();
public static string CURRENTCHARACTER;
public CharacterHandler CHARACTER;
public Dictionary<MoveStyle, GearHandler> GEARS = new Dictionary<MoveStyle, GearHandler>();
public PhoneHandler PHONES;
public SpraycanHandler SPRAYCANS;
public Dictionary<string, string> ConvertNames = new Dictionary<string, string>
{
{ "girl1", "Vinyl" },
{ "frank", "Frank" },
{ "ringdude", "Coil" },
{ "metalHead", "Red" },
{ "blockGuy", "Tryce" },
{ "spaceGirl", "Bel" },
{ "angel", "Rave" },
{ "eightBall", "DOT EXE" },
{ "dummy", "Solace" },
{ "dj", "DJ Cyber" },
{ "medusa", "Eclipse" },
{ "boarder", "Devil Theory" },
{ "headMan", "Faux" },
{ "prince", "Flesh Prince" },
{ "jetpackBossPlayer", "Irene Rietveld" },
{ "legendFace", "Felix" },
{ "oldheadPlayer", "Oldhead" },
{ "robot", "Base" },
{ "skate", "Jay" },
{ "wideKid", "Mesh" },
{ "futureGirl", "Futurism" },
{ "pufferGirl", "Rise" },
{ "bunGirl", "Shine" },
{ "headManNoJetpack", "Faux (Prelude)" },
{ "eightBallBoss", "DOT EXE (Boss)" },
{ "legendMetalHead", "Red Felix (Dream)" }
};
internal static ManualLogSource Log { get; private set; }
private void Awake()
{
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
keyReload = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Reload", (KeyCode)286, (ConfigDescription)null);
keyCharacter = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "CharacterKey", (KeyCode)99, (ConfigDescription)null);
keyGear = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "GearKey", (KeyCode)103, (ConfigDescription)null);
keyPhone = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "PhoneKey", (KeyCode)112, (ConfigDescription)null);
keySpraycan = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "SpraycanKey", (KeyCode)101, (ConfigDescription)null);
keyMeshUp = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "MeshUP", (KeyCode)278, (ConfigDescription)null);
keyMeshDown = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "MeshDOWN", (KeyCode)279, (ConfigDescription)null);
keyTextureUp = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "TextureUP", (KeyCode)280, (ConfigDescription)null);
keyTextureDown = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "TextureDOWN", (KeyCode)281, (ConfigDescription)null);
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
CHARACTER = new CharacterHandler();
GEARS.Add((MoveStyle)3, new GearHandler((MoveStyle)3));
GEARS.Add((MoveStyle)2, new GearHandler((MoveStyle)2));
GEARS.Add((MoveStyle)1, new GearHandler((MoveStyle)1));
PHONES = new PhoneHandler();
SPRAYCANS = new SpraycanHandler();
SAVE.main = this;
}
private void LateUpdate()
{
WorldHandler instance = WorldHandler.instance;
object obj;
if (instance == null)
{
obj = null;
}
else
{
Player currentPlayer = instance.currentPlayer;
obj = ((currentPlayer != null) ? ((Component)currentPlayer).gameObject : null);
}
if (!Object.op_Implicit((Object)obj))
{
return;
}
if (HASH != ((object)WorldHandler.instance.currentPlayer.characterVisual).GetHashCode())
{
HASH = ((object)WorldHandler.instance.currentPlayer.characterVisual).GetHashCode();
try
{
WorldHandler instance2 = WorldHandler.instance;
PLAYER = ((instance2 != null) ? ((Component)instance2.currentPlayer).gameObject : null);
string text = ((Object)WorldHandler.instance.currentPlayer.characterVisual).name.Replace(" ", "").Replace("Visuals(Clone)", "");
if (ConvertNames.ContainsKey(text))
{
CURRENTCHARACTER = ConvertNames[text];
}
else
{
CURRENTCHARACTER = text;
}
}
catch
{
Log.LogError((object)"Player can't be referenced !");
}
SAVE.GetSave();
GetReferences();
GetAssets();
Apply();
GetMaterials();
Log.LogMessage((object)("————————————————————————————————————————— " + RandomLine()));
}
if (WorldHandler.instance.currentPlayer.inGraffitiGame)
{
SPRAYCANS.SetGraffitiEffect();
}
}
private void Update()
{
//IL_0008: 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_002e: 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_0053: Unknown result type (might be due to invalid IL or missing references)
CheckInput(keyCharacter.Value, Check.Character);
CheckInput(keyGear.Value, Check.Gear);
CheckInput(keyPhone.Value, Check.Phone);
CheckInput(keySpraycan.Value, Check.Spraycan);
if (Input.GetKeyDown(keyReload.Value))
{
GetReferences();
GetAssets();
Apply();
Log.LogMessage((object)("————————————————————————————————————————— " + RandomLine()));
}
}
private void CheckInput(KeyCode key, Check check)
{
//IL_0001: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKey(key))
{
if (Input.GetKeyDown(keyMeshUp.Value))
{
SetMesh(check, -1);
}
if (Input.GetKeyDown(keyMeshDown.Value))
{
SetMesh(check, 1);
}
if (Input.GetKeyDown(keyTextureUp.Value))
{
SetTexture(check, -1);
}
if (Input.GetKeyDown(keyTextureDown.Value))
{
SetTexture(check, 1);
}
}
}
private void SetMesh(Check check, int add)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (check == Check.Character)
{
}
if (check == Check.Gear)
{
GEARS[WorldHandler.instance.currentPlayer.moveStyleEquipped].SetMesh(add);
}
if (check == Check.Phone)
{
PHONES.SetMesh(add);
}
if (check == Check.Spraycan)
{
SPRAYCANS.SetMesh(add);
}
SAVE.SetSave();
}
private void SetTexture(Check check, int add)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (check == Check.Character)
{
CHARACTER.SetTexture(add);
}
if (check == Check.Gear)
{
GEARS[WorldHandler.instance.currentPlayer.moveStyleEquipped].SetTexture(add);
}
if (check == Check.Phone)
{
PHONES.SetTexture(add);
}
if (check == Check.Spraycan)
{
SPRAYCANS.SetTexture(add);
}
SAVE.SetSave();
}
private void GetReferences()
{
//IL_042d: Unknown result type (might be due to invalid IL or missing references)
//IL_0432: 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)
//IL_00d8: Expected O, but got Unknown
CHARACTER.REFERENCES.Clear();
foreach (GearHandler value in GEARS.Values)
{
value.REFERENCES.Clear();
}
PHONES.REFERENCES.Clear();
SPRAYCANS.REFERENCES.Clear();
MATERIALS.Clear();
try
{
PLAYER_VISUAL = WorldHandler.instance.currentPlayer.characterVisual;
}
catch
{
Log.LogError((object)"Player.CharacterVisual can't be referenced !");
}
foreach (Transform item in PLAYER_VISUAL.characterObject.transform)
{
Transform val = item;
try
{
if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<SkinnedMeshRenderer>()))
{
CHARACTER.REFERENCES.Add(((Component)val).gameObject);
}
}
catch
{
Log.LogError((object)"Character SkinnedMeshRenderer can't be referenced !");
}
}
try
{
GEARS[(MoveStyle)2].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.skateboard);
}
catch
{
Log.LogError((object)"Player.Skateboard Gameobject can't be referenced !");
}
try
{
GEARS[(MoveStyle)3].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.skateL);
GEARS[(MoveStyle)3].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.skateR);
}
catch
{
Log.LogError((object)"Player Inline Gameobject(s) can't be referenced !");
}
try
{
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxFrame);
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxGear);
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxHandlebars);
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxPedalL);
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxPedalR);
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxWheelF);
GEARS[(MoveStyle)1].REFERENCES.Add(PLAYER_VISUAL.moveStyleProps.bmxWheelR);
}
catch
{
Log.LogError((object)"Player BMX Gameobject(s) can't be referenced !");
}
try
{
PLAYER_PHONE = WorldHandler.instance.currentPlayer.phone;
}
catch
{
Log.LogError((object)"Player.Phone can't be referenced !");
}
try
{
PHONES.REFERENCES.Add(((Component)PLAYER_VISUAL.handL.Find("propl/phoneInHand(Clone)")).gameObject);
PHONES.REFERENCES.Add(((Component)PLAYER_PHONE.openPhoneCanvas.transform.Find("PhoneContainerOpen/PhoneOpen")).gameObject);
PHONES.REFERENCES.Add(((Component)PLAYER_PHONE.closedPhoneCanvas.transform.Find("PhoneContainerClosed/PhoneClosed")).gameObject);
}
catch
{
Log.LogError((object)"Phone Gameobject(s) can't be referenced !");
}
try
{
SPRAYCANS.REFERENCES.Add(((Component)PLAYER_VISUAL.handR.Find("propr/spraycan(Clone)")).gameObject);
}
catch
{
Log.LogError((object)"Spraycan Gameobject(s) can't be referenced !");
}
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
GameObject[] array = rootGameObjects;
foreach (GameObject val2 in array)
{
if (((Object)val2).name == "spraycanCapJunk(Clone)")
{
try
{
SPRAYCANS.REFERENCES.Add(val2);
}
catch
{
Log.LogError((object)"Spraycan Cap Gameobject(s) can't be referenced !");
}
}
}
NPC[] array2 = Object.FindObjectsOfType<NPC>();
try
{
NPC[] array3 = array2;
foreach (NPC val3 in array3)
{
if (((Object)val3).name == "NPC_MovestyleChangerInline")
{
if (Object.op_Implicit((Object)(object)((Component)val3).transform.Find("SkatesPreview/skateLeft")))
{
((Object)((Component)val3).transform.Find("SkatesPreview/skateLeft")).name = "skateLeft(Clone)";
((Object)((Component)val3).transform.Find("SkatesPreview/skateRight")).name = "skateRight(Clone)";
}
GEARS[(MoveStyle)3].REFERENCES.Add(((Component)((Component)val3).transform.Find("SkatesPreview").GetChild(0)).gameObject);
GEARS[(MoveStyle)3].REFERENCES.Add(((Component)((Component)val3).transform.Find("SkatesPreview").GetChild(1)).gameObject);
}
}
}
catch
{
Log.LogError((object)"Hideout Inline Gameobject(s) can't be referenced !");
}
try
{
NPC[] array4 = array2;
foreach (NPC val4 in array4)
{
if (((Object)val4).name == "NPC_MovestyleChangerSkateboard")
{
if (Object.op_Implicit((Object)(object)((Component)val4).transform.Find("PreviewSkateboard/skateboard")))
{
((Object)((Component)val4).transform.Find("PreviewSkateboard/skateboard")).name = "skateboard(Clone)";
((Object)((Component)val4).transform.Find("PreviewSkateboard/skateboard (1)")).name = "skateboard(Clone)";
}
GEARS[(MoveStyle)2].REFERENCES.Add(((Component)((Component)val4).transform.Find("PreviewSkateboard").GetChild(0)).gameObject);
GEARS[(MoveStyle)2].REFERENCES.Add(((Component)((Component)val4).transform.Find("PreviewSkateboard").GetChild(1)).gameObject);
}
}
}
catch
{
Log.LogError((object)"Hideout Skateboard Gameobject(s) can't be referenced !");
}
try
{
NPC[] array5 = array2;
foreach (NPC val5 in array5)
{
if (((Object)val5).name == "NPC_MovestyleChangerBMX")
{
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/BmxFrame(Clone)")).gameObject);
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/bmxGear/BmxGear(Clone)")).gameObject);
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/bmxHandlebars/BmxHandlebars(Clone)")).gameObject);
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/bmxGear/bmxPedalL/BmxPedalL(Clone)")).gameObject);
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/bmxGear/bmxPedalR/BmxPedalR(Clone)")).gameObject);
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/bmxHandlebars/bmxWheelF/BmxWheelF(Clone)")).gameObject);
GEARS[(MoveStyle)1].REFERENCES.Add(((Component)((Component)val5).transform.Find("BMXPreview/bmxWheelR/BmxWheelR(Clone)")).gameObject);
}
}
}
catch
{
Log.LogError((object)"Hideout BMX Gameobject(s) can't be referenced !");
}
}
private void GetAssets()
{
CHARACTER.GetAssets();
foreach (GearHandler value in GEARS.Values)
{
value.GetAssets();
}
PHONES.GetAssets();
SPRAYCANS.GetAssets();
}
private void GetMaterials()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Expected O, but got Unknown
if (Object.op_Implicit((Object)(object)Core.instance.Assets))
{
Bundle val = Core.instance.Assets.availableBundles["common_assets"];
MATERIALS.Add("Character", new Material(val.assetBundle.LoadAsset<Material>("pedestrianMat").shader));
MATERIALS.Add("Environment", new Material(val.assetBundle.LoadAsset<Material>("Hideout_Buildings03AtlasMat").shader));
MATERIALS.Add("TransparentCutout", new Material(val.assetBundle.LoadAsset<Material>("Hideout_PropsAtlasMat").shader));
MATERIALS.Add("TransparentUnlit", new Material(val.assetBundle.LoadAsset<Material>("unlitTransparentRed").shader));
MATERIALS.Add("SpriteAnimation", val.assetBundle.LoadAsset<Material>("AnimBillboardAtlas"));
}
}
private void Apply()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
CHARACTER.Apply();
GEARS[WorldHandler.instance.currentPlayer.moveStyleEquipped].Apply();
PHONES.Apply();
SPRAYCANS.Apply();
}
private string RandomLine()
{
string[] array = new string[20]
{
"Dig it !", "Yo What's up ?", "OPERATEOPERATEOPERATE", "SHAKE DAT ASS ASS ASS", "You Degenerate", "Better Watch Ya Back !", "Get REP man", "All City King !", "Pretty Boy", "Easy Prey",
"Back to the daily grind !", "How could I looose ?", "The critical error, was you.", "Have a Jawbreaker !", "Feel the Beat !", "Let's Roll !", "YAAAAAHH", "So sorry. It's just... business.", "Shiny Cuff !", "Let's Boogie !"
};
return array[Random.Range(0, array.Length)];
}
}
public class Save
{
public Main main;
public Dictionary<string, SaveLine> SaveLines = new Dictionary<string, SaveLine>();
private string path = Main.FolderModding?.ToString() + "/save";
public void GetSave()
{
SaveLines.Clear();
if (!File.Exists(path))
{
FileStream fileStream = File.Create(path);
fileStream.Dispose();
Main.Log.LogMessage((object)"No save file detected !\nA new save file have been created inside ModdingFolder/Brc-DripRemix.");
ReadSaveFile();
}
else
{
ReadSaveFile();
}
}
private void ReadSaveFile()
{
try
{
FileInfo fileInfo = new FileInfo(path);
string[] array = File.ReadAllLines(fileInfo.FullName);
if (array != null)
{
string[] array2 = array;
foreach (string text in array2)
{
string[] array3 = text.Split(new char[1] { ',' });
SaveLines.Add(array3[0], new SaveLine(int.Parse(array3[1]), int.Parse(array3[2]), int.Parse(array3[3]), int.Parse(array3[4]), int.Parse(array3[5]), int.Parse(array3[6]), int.Parse(array3[7]), int.Parse(array3[8]), int.Parse(array3[9]), int.Parse(array3[10]), int.Parse(array3[11]), int.Parse(array3[12])));
}
}
if (!SaveLines.ContainsKey(Main.CURRENTCHARACTER))
{
SaveLines.Add(Main.CURRENTCHARACTER, new SaveLine(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
main.CHARACTER.INDEX_MESH = 0;
main.CHARACTER.INDEX_TEXTURE = 0;
main.GEARS[(MoveStyle)3].INDEX_MESH = 0;
main.GEARS[(MoveStyle)3].INDEX_TEXTURE = 0;
main.GEARS[(MoveStyle)2].INDEX_MESH = 0;
main.GEARS[(MoveStyle)2].INDEX_TEXTURE = 0;
main.GEARS[(MoveStyle)1].INDEX_MESH = 0;
main.GEARS[(MoveStyle)1].INDEX_TEXTURE = 0;
main.PHONES.INDEX_MESH = 0;
main.PHONES.INDEX_TEXTURE = 0;
main.SPRAYCANS.INDEX_MESH = 0;
main.SPRAYCANS.INDEX_TEXTURE = 0;
SetSave();
}
}
catch
{
Main.Log.LogError((object)"DripRemix can't read the save file.\nPlease fix or remove the save file from ModdingFolder/BRC-DripRemix");
}
}
public void SetSave()
{
SaveLines[Main.CURRENTCHARACTER] = new SaveLine(main.CHARACTER.INDEX_MESH, main.CHARACTER.INDEX_TEXTURE, main.GEARS[(MoveStyle)3].INDEX_MESH, main.GEARS[(MoveStyle)3].INDEX_TEXTURE, main.GEARS[(MoveStyle)2].INDEX_MESH, main.GEARS[(MoveStyle)2].INDEX_TEXTURE, main.GEARS[(MoveStyle)1].INDEX_MESH, main.GEARS[(MoveStyle)1].INDEX_TEXTURE, main.PHONES.INDEX_MESH, main.PHONES.INDEX_TEXTURE, main.SPRAYCANS.INDEX_MESH, main.SPRAYCANS.INDEX_TEXTURE);
string text = "";
foreach (KeyValuePair<string, SaveLine> saveLine in SaveLines)
{
text = text + saveLine.Key + "," + $"{saveLine.Value.charMesh}," + $"{saveLine.Value.charTex}," + $"{saveLine.Value.inlineMesh}," + $"{saveLine.Value.inlineTex}," + $"{saveLine.Value.skateboardMesh}," + $"{saveLine.Value.skateboardTex}," + $"{saveLine.Value.bmxMesh}," + $"{saveLine.Value.bmxTex}," + $"{saveLine.Value.phoneMesh}," + $"{saveLine.Value.phoneTex}," + $"{saveLine.Value.spraycanMesh}," + $"{saveLine.Value.spraycanTex}" + "\n";
}
File.WriteAllText(path, text);
}
}
public class SaveLine
{
public int charMesh = 0;
public int charTex = 0;
public int inlineMesh = 0;
public int inlineTex = 0;
public int skateboardMesh = 0;
public int skateboardTex = 0;
public int bmxMesh = 0;
public int bmxTex = 0;
public int phoneMesh = 0;
public int phoneTex = 0;
public int spraycanMesh = 0;
public int spraycanTex = 0;
public SaveLine(int charMesh, int charTex, int inlineMesh, int inlineTex, int skateboardMesh, int skateboardTex, int bmxMesh, int bmxTex, int phoneMesh, int phoneTex, int spraycanMesh, int spraycanTex)
{
this.charMesh = charMesh;
this.charTex = charTex;
this.inlineMesh = inlineMesh;
this.inlineTex = inlineTex;
this.skateboardMesh = skateboardMesh;
this.skateboardTex = skateboardTex;
this.bmxMesh = bmxMesh;
this.bmxTex = bmxTex;
this.phoneMesh = phoneMesh;
this.phoneTex = phoneTex;
this.spraycanMesh = spraycanMesh;
this.spraycanTex = spraycanTex;
}
}
}
namespace DripRemix.Handlers
{
public class DripHandler
{
public List<AssetFolder> FOLDERS = new List<AssetFolder>();
public List<GameObject> REFERENCES = new List<GameObject>();
public int INDEX_MESH = 0;
public int INDEX_TEXTURE = 0;
public DirectoryInfo AssetFolder { get; protected set; }
public virtual void GetAssets()
{
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Expected O, but got Unknown
FOLDERS.Clear();
DirectoryInfo[] directories = AssetFolder.GetDirectories();
DirectoryInfo[] array = directories;
foreach (DirectoryInfo directoryInfo in array)
{
if (Directory.GetFileSystemEntries(directoryInfo.FullName).Length == 0)
{
continue;
}
FileInfo[] files = directoryInfo.GetFiles("*", SearchOption.TopDirectoryOnly);
Dictionary<string, Mesh> dictionary = new Dictionary<string, Mesh>();
List<Texture> list = new List<Texture>();
List<Texture> list2 = new List<Texture>();
Dictionary<string, string> parameters = new Dictionary<string, string>();
List<Texture> list3 = new List<Texture>();
List<Texture> list4 = new List<Texture>();
FileInfo[] array2 = files;
foreach (FileInfo fileInfo in array2)
{
if (fileInfo.Extension == ".txt")
{
parameters = GetParameters(fileInfo);
}
if (fileInfo.Extension == ".obj")
{
dictionary.Add(fileInfo.Name.Replace(fileInfo.Extension, ""), new OBJLoader().Load(fileInfo.FullName));
}
if (!(fileInfo.Extension == ".png") && !(fileInfo.Extension == ".jpg"))
{
continue;
}
byte[] array3 = File.ReadAllBytes(fileInfo.FullName);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array3);
((Object)val).name = fileInfo.Name;
if (fileInfo.Name.Contains("_emission"))
{
for (int k = 0; k < list.Count; k++)
{
if (((Object)list[k]).name == fileInfo.Name.Replace("_emission", ""))
{
list2[k] = (Texture)(object)val;
}
}
}
else if (fileInfo.Name.Contains("_PhoneOpen"))
{
for (int l = 0; l < list.Count; l++)
{
if (((Object)list[l]).name == fileInfo.Name.Replace("_PhoneOpen", ""))
{
list3[l] = (Texture)(object)val;
}
}
}
else if (fileInfo.Name.Contains("_PhoneClosed"))
{
for (int m = 0; m < list.Count; m++)
{
if (((Object)list[m]).name == fileInfo.Name.Replace("_PhoneClosed", ""))
{
list4[m] = (Texture)(object)val;
}
}
}
else
{
list.Add((Texture)(object)val);
list2.Add((Texture)(object)Texture2D.blackTexture);
list3.Add((Texture)(object)Texture2D.blackTexture);
list4.Add((Texture)(object)Texture2D.blackTexture);
}
}
FOLDERS.Add(new AssetFolder(directoryInfo, dictionary, list, list2, parameters, list3, list4));
}
}
public Dictionary<string, string> GetParameters(FileInfo file)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
string[] array = File.ReadAllLines(file.FullName);
string[] array2 = array;
foreach (string text in array2)
{
if (text.Contains("="))
{
string[] array3 = text.Split(new char[1] { '=' });
dictionary.Add(array3[0], array3[1]);
}
}
return dictionary;
}
public void LoadDetails(string typeName, string characterName)
{
if (typeName == "CHARACTER")
{
if (FOLDERS.Count <= 0 || FOLDERS[0].textures.Count <= 0)
{
return;
}
string text = "";
for (int i = 0; i < FOLDERS[0].textures.Count; i++)
{
try
{
text = text + "\n • " + ((Object)FOLDERS[0].textures[i]).name;
}
catch
{
Main.Log.LogError((object)("Missing/Wrong info.txt : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\info.txt"));
}
}
Main.Log.LogMessage((object)$"{FOLDERS[0].textures.Count} Skin(s) for {characterName} loaded ! {text}\n");
}
else
{
if (FOLDERS.Count <= 0)
{
return;
}
string text2 = "";
for (int j = 0; j < FOLDERS.Count; j++)
{
try
{
text2 += FOLDERS[j].description();
}
catch
{
Main.Log.LogError((object)("Missing/Wrong info.txt : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\info.txt"));
}
}
Main.Log.LogMessage((object)$"{FOLDERS.Count} {typeName}(s) loaded ! {text2}\n");
}
}
public virtual void SetMesh(int indexMod)
{
}
public virtual void SetTexture(int indexMod)
{
}
public virtual void Apply()
{
SetMesh(0);
SetTexture(0);
}
}
public class CharacterHandler : DripHandler
{
public override void GetAssets()
{
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
GetIndex();
FOLDERS.Clear();
base.AssetFolder = Main.FolderCharacter.CreateSubdirectory(Main.CURRENTCHARACTER);
DirectoryInfo[] directories = base.AssetFolder.GetDirectories();
DirectoryInfo[] array = directories;
foreach (DirectoryInfo directoryInfo in array)
{
FileInfo[] files = directoryInfo.GetFiles("*", SearchOption.TopDirectoryOnly);
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, Mesh> meshes = new Dictionary<string, Mesh>();
List<Texture> list = new List<Texture>();
List<Texture> list2 = new List<Texture>();
FileInfo[] array2 = files;
foreach (FileInfo fileInfo in array2)
{
if (fileInfo.Extension == ".txt")
{
parameters = GetParameters(fileInfo);
}
if (!(fileInfo.Extension == ".png") && !(fileInfo.Extension == ".jpg"))
{
continue;
}
byte[] array3 = File.ReadAllBytes(fileInfo.FullName);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array3);
((Object)val).name = fileInfo.Name;
if (fileInfo.Name.Contains("_emission"))
{
for (int k = 0; k < list.Count; k++)
{
if (((Object)list[k]).name == fileInfo.Name.Replace("_emission", ""))
{
list2[k] = (Texture)(object)val;
}
}
}
else
{
list.Add((Texture)(object)val);
list2.Add((Texture)(object)Texture2D.blackTexture);
}
}
FOLDERS.Add(new AssetFolder(directoryInfo, meshes, list, list2, parameters));
}
LoadDetails("CHARACTER", Main.CURRENTCHARACTER);
}
public override void SetTexture(int add)
{
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_TEXTURE = Mathf.Clamp(INDEX_TEXTURE + add, 0, FOLDERS[0].textures.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
SkinnedMeshRenderer component = rEFERENCE.GetComponent<SkinnedMeshRenderer>();
try
{
if (FOLDERS[0].parameters["forceTextureOverride"].ToLower() == "true")
{
((Renderer)component).material.mainTexture = FOLDERS[0].textures[INDEX_TEXTURE];
((Renderer)component).material.SetTexture("_Emission", FOLDERS[0].emissions[INDEX_TEXTURE]);
continue;
}
Main.Log.LogError((object)("Custom Character Model detected by vertex comparison ! Texture have not been changed !\nIgnore this error if it's intended, or you can set [forceTextureOverride] to [True] in " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\info.txt\n"));
}
catch
{
Main.Log.LogError((object)("Missing info or wrong parameters : " + FOLDERS[0].directory.Parent.Name + "\\" + FOLDERS[0].directory.Name + "\\info.txt\n"));
}
}
}
private void GetIndex()
{
INDEX_MESH = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].charMesh;
INDEX_TEXTURE = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].charTex;
}
}
public class GraffitiHandler : DripHandler
{
}
public class PhoneHandler : DripHandler
{
public override void GetAssets()
{
GetIndex();
base.AssetFolder = Main.FolderPhone;
base.GetAssets();
LoadDetails("Phone", null);
if (FOLDERS.Count > 0)
{
SetCameras();
}
}
public override void SetMesh(int indexMod)
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_MESH = Mathf.Clamp(INDEX_MESH + indexMod, 0, FOLDERS.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
try
{
if (Object.op_Implicit((Object)(object)rEFERENCE.GetComponent<MeshFilter>()))
{
Mesh mesh = FOLDERS[INDEX_MESH].meshes[((Object)rEFERENCE).name];
rEFERENCE.GetComponent<MeshFilter>().mesh = mesh;
SetTexture(0);
rEFERENCE.transform.localScale = new Vector3(1f, 1f, -1f);
}
}
catch
{
Main.Log.LogError((object)("Missing mesh : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\" + ((Object)rEFERENCE).name));
}
}
}
public override void SetTexture(int indexMod)
{
//IL_00c3: 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)
//IL_013f: 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)
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_TEXTURE = Mathf.Clamp(INDEX_TEXTURE + indexMod, 0, FOLDERS[INDEX_MESH].textures.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
try
{
if (((Object)rEFERENCE).name == "PhoneOpen")
{
Texture obj = FOLDERS[INDEX_MESH].sprites1[INDEX_TEXTURE];
Texture2D val = (Texture2D)(object)((obj is Texture2D) ? obj : null);
rEFERENCE.GetComponent<Image>().sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
}
else if (((Object)rEFERENCE).name == "PhoneClosed")
{
Texture obj2 = FOLDERS[INDEX_MESH].sprites2[INDEX_TEXTURE];
Texture2D val2 = (Texture2D)(object)((obj2 is Texture2D) ? obj2 : null);
rEFERENCE.GetComponent<Image>().sprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), Vector2.zero);
}
else
{
((Renderer)rEFERENCE.GetComponent<MeshRenderer>()).material.mainTexture = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
((Renderer)rEFERENCE.GetComponent<MeshRenderer>()).material.SetTexture("_Emission", FOLDERS[INDEX_MESH].emissions[INDEX_TEXTURE]);
}
}
catch
{
Main.Log.LogError((object)("Missing texture : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\" + ((Object)rEFERENCE).name));
}
}
}
public void SetCameras()
{
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
CharacterVisual characterVisual = WorldHandler.instance.currentPlayer.characterVisual;
GameObject gameObject = ((Component)characterVisual.handL.Find("propl/phoneInHand(Clone)/Screen")).gameObject;
GameObject gameObject2 = ((Component)characterVisual.handL.Find("propl/phoneInHand(Clone)/phoneCameras/frontCamera")).gameObject;
GameObject gameObject3 = ((Component)characterVisual.handL.Find("propl/phoneInHand(Clone)/phoneCameras/rearCamera")).gameObject;
try
{
gameObject.SetActive(false);
gameObject2.GetComponent<Camera>().fieldOfView = float.Parse(FOLDERS[INDEX_MESH].parameters["cameraFront_fov"]);
string[] array = FOLDERS[INDEX_MESH].parameters["cameraFront_position"].Split(new char[1] { ',' });
gameObject2.transform.localPosition = new Vector3(float.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[2], CultureInfo.InvariantCulture.NumberFormat));
array = FOLDERS[INDEX_MESH].parameters["cameraFront_rotation"].Split(new char[1] { ',' });
gameObject2.transform.localEulerAngles = new Vector3(float.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[2], CultureInfo.InvariantCulture.NumberFormat));
gameObject3.GetComponent<Camera>().fieldOfView = float.Parse(FOLDERS[INDEX_MESH].parameters["cameraRear_fov"]);
array = FOLDERS[INDEX_MESH].parameters["cameraRear_position"].Split(new char[1] { ',' });
gameObject3.transform.localPosition = new Vector3(float.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[2], CultureInfo.InvariantCulture.NumberFormat));
array = FOLDERS[INDEX_MESH].parameters["cameraRear_rotation"].Split(new char[1] { ',' });
gameObject3.transform.localEulerAngles = new Vector3(float.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array[2], CultureInfo.InvariantCulture.NumberFormat));
}
catch
{
Main.Log.LogError((object)("Can't set Phone Cameras. Please, verify the parameters of " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\info.txt"));
}
}
private void GetIndex()
{
INDEX_MESH = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].phoneMesh;
INDEX_TEXTURE = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].phoneTex;
}
}
public class GearHandler : DripHandler
{
public MoveStyle MOVESTYLE;
public string movestyleName => StringExtensions.FirstCharToUpper(((object)(MoveStyle)(ref MOVESTYLE)).ToString().ToLower());
public GearHandler(MoveStyle moveStyle)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
MOVESTYLE = moveStyle;
}
public override void GetAssets()
{
GetIndex();
base.AssetFolder = Main.FolderGears.CreateSubdirectory(movestyleName);
base.GetAssets();
LoadDetails(StringExtensions.FirstCharToUpper(((object)(MoveStyle)(ref MOVESTYLE)).ToString().ToLower()), null);
}
public override void SetMesh(int add)
{
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Invalid comparison between Unknown and I4
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_MESH = Mathf.Clamp(INDEX_MESH + add, 0, FOLDERS.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
Mesh mesh = null;
Mesh mesh2 = null;
try
{
mesh = FOLDERS[INDEX_MESH].meshes[((Object)rEFERENCE).name];
}
catch
{
Main.Log.LogError((object)("Missing mesh : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\" + ((Object)rEFERENCE).name));
}
if ((int)MOVESTYLE == 1)
{
try
{
mesh2 = FOLDERS[INDEX_MESH].meshes["particle"];
}
catch
{
Main.Log.LogError((object)("Missing mesh : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\particle"));
}
}
rEFERENCE.GetComponent<MeshFilter>().mesh = mesh;
SetTexture(0);
if (((Object)rEFERENCE).name == "skateRight(Clone)" || ((Object)rEFERENCE).name == "skateLeft(Clone)" || ((Object)rEFERENCE).name == "skateboard(Clone)")
{
if (rEFERENCE.transform.childCount > 0)
{
((Component)rEFERENCE.transform.GetChild(0)).GetComponent<ParticleSystemRenderer>().mesh = mesh;
((Component)rEFERENCE.transform.GetChild(0)).GetComponent<ParticleSystem>().Play();
}
}
else if (((Object)rEFERENCE).name == "BmxFrame(Clone)" && rEFERENCE.transform.childCount > 0)
{
((Component)rEFERENCE.transform.GetChild(0)).GetComponent<ParticleSystemRenderer>().mesh = mesh2;
((Component)rEFERENCE.transform.GetChild(0)).GetComponent<ParticleSystem>().Play();
}
}
}
public override void SetTexture(int add)
{
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_TEXTURE = Mathf.Clamp(INDEX_TEXTURE + add, 0, FOLDERS[INDEX_MESH].textures.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
try
{
Material[] materials = ((Renderer)rEFERENCE.GetComponent<MeshRenderer>()).materials;
foreach (Material val in materials)
{
val.mainTexture = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
val.SetTexture("_Emission", FOLDERS[INDEX_MESH].emissions[INDEX_TEXTURE]);
}
}
catch
{
Main.Log.LogError((object)("Missing texture : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\" + ((Object)rEFERENCE).name));
}
}
}
private void GetIndex()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Invalid comparison between Unknown and I4
if ((int)MOVESTYLE == 3)
{
INDEX_MESH = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].inlineMesh;
INDEX_TEXTURE = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].inlineTex;
}
if ((int)MOVESTYLE == 2)
{
INDEX_MESH = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].skateboardMesh;
INDEX_TEXTURE = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].skateboardTex;
}
if ((int)MOVESTYLE == 1)
{
INDEX_MESH = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].bmxMesh;
INDEX_TEXTURE = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].bmxTex;
}
}
}
public class SpraycanHandler : DripHandler
{
public override void GetAssets()
{
GetIndex();
base.AssetFolder = Main.FolderSpraycan;
base.GetAssets();
LoadDetails("Spraycan", null);
}
public override void SetMesh(int indexMod)
{
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_MESH = Mathf.Clamp(INDEX_MESH + indexMod, 0, FOLDERS.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
try
{
Mesh mesh = FOLDERS[INDEX_MESH].meshes[((Object)rEFERENCE).name];
rEFERENCE.GetComponent<MeshFilter>().mesh = mesh;
SetTexture(0);
}
catch
{
Main.Log.LogError((object)("Missing mesh : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\" + ((Object)rEFERENCE).name));
}
}
}
public override void SetTexture(int indexMod)
{
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
if (FOLDERS.Count <= 0)
{
return;
}
INDEX_TEXTURE = Mathf.Clamp(INDEX_TEXTURE + indexMod, 0, FOLDERS[INDEX_MESH].textures.Count - 1);
foreach (GameObject rEFERENCE in REFERENCES)
{
try
{
((Renderer)rEFERENCE.GetComponent<MeshRenderer>()).material.mainTexture = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
((Renderer)rEFERENCE.GetComponent<MeshRenderer>()).material.SetTexture("_Emission", FOLDERS[INDEX_MESH].emissions[INDEX_TEXTURE]);
if (((Object)rEFERENCE).name == "spraycan(Clone)")
{
Texture obj = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
Texture2D val = (Texture2D)(object)((obj is Texture2D) ? obj : null);
((Renderer)((Component)rEFERENCE.transform.GetChild(0)).GetComponent<ParticleSystemRenderer>()).material.color = val.GetPixel(0, 0);
}
}
catch
{
Main.Log.LogError((object)("Missing texture : " + FOLDERS[INDEX_MESH].directory.Parent.Name + "\\" + FOLDERS[INDEX_MESH].directory.Name + "\\" + ((Object)rEFERENCE).name));
}
}
}
public void SetGraffitiEffect()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
try
{
GraffitiEffect[] array = Object.FindObjectsOfType<GraffitiEffect>();
GraffitiEffect[] array2 = array;
foreach (GraffitiEffect val in array2)
{
if (((Object)val).name == "grafExplosionEffectBig(Clone)")
{
((Component)val).gameObject.SetActive(false);
}
if (Object.op_Implicit((Object)(object)val.splat))
{
val.splat.startColor = Color.white;
Texture obj = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
Texture2D val2 = (Texture2D)(object)((obj is Texture2D) ? obj : null);
((Renderer)((Component)val.splat).GetComponent<ParticleSystemRenderer>()).material.color = val2.GetPixel(1, 1);
}
if (Object.op_Implicit((Object)(object)val.splashes))
{
val.splashes.startColor = Color.white;
Texture obj2 = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
Texture2D val3 = (Texture2D)(object)((obj2 is Texture2D) ? obj2 : null);
((Renderer)((Component)val.splashes).GetComponent<ParticleSystemRenderer>()).material.color = val3.GetPixel(1, 1);
}
if (Object.op_Implicit((Object)(object)val.strokes))
{
val.strokes.startColor = Color.white;
Texture obj3 = FOLDERS[INDEX_MESH].textures[INDEX_TEXTURE];
Texture2D val4 = (Texture2D)(object)((obj3 is Texture2D) ? obj3 : null);
((Renderer)((Component)val.strokes).GetComponent<ParticleSystemRenderer>()).material.color = val4.GetPixel(1, 1);
}
}
}
catch (Exception arg)
{
Main.Log.LogError((object)$"GraffitiEffect issues !\n\n{arg}");
}
}
private void GetIndex()
{
INDEX_MESH = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].spraycanMesh;
INDEX_TEXTURE = Main.SAVE.SaveLines[Main.CURRENTCHARACTER].spraycanTex;
}
}
}