using System;
using System.Collections.Generic;
using System.Diagnostics;
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 System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MG.GIF;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using NineSolsAPI;
using NineSolsAPI.Utils;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SkinMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Nine Sols Skin Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SkinMod")]
[assembly: AssemblyTitle("SkinMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
internal sealed class ConfigurationManagerAttributes
{
public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);
public bool? ShowRangeAsPercent;
public Action<ConfigEntryBase> CustomDrawer;
public CustomHotkeyDrawerFunc CustomHotkeyDrawer;
public bool? Browsable;
public string Category;
public object DefaultValue;
public bool? HideDefaultButton;
public bool? HideSettingName;
public string Description;
public string DispName;
public int? Order;
public bool? ReadOnly;
public bool? IsAdvanced;
public Func<object, string> ObjToStr;
public Func<string, object> StrToObj;
}
namespace SkinMod
{
[HarmonyPatch]
public class Patches
{
[HarmonyPatch(typeof(PoolManager), "Borrow", new Type[]
{
typeof(PoolObject),
typeof(Vector3),
typeof(Quaternion),
typeof(Transform),
typeof(Action<PoolObject>)
})]
[HarmonyPrefix]
public static bool Prefix(ref PoolObject __result, PoolObject prefab, Vector3 position, Quaternion rotation, Transform parent = null, Action<PoolObject> handler = null)
{
if (((Object)prefab).name == "MultiSpriteEffect_Prefab 燃燒Variant")
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Actor), "PlayAnimation", new Type[]
{
typeof(string),
typeof(bool),
typeof(float)
})]
private static bool PatcUpdate(ref Actor __instance, string stateName)
{
if ((Object)(object)__instance != (Object)(object)Player.i)
{
return true;
}
GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/Attack(Clone)/Animator");
if ((Object)(object)val != (Object)null)
{
Animator component = val.GetComponent<Animator>();
switch (stateName)
{
case "Attack1":
case "AirAttack":
case "WallAttack":
case "RopeAttack":
component.SetInteger("Attack", 100);
break;
default:
if (stateName.Contains("Attack2"))
{
component.SetInteger("Attack", 101);
}
else if (stateName.Contains("Attack3"))
{
component.SetInteger("Attack", 102);
}
else if (stateName.Contains("Fall") || stateName.Contains("Jump") || stateName.Contains("ParryAirSpinNormalHit"))
{
component.SetInteger("Attack", 201);
}
else if (stateName.Contains("Foo"))
{
component.SetInteger("Attack", 2);
}
else if (stateName.Contains("Attack") && stateName.Contains("Charge"))
{
component.SetInteger("Attack", 3);
}
else if (stateName.Contains("ParryCounterDeflectAttack"))
{
component.SetInteger("Attack", 4);
}
else if (stateName.Contains("Parry"))
{
component.SetInteger("Attack", 5);
}
else if (stateName.Contains("Run") || stateName.Contains("Jump") || stateName.Contains("DashRoll"))
{
component.SetInteger("Attack", 6);
}
else
{
component.SetInteger("Attack", 0);
}
break;
}
}
GameObject val2 = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/" + SkinMod.Instance.objectName + "(Clone)/Animator");
if ((Object)(object)val2 == (Object)null)
{
return true;
}
Animator component2 = val2.GetComponent<Animator>();
if (stateName == "Idle")
{
component2.SetInteger("Status", 0);
}
else if (stateName.Contains("Run"))
{
component2.SetInteger("Status", 1);
}
else if (stateName.Contains("Parry"))
{
component2.SetInteger("Status", 2);
}
else if (stateName.Contains("DashRoll"))
{
component2.SetInteger("Status", 3);
}
else if (stateName.Contains("Heal"))
{
component2.SetInteger("Status", 4);
}
else if (stateName.Contains("AirAttack"))
{
component2.SetInteger("Status", 5);
}
else if (stateName.Contains("Shoot") && (stateName.Contains("Prepare") || stateName.Contains("In Air")))
{
component2.SetInteger("Status", 6);
}
else if (stateName.Contains("Hurt"))
{
if (stateName.Contains("HurtHitToGround"))
{
component2.SetInteger("Status", 8);
}
else
{
component2.SetInteger("Status", 7);
}
}
else if (stateName.Contains("Rope"))
{
ToastManager.Toast((object)"Rope");
if (stateName.Contains("Idle"))
{
component2.SetInteger("Status", 100);
}
else if (stateName.Contains("Up") || stateName.Contains("Down"))
{
component2.SetInteger("Status", 101);
}
}
else
{
component2.SetInteger("Status", 0);
}
return true;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("SkinMod", "SkinMod", "1.0.0")]
public class SkinMod : BaseUnityPlugin
{
public delegate void HandlerNoParam();
private ConfigEntry<KeyboardShortcut> enableSkinKeyboardShortcut;
private ConfigEntry<KeyboardShortcut> customObjectShortcut;
public ConfigEntry<string> curSkin;
private ConfigEntry<bool> danceYi;
private ConfigEntry<bool> jieChuan;
private ConfigEntry<bool> usagi;
private ConfigEntry<bool> jee;
private ConfigEntry<bool> heng;
private ConfigEntry<bool> goblin;
private ConfigEntry<bool> niko;
private ConfigEntry<bool> attackEffect;
private ConfigEntry<string> path;
private ConfigEntry<Vector3> pos;
private ConfigEntry<Vector3> scale;
private ConfigEntry<Vector3> rotate;
private ConfigEntry<int> orderLayer;
private ConfigEntry<float> gifSpeed;
private ConfigEntry<bool> disableYi;
private ConfigEntry<bool> hideCustomObject;
private ConfigEntry<Vector3> cc;
private Harmony harmony;
public string objectName;
private GameObject curSkinObject;
public bool isEnableSkin;
private AssetBundle tree;
private GameObject danceYiObject;
private GameObject jieChuanObject;
private GameObject usagiObject;
private GameObject jeeObject;
private GameObject hengObject;
private GameObject goblinObject;
private GameObject nikoObject;
private GameObject customObject;
private testGif testgif;
public HandlerNoParam onUpdate;
private const string SkinHolderPath = "GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder";
public static SkinMod Instance { get; private set; }
private void Awake()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Expected O, but got Unknown
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Expected O, but got Unknown
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Expected O, but got Unknown
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Expected O, but got Unknown
//IL_02e8: 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_0318: Expected O, but got Unknown
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Expected O, but got Unknown
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Expected O, but got Unknown
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Expected O, but got Unknown
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Expected O, but got Unknown
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_046b: Expected O, but got Unknown
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
//IL_04c0: Expected O, but got Unknown
//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_0515: Expected O, but got Unknown
//IL_0550: Unknown result type (might be due to invalid IL or missing references)
//IL_055a: Expected O, but got Unknown
RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
Instance = this;
harmony = Harmony.CreateAndPatchAll(typeof(Patches).Assembly, (string)null);
danceYi = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "DanceYi", true, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 24
}
}));
niko = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Niko", true, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 23
}
}));
jieChuan = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "JieChuan", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 22
}
}));
usagi = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Usagi", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 21
}
}));
jee = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Jee", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 20
}
}));
heng = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Heng", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 19
}
}));
goblin = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Goblin", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 18
}
}));
attackEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "AttackEffect", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 17
}
}));
path = ((BaseUnityPlugin)this).Config.Bind<string>("Custom Pic Gif", "path", "", new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 16
}
}));
pos = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Custom Pic Gif", "Position", Vector3.zero, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 15
}
}));
scale = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Custom Pic Gif", "Scale", new Vector3(10f, 10f, 10f), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 14
}
}));
rotate = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Custom Pic Gif", "Rotate", Vector3.zero, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 13
}
}));
orderLayer = ((BaseUnityPlugin)this).Config.Bind<int>("Custom Pic Gif", "orderLayer", 101, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 12
}
}));
gifSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Custom Pic Gif", "GifSpeed", 1f, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 11
}
}));
disableYi = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Pic Gif", "DisableYi", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 10
}
}));
hideCustomObject = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Pic Gif", "HideCustomPic", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 9
}
}));
enableSkinKeyboardShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("", "Enable Skin Shortcut", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 8
}
}));
customObjectShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("", "Create Custom Picture Gif Shortcut", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 7
}
}));
curSkin = ((BaseUnityPlugin)this).Config.Bind<string>("", "currSkin", "", new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 6
}
}));
KeybindManager.Add((MonoBehaviour)(object)this, (Action)ToggleSkin, (Func<KeyboardShortcut>)(() => enableSkinKeyboardShortcut.Value));
KeybindManager.Add((MonoBehaviour)(object)this, (Action)CustomObject, (Func<KeyboardShortcut>)(() => customObjectShortcut.Value));
disableYi.Value = false;
danceYi.SettingChanged += delegate
{
OnSkinChanged("DanceYi", danceYiObject, "danceRemoveObject");
};
jieChuan.SettingChanged += delegate
{
OnSkinChanged("JieChuan", jieChuanObject, "JieChuan");
};
usagi.SettingChanged += delegate
{
OnSkinChanged("Usagi", usagiObject, "Usagi");
};
jee.SettingChanged += delegate
{
OnSkinChanged("Jee", jeeObject, "Jee");
};
heng.SettingChanged += delegate
{
OnSkinChanged("Heng", hengObject, "Heng");
};
goblin.SettingChanged += delegate
{
OnSkinChanged("Goblin", goblinObject, "Goblin");
};
niko.SettingChanged += delegate
{
OnSkinChanged("Niko", nikoObject, "Niko");
};
attackEffect.SettingChanged += delegate
{
AttackEffect(attackEffect.Value);
};
pos.SettingChanged += delegate
{
UpdateCustom();
};
scale.SettingChanged += delegate
{
UpdateCustom();
};
rotate.SettingChanged += delegate
{
UpdateCustom();
};
orderLayer.SettingChanged += delegate
{
UpdateCustom();
};
gifSpeed.SettingChanged += delegate
{
testgif.setSpeed(gifSpeed.Value);
};
disableYi.SettingChanged += delegate
{
ActiveYi(!disableYi.Value);
};
hideCustomObject.SettingChanged += delegate
{
hideCustomObjcet(hideCustomObject.Value);
};
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SkinMod is loaded!");
tree = AssemblyUtils.GetEmbeddedAssetBundle("SkinMod.Resources.tree");
danceYiObject = tree.LoadAsset<GameObject>("danceRemoveObject");
jieChuanObject = tree.LoadAsset<GameObject>("JieChuan");
usagiObject = tree.LoadAsset<GameObject>("Usagi");
jeeObject = tree.LoadAsset<GameObject>("Jee");
hengObject = tree.LoadAsset<GameObject>("Heng");
goblinObject = tree.LoadAsset<GameObject>("Goblin");
nikoObject = tree.LoadAsset<GameObject>("Niko");
testgif = new testGif();
testgif.testHook();
}
private void hideCustomObjcet(bool enable)
{
if (Object.op_Implicit((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/customObject")))
{
customObject = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/customObject");
customObject.SetActive(!enable);
}
}
private void ActiveYi(bool enable)
{
SetPlayerSpriteLayer(enable ? "Player" : "UI");
EnableShadow(enable);
}
private string GetGameObjectPath(GameObject obj)
{
string text = ((Object)obj).name;
Transform val = obj.transform;
while ((Object)(object)val.parent != (Object)null)
{
val = val.parent;
text = ((Object)val).name + "/" + text;
}
return text;
}
private void Update()
{
onUpdate?.Invoke();
}
private void UpdateCustom()
{
//IL_0011: 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_0047: Unknown result type (might be due to invalid IL or missing references)
customObject.transform.localPosition = pos.Value;
customObject.transform.localScale = scale.Value;
customObject.transform.eulerAngles = rotate.Value;
((Renderer)customObject.GetComponent<SpriteRenderer>()).sortingOrder = orderLayer.Value;
}
private void CustomObject()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
testgif.clear();
hideCustomObject.Value = false;
if (path.Value == "")
{
return;
}
try
{
if (!Object.op_Implicit((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/customObject")))
{
customObject = new GameObject("customObject");
customObject.transform.position = ((Component)Player.i).transform.position;
customObject.transform.localScale = new Vector3(10f, 10f, 10f);
customObject.transform.localPosition = new Vector3(((Component)Player.i).transform.position.x, ((Component)Player.i).transform.position.y, ((Component)Player.i).transform.position.z);
customObject.transform.SetParent(GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder").transform);
customObject.AddComponent<SpriteRenderer>();
customObject.GetComponent<SpriteRenderer>().sprite = testGif.LoadSprite(path.Value);
testgif.setSpeed(gifSpeed.Value);
}
else
{
customObject = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/customObject");
GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/customObject").GetComponent<SpriteRenderer>().sprite = testGif.LoadSprite(path.Value);
}
pos.Value = customObject.transform.localPosition;
scale.Value = customObject.transform.localScale;
rotate.Value = customObject.transform.localEulerAngles;
}
catch (Exception)
{
}
}
private void Start()
{
curSkin.Value = "";
danceYi.Value = false;
jieChuan.Value = false;
usagi.Value = false;
jee.Value = false;
heng.Value = false;
goblin.Value = false;
niko.Value = false;
attackEffect.Value = false;
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void AttackEffect(bool isEnable)
{
//IL_0081: 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_00ab: 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_00c4: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Player.i == (Object)null))
{
GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/Attack(Clone)");
GameObject obj = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/Effect_Attack");
GameObject val2 = ((obj != null) ? obj.gameObject : null);
GameObject val3 = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/Effect_TAICHIParry/Effect_ParryCounterAttack0");
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)val);
}
if ((Object)(object)val2 != (Object)null)
{
val2.transform.localPosition = (isEnable ? new Vector3(0f, -8f, 8000f) : new Vector3(0f, -8f, 0f));
}
if ((Object)(object)val3 != (Object)null)
{
val3.SetActive(!isEnable);
}
if (isEnable)
{
Vector3 val4 = ((Component)Player.i).transform.position + new Vector3(0f, 25f, 0f);
GameObject obj2 = tree.LoadAsset<GameObject>("Attack");
Quaternion identity = Quaternion.identity;
GameObject obj3 = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder");
Object.Instantiate<GameObject>(obj2, val4, identity, (obj3 != null) ? obj3.transform : null);
}
}
}
private void OnSkinChanged(string skinName, GameObject skinObject, string objName)
{
ProcessVisible(enable: true);
isEnableSkin = false;
curSkin.Value = skinName;
curSkinObject = skinObject;
objectName = objName;
ResetSkins();
ToggleSkin();
}
private void ToggleSkin()
{
if (!((Object)(object)Player.i == (Object)null))
{
if (Object.op_Implicit((Object)(object)GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/" + objectName + "(Clone)")))
{
ProcessVisible(isEnableSkin);
isEnableSkin = !isEnableSkin;
}
else
{
CreateSkin();
ProcessVisible(enable: false);
isEnableSkin = true;
}
}
}
private void ProcessVisible(bool enable)
{
SetSkinActive(!enable);
SetPlayerSpriteLayer(enable ? "Player" : "UI");
activeHeal(enable);
EnableShadow(enable);
}
private void SetSkinActive(bool isActive)
{
GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/" + objectName + "(Clone)");
if ((Object)(object)val != (Object)null)
{
val.SetActive(isActive);
}
}
private void SetPlayerSpriteLayer(string layerName)
{
GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite");
if ((Object)(object)val != (Object)null)
{
val.layer = LayerMask.NameToLayer(layerName);
}
}
private void EnableShadow(bool enable)
{
GameObject val = GameObject.Find("CameraCore/DummyPlayer/ShadowRoot");
if ((Object)(object)val != (Object)null)
{
val.SetActive(enable);
}
}
private void CreateSkin()
{
//IL_000c: 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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(((Component)Player.i).transform.position.x, ((Component)Player.i).transform.position.y + 35f, ((Component)Player.i).transform.position.z);
GameObject val2 = Object.Instantiate<GameObject>(curSkinObject, val, Quaternion.identity, GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder").transform);
if (curSkin.Value == "DanceYi")
{
val2.transform.localPosition = new Vector3(0f, 11.2001f, 0f);
val2.transform.localScale = new Vector3(0.55f, 0.55f, 0.55f);
}
else if (curSkin.Value == "JieChuan")
{
val2.transform.localPosition = new Vector3(-0.399f, 28.3011f, 0f);
val2.transform.localScale = new Vector3(5f, 5f, 5f);
}
else if (curSkin.Value == "Usagi")
{
val2.transform.localPosition = new Vector3(2.601f, 14.7012f, 0f);
val2.transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
}
else if (curSkin.Value == "Jee")
{
val2.transform.localPosition = new Vector3(-0.699f, 17.7012f, 0f);
val2.transform.localScale = new Vector3(-13f, -13f, 13f);
((Component)val2.transform.Find("Animator/Hand Right")).gameObject.transform.localScale = new Vector3(0.26f, -0.26f, 0.26f);
((Component)val2.transform.Find("Animator/Hand Left")).gameObject.transform.localScale = new Vector3(0.26f, -0.26f, 0.26f);
((Component)val2.transform.Find("Animator/Hand Right")).gameObject.transform.eulerAngles = new Vector3(0f, 0f, 350f);
}
else if (curSkin.Value == "Heng")
{
val2.transform.localPosition = new Vector3(-3.499f, 17.7012f, 0f);
val2.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
}
else if (curSkin.Value == "Goblin")
{
val2.transform.localPosition = new Vector3(-1.499f, 12.7012f, 0f);
val2.transform.localScale = new Vector3(7f, 7f, 7f);
}
else if (curSkin.Value == "Niko")
{
val2.transform.localPosition = new Vector3(-1.499f, 15.7012f, 0f);
val2.transform.localScale = new Vector3(6f, 6f, 6f);
}
SetPlayerSpriteLayer("UI");
isEnableSkin = true;
EnableShadow(enable: false);
}
private void activeHeal(bool active)
{
GameObject val = GameObject.Find("GameCore(Clone)/RCG LifeCycle/PPlayer/RotateProxy/SpriteHolder/PlayerSprite/HealSmoke/GameObject3");
if ((Object)(object)val != (Object)null)
{
val.SetActive(active);
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (attackEffect.Value)
{
AttackEffect(isEnable: true);
}
}
private void ResetSkins()
{
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
if ((Object)(object)tree != (Object)null)
{
tree.Unload(false);
}
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
}
public class testGif
{
public class Gif
{
public List<Sprite> frames = new List<Sprite>();
public List<float> delay = new List<float>();
private float time;
private int frame;
public Sprite Current => frames[frame];
public void Reset()
{
time = 0f;
frame = 0;
}
public void Update(Traverse t)
{
time += Time.deltaTime;
if (time >= delay[frame])
{
frame = (frame + 1) % frames.Count;
time = 0f;
t.SetValue((object)Current);
}
}
}
public class SpriteDesc
{
public Vector2 pivot = new Vector2(0f, 0f);
public float pixelsPerUnit = 100f;
public uint extrude;
public SpriteMeshType spriteType = (SpriteMeshType)1;
public static SpriteDesc _default = new SpriteDesc();
}
private float timeSinceLastUpdate;
private float baseInterval = 0.1f;
private float updateInterval = 0.1f;
private static readonly Dictionary<string, Sprite> cacheSprite = new Dictionary<string, Sprite>();
private static readonly Dictionary<string, Gif> mapGif = new Dictionary<string, Gif>();
public static Sprite LoadSprite(string filePath, string specificName = null)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00ec: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
if (cacheSprite.ContainsKey(filePath))
{
return cacheSprite[filePath];
}
if (!File.Exists(filePath))
{
return null;
}
string text = (string.IsNullOrEmpty(specificName) ? Path.GetFileNameWithoutExtension(filePath) : specificName);
if (mapGif.TryGetValue(text, out Gif value))
{
value.Reset();
return value.Current;
}
string text2 = Path.GetExtension(filePath).ToLower();
switch (text2)
{
case ".png":
case ".jpg":
case ".jpeg":
{
byte[] array = File.ReadAllBytes(filePath);
Texture2D val3 = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val3, array))
{
string path = filePath.Replace(text2, ".json");
SpriteDesc spriteDesc = SpriteDesc._default;
if (File.Exists(path))
{
spriteDesc = JsonConvert.DeserializeObject<SpriteDesc>(File.ReadAllText(path));
}
Sprite val4 = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), spriteDesc.pixelsPerUnit, spriteDesc.extrude, spriteDesc.spriteType);
((Object)val4).name = text;
cacheSprite.Add(filePath, val4);
return val4;
}
break;
}
case ".gif":
{
using MG.GIF.Decoder decoder = new MG.GIF.Decoder(File.ReadAllBytes(filePath));
Image image = decoder.NextImage();
if (image == null)
{
return null;
}
Gif gif = new Gif();
Debug.Log((object)("Add gif " + text));
mapGif.Add(text, gif);
while (image != null)
{
Texture2D val = image.CreateTexture();
((Object)val).name = text;
SpriteDesc @default = SpriteDesc._default;
Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), @default.pixelsPerUnit, @default.extrude, @default.spriteType);
((Object)val2).name = ((Object)val).name;
gif.frames.Add(val2);
gif.delay.Add((float)image.Delay * 0.001f);
image = decoder.NextImage();
}
cacheSprite.Add(filePath, gif.frames[0]);
return gif.frames[0];
}
}
return null;
}
private static void GifUpdate(Type t)
{
Object[] array = Object.FindObjectsOfType(t);
for (int i = 0; i < array.Length; i++)
{
Traverse val = Traverse.Create((object)array[i]).Property("sprite", (object[])null);
if (val != null)
{
Sprite value = val.GetValue<Sprite>();
if (!((Object)(object)value == (Object)null) && !string.IsNullOrEmpty(((Object)value).name) && mapGif.TryGetValue(((Object)value).name, out Gif value2))
{
value2.Update(val);
}
}
}
}
public void testHook()
{
SkinMod instance = SkinMod.Instance;
instance.onUpdate = (SkinMod.HandlerNoParam)Delegate.Combine(instance.onUpdate, new SkinMod.HandlerNoParam(OnUpdate));
}
public void OnUpdate()
{
if (mapGif.Count > 0)
{
timeSinceLastUpdate += Time.deltaTime;
if (timeSinceLastUpdate >= updateInterval)
{
GifUpdate(typeof(SpriteRenderer));
timeSinceLastUpdate = 0f;
}
}
}
public void clear()
{
cacheSprite.Clear();
mapGif.Clear();
}
public void setSpeed(float speedMultiplier)
{
updateInterval = baseInterval / Mathf.Abs(speedMultiplier);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SkinMod";
public const string PLUGIN_NAME = "SkinMod";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace MG.GIF
{
public class Image : ICloneable
{
public int Width;
public int Height;
public int Delay;
public Color32[] RawImage;
public Image()
{
}
public Image(Image img)
{
Width = img.Width;
Height = img.Height;
Delay = img.Delay;
RawImage = ((img.RawImage != null) ? ((Color32[])img.RawImage.Clone()) : null);
}
public object Clone()
{
return new Image(this);
}
public Texture2D CreateTexture()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_0034: Expected O, but got Unknown
Texture2D val = new Texture2D(Width, Height, (TextureFormat)5, false)
{
filterMode = (FilterMode)1,
wrapMode = (TextureWrapMode)1
};
val.SetPixels32(RawImage);
val.Apply();
return val;
}
}
public class Decoder : IDisposable
{
[Flags]
private enum ImageFlag
{
Interlaced = 0x40,
ColourTable = 0x80,
TableSizeMask = 7,
BitDepthMask = 0x70
}
private enum Block
{
Image = 44,
Extension = 33,
End = 59
}
private enum Extension
{
GraphicControl = 249,
Comments = 254,
PlainText = 1,
ApplicationData = 255
}
private enum Disposal
{
None = 0,
DoNotDispose = 4,
RestoreBackground = 8,
ReturnToPrevious = 12
}
[Flags]
private enum ControlFlags
{
HasTransparency = 1,
DisposalMask = 0xC
}
public string Version;
public ushort Width;
public ushort Height;
public Color32 BackgroundColour;
private const uint NoCode = 65535u;
private const ushort NoTransparency = ushort.MaxValue;
private byte[] Input;
private int D;
private Color32[] GlobalColourTable;
private Color32[] LocalColourTable;
private Color32[] ActiveColourTable;
private ushort TransparentIndex;
private Image Image = new Image();
private ushort ImageLeft;
private ushort ImageTop;
private ushort ImageWidth;
private ushort ImageHeight;
private Color32[] Output;
private Color32[] PreviousImage;
private readonly int[] Pow2 = new int[13]
{
1, 2, 4, 8, 16, 32, 64, 128, 256, 512,
1024, 2048, 4096
};
private bool Disposed;
private int CodesLength;
private IntPtr CodesHandle;
private unsafe ushort* pCodes;
private IntPtr CurBlock;
private unsafe uint* pCurBlock;
private const int MaxCodes = 4096;
private IntPtr Indices;
private unsafe ushort** pIndicies;
public Decoder(byte[] data)
: this()
{
Load(data);
}
public Decoder Load(byte[] data)
{
Input = data;
D = 0;
GlobalColourTable = (Color32[])(object)new Color32[256];
LocalColourTable = (Color32[])(object)new Color32[256];
TransparentIndex = ushort.MaxValue;
Output = null;
PreviousImage = null;
Image.Delay = 0;
return this;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private byte ReadByte()
{
return Input[D++];
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private ushort ReadUInt16()
{
return (ushort)(Input[D++] | (Input[D++] << 8));
}
private void ReadHeader()
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
if (Input == null || Input.Length <= 12)
{
throw new Exception("Invalid data");
}
Version = Encoding.ASCII.GetString(Input, 0, 6);
D = 6;
if (Version != "GIF87a" && Version != "GIF89a")
{
throw new Exception("Unsupported GIF version");
}
Width = ReadUInt16();
Height = ReadUInt16();
Image.Width = Width;
Image.Height = Height;
ImageFlag imageFlag = (ImageFlag)ReadByte();
byte b = ReadByte();
ReadByte();
if (imageFlag.HasFlag(ImageFlag.ColourTable))
{
ReadColourTable(GlobalColourTable, imageFlag);
}
BackgroundColour = GlobalColourTable[b];
}
public Image NextImage()
{
if (D == 0)
{
ReadHeader();
}
while (true)
{
switch ((Block)ReadByte())
{
case Block.Image:
{
Image image = ReadImageBlock();
if (image != null)
{
return image;
}
break;
}
case Block.Extension:
if (ReadByte() == 249)
{
ReadControlBlock();
}
else
{
SkipBlocks();
}
break;
case Block.End:
return null;
default:
throw new Exception("Unexpected block type");
}
}
}
private Color32[] ReadColourTable(Color32[] colourTable, ImageFlag flags)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
int num = Pow2[(int)((flags & ImageFlag.TableSizeMask) + 1)];
for (int i = 0; i < num; i++)
{
colourTable[i] = new Color32(Input[D++], Input[D++], Input[D++], byte.MaxValue);
}
return colourTable;
}
private void SkipBlocks()
{
for (byte b = Input[D++]; b != 0; b = Input[D++])
{
D += b;
}
}
private void ReadControlBlock()
{
ReadByte();
ControlFlags controlFlags = (ControlFlags)ReadByte();
Image.Delay = ReadUInt16() * 10;
byte transparentIndex = ReadByte();
ReadByte();
if (controlFlags.HasFlag(ControlFlags.HasTransparency))
{
TransparentIndex = transparentIndex;
}
else
{
TransparentIndex = ushort.MaxValue;
}
switch ((Disposal)(controlFlags & ControlFlags.DisposalMask))
{
default:
PreviousImage = Output;
break;
case Disposal.RestoreBackground:
Output = (Color32[])(object)new Color32[Width * Height];
break;
case Disposal.ReturnToPrevious:
Output = (Color32[])(object)new Color32[Width * Height];
if (PreviousImage != null)
{
Array.Copy(PreviousImage, Output, Output.Length);
}
break;
}
}
private Image ReadImageBlock()
{
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: 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_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
ImageLeft = ReadUInt16();
ImageTop = ReadUInt16();
ImageWidth = ReadUInt16();
ImageHeight = ReadUInt16();
ImageFlag imageFlag = (ImageFlag)ReadByte();
if (ImageWidth == 0 || ImageHeight == 0)
{
return null;
}
if (imageFlag.HasFlag(ImageFlag.ColourTable))
{
ActiveColourTable = ReadColourTable(LocalColourTable, imageFlag);
}
else
{
ActiveColourTable = GlobalColourTable;
}
if (Output == null)
{
Output = (Color32[])(object)new Color32[Width * Height];
PreviousImage = Output;
}
DecompressLZW();
if (imageFlag.HasFlag(ImageFlag.Interlaced))
{
Deinterlace();
}
if (TransparentIndex != ushort.MaxValue)
{
Color32 val = default(Color32);
((Color32)(ref val))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
Color32 val2 = ActiveColourTable[TransparentIndex];
for (int i = 0; i < Output.Length; i++)
{
if (Output[i].r == val2.r && Output[i].g == val2.b && Output[i].b == val2.b)
{
Output[i] = val;
}
}
}
Image.RawImage = Output;
return Image;
}
private void Deinterlace()
{
int num = Output.Length / Width;
int num2 = Output.Length - Width;
Color32[] output = Output;
Output = (Color32[])(object)new Color32[Output.Length];
for (int i = 0; i < num; i++)
{
int num3 = ((i % 8 != 0) ? (((i + 4) % 8 != 0) ? (((i + 2) % 4 != 0) ? (num / 2 + (i - 1) / 2) : (num / 4 + (i - 2) / 4)) : (num / 8 + (i - 4) / 8)) : (i / 8));
Array.Copy(output, (num - num3 - 1) * Width, Output, num2, Width);
num2 -= Width;
}
}
public unsafe Decoder()
{
CodesLength = 131072;
CodesHandle = Marshal.AllocHGlobal(CodesLength * 2);
pCodes = (ushort*)CodesHandle.ToPointer();
CurBlock = Marshal.AllocHGlobal(256);
pCurBlock = (uint*)CurBlock.ToPointer();
Indices = Marshal.AllocHGlobal(4096 * sizeof(ushort*));
pIndicies = (ushort**)Indices.ToPointer();
}
protected virtual void Dispose(bool disposing)
{
if (!Disposed)
{
Marshal.FreeHGlobal(CodesHandle);
Marshal.FreeHGlobal(CurBlock);
Marshal.FreeHGlobal(Indices);
Disposed = true;
}
}
~Decoder()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
private unsafe void DecompressLZW()
{
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
ushort* ptr = pCodes + CodesLength;
fixed (byte* ptr9 = Input)
{
fixed (Color32* ptr2 = Output)
{
fixed (Color32* ptr12 = ActiveColourTable)
{
int num = (Height - ImageTop - 1) * Width;
int num2 = ((ImageLeft + ImageWidth > Width) ? (Width - ImageLeft) : ImageWidth);
Color32* ptr3 = (Color32*)((byte*)ptr2 + (nint)(num + ImageLeft) * (nint)Unsafe.SizeOf<Color32>());
Color32* ptr4 = ptr3;
Color32* ptr5 = (Color32*)((byte*)ptr3 + (nint)(int)ImageWidth * (nint)Unsafe.SizeOf<Color32>());
Color32* ptr6 = (Color32*)((byte*)ptr3 + (nint)num2 * (nint)Unsafe.SizeOf<Color32>());
int num3 = Input[D++];
if (num3 > 11)
{
num3 = 11;
}
int num4 = num3 + 1;
int num5 = Pow2[num4];
int num6 = Pow2[num3];
int num7 = num6;
int num8 = num6 + 1;
int num9 = num6 + 2;
ushort* ptr7 = pCodes;
for (ushort num10 = 0; num10 < num9; num10++)
{
pIndicies[(int)num10] = ptr7;
*(ptr7++) = 1;
*(ptr7++) = num10;
}
uint num11 = 65535u;
uint num12 = (uint)(num5 - 1);
uint num13 = 0u;
int num14 = 0;
int num15 = 0;
uint* ptr8 = pCurBlock;
while (true)
{
uint num16 = num13 & num12;
if (num14 >= num4)
{
num14 -= num4;
num13 >>= num4;
}
else
{
if (num15 <= 0)
{
byte* source = ptr9 + D++;
num15 = *(source++);
D += num15;
if (num15 == 0)
{
return;
}
pCurBlock[(num15 - 1) / 4] = 0u;
Buffer.MemoryCopy(source, pCurBlock, 256L, num15);
ptr8 = pCurBlock;
}
num13 = *(ptr8++);
int num17 = ((num15 >= 4) ? 32 : (num15 * 8));
num15 -= 4;
if (num14 > 0)
{
int num18 = num4 - num14;
num16 |= (num13 << num14) & num12;
num13 >>= num18;
num14 = num17 - num18;
}
else
{
num16 = num13 & num12;
num13 >>= num4;
num14 = num17 - num4;
}
}
if (num16 == num7)
{
num4 = num3 + 1;
num5 = Pow2[num4];
num9 = num6 + 2;
ptr7 = pCodes + num9 * 2;
num11 = 65535u;
num12 = (uint)(num5 - 1);
continue;
}
if (num16 == num8)
{
break;
}
bool flag = false;
ushort* ptr10 = null;
if (num16 < num9)
{
ptr10 = pIndicies[num16];
}
else
{
if (num11 == 65535)
{
continue;
}
ptr10 = pIndicies[num11];
flag = true;
}
ushort num19 = *(ptr10++);
ushort num20 = *ptr10;
ushort* ptr11 = ptr10 + (int)num19;
do
{
ushort num21 = *(ptr10++);
if (num21 != TransparentIndex && ptr3 < ptr6)
{
Unsafe.Write(ptr3, ((byte*)ptr12)[(nint)(int)num21 * (nint)Unsafe.SizeOf<Color32>()]);
}
if ((ptr3 = (Color32*)((byte*)ptr3 + Unsafe.SizeOf<Color32>())) == ptr5)
{
ptr4 = (Color32*)((byte*)ptr4 - (nint)(int)Width * (nint)Unsafe.SizeOf<Color32>());
ptr3 = ptr4;
ptr5 = (Color32*)((byte*)ptr4 + (nint)(int)ImageWidth * (nint)Unsafe.SizeOf<Color32>());
ptr6 = (Color32*)((byte*)ptr4 + (nint)num2 * (nint)Unsafe.SizeOf<Color32>());
if (ptr3 < ptr2)
{
SkipBlocks();
return;
}
}
}
while (ptr10 < ptr11);
if (flag)
{
if (num20 != TransparentIndex && ptr3 < ptr6)
{
Unsafe.Write(ptr3, ((byte*)ptr12)[(nint)(int)num20 * (nint)Unsafe.SizeOf<Color32>()]);
}
if ((ptr3 = (Color32*)((byte*)ptr3 + Unsafe.SizeOf<Color32>())) == ptr5)
{
ptr4 = (Color32*)((byte*)ptr4 - (nint)(int)Width * (nint)Unsafe.SizeOf<Color32>());
ptr3 = ptr4;
ptr5 = (Color32*)((byte*)ptr4 + (nint)(int)ImageWidth * (nint)Unsafe.SizeOf<Color32>());
ptr6 = (Color32*)((byte*)ptr4 + (nint)num2 * (nint)Unsafe.SizeOf<Color32>());
if (ptr3 < ptr2)
{
break;
}
}
}
if (num11 != 65535 && num9 != 4096)
{
ptr10 = pIndicies[num11];
num19 = *(ptr10++);
if (ptr7 + (int)num19 + 1 >= ptr)
{
ushort* ptr13 = pCodes;
CodesLength *= 2;
CodesHandle = Marshal.ReAllocHGlobal(CodesHandle, (IntPtr)(CodesLength * 2));
pCodes = (ushort*)CodesHandle.ToPointer();
ptr = pCodes + CodesLength;
ptr7 = pCodes + (ptr7 - ptr13);
for (int i = 0; i < num9; i++)
{
pIndicies[i] = pCodes + (pIndicies[i] - ptr13);
}
ptr10 = pIndicies[num11];
ptr10++;
}
pIndicies[num9++] = ptr7;
*(ptr7++) = (ushort)(num19 + 1);
Buffer.MemoryCopy(ptr10, ptr7, num19 * 2, num19 * 2);
ptr7 += (int)num19;
*(ptr7++) = num20;
}
if (num9 >= num5 && num4 < 12)
{
num5 = Pow2[++num4];
num12 = (uint)(num5 - 1);
}
num11 = num16;
}
SkipBlocks();
}
}
}
}
public static string Ident()
{
string text = "1.1";
string text2 = (BitConverter.IsLittleEndian ? "L" : "B");
string text3 = "M";
string text4 = "U";
string text5 = "2.0";
return text + " " + text2 + text4 + text3 + " " + text5;
}
}
}
namespace ExampleMod
{
internal static class Log
{
private static ManualLogSource? logSource;
internal static void Init(ManualLogSource logSource)
{
Log.logSource = logSource;
}
internal static void Debug(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogDebug(data);
}
}
internal static void Error(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogError(data);
}
}
internal static void Fatal(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogFatal(data);
}
}
internal static void Info(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogInfo(data);
}
}
internal static void Message(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogMessage(data);
}
}
internal static void Warning(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogWarning(data);
}
}
}
}