using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG;
using HG.GeneralSerializer;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.RoR2;
using On.RoR2.Projectile;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AssetExtractor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7f4a57c454985f734acb1c02ab551d3c4aae4595")]
[assembly: AssemblyProduct("AssetExtractor")]
[assembly: AssemblyTitle("AssetExtractor")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace AssetExtractor
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("icebro.assetextractor", "assetextractor", "0.4.1")]
public class AssetExtractor : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_Fire <>9__13_0;
public static hook_FireProjectileClient <>9__13_1;
public static hook_GenerateBulletAttack <>9__13_2;
public static hook_Fire <>9__13_3;
public static hook_Fire <>9__13_4;
public static hook_OnHitAll <>9__13_5;
internal Result <Awake>b__13_0(orig_Fire orig, BlastAttack self)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Firing blast proc " + self.procCoefficient);
return orig.Invoke(self);
}
internal void <Awake>b__13_1(orig_FireProjectileClient orig, ProjectileManager self, FireProjectileInfo info, NetworkClient client, double time)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Firing projectile" + (object)info.projectilePrefab);
ProjectileController val = default(ProjectileController);
if (info.projectilePrefab.TryGetComponent<ProjectileController>(ref val))
{
Log.Debug("Firing projectile proc " + val.procCoefficient);
}
else
{
Log.Error("could not get projectile controller out of prefab ! ");
}
orig.Invoke(self, info, client, time);
}
internal BulletAttack <Awake>b__13_2(orig_GenerateBulletAttack orig, GenericBulletBaseState self, Ray ray)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Firing bullet proc " + self.procCoefficient);
return orig.Invoke(self, ray);
}
internal void <Awake>b__13_3(orig_Fire orig, BulletAttack self)
{
Log.Debug("Firing bullet proc " + self.procCoefficient);
orig.Invoke(self);
}
internal bool <Awake>b__13_4(orig_Fire orig, OverlapAttack self, List<HurtBox> hurtboxes)
{
Log.Debug("Firing overlap proc " + self.procCoefficient);
return orig.Invoke(self, hurtboxes);
}
internal void <Awake>b__13_5(orig_OnHitAll orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hit)
{
Log.Debug("hit by proc " + damageInfo.procCoefficient);
orig.Invoke(self, damageInfo, hit);
}
}
public const string PluginGUID = "icebro.assetextractor";
public const string PluginAuthor = "icebro";
public const string PluginName = "assetextractor";
public const string PluginVersion = "0.4.1";
public ConfigEntry<bool> useModnameInFile;
public ConfigEntry<bool> useModnameInDirectory;
public ConfigEntry<bool> trygettingprocs;
public ConfigEntry<bool> logskillprocs;
private Stopwatch timer = new Stopwatch();
internal static AssetExtractor Instance { get; private set; }
public void Awake()
{
//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_00ca: Expected O, but got Unknown
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Expected O, but got Unknown
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Expected O, but got Unknown
Instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
useModnameInFile = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "use mod name", false, "always modname in file name (useful for conflicts when using single folder; eg ssu chirr and ss2 chirr");
useModnameInDirectory = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "use mod dir", true, "export everything in a content pack to its own folder (off for monolithic wiki folder with every skill/item/etc in one file/folder");
trygettingprocs = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "try getting skill procs automatically", false, "attempt to automatically get skill procs from entity state configurations (slow, bad and doesnt work half the time../ just get them from log brah !!");
logskillprocs = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "log skill procs", true, "log any on hit procs from skills (like 100 leeching seeds but awesome");
if (!logskillprocs.Value)
{
return;
}
object obj = <>c.<>9__13_0;
if (obj == null)
{
hook_Fire val = delegate(orig_Fire orig, BlastAttack self)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Firing blast proc " + self.procCoefficient);
return orig.Invoke(self);
};
<>c.<>9__13_0 = val;
obj = (object)val;
}
BlastAttack.Fire += (hook_Fire)obj;
object obj2 = <>c.<>9__13_1;
if (obj2 == null)
{
hook_FireProjectileClient val2 = delegate(orig_FireProjectileClient orig, ProjectileManager self, FireProjectileInfo info, NetworkClient client, double time)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Firing projectile" + (object)info.projectilePrefab);
ProjectileController val7 = default(ProjectileController);
if (info.projectilePrefab.TryGetComponent<ProjectileController>(ref val7))
{
Log.Debug("Firing projectile proc " + val7.procCoefficient);
}
else
{
Log.Error("could not get projectile controller out of prefab ! ");
}
orig.Invoke(self, info, client, time);
};
<>c.<>9__13_1 = val2;
obj2 = (object)val2;
}
ProjectileManager.FireProjectileClient += (hook_FireProjectileClient)obj2;
object obj3 = <>c.<>9__13_2;
if (obj3 == null)
{
hook_GenerateBulletAttack val3 = delegate(orig_GenerateBulletAttack orig, GenericBulletBaseState self, Ray ray)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Log.Debug("Firing bullet proc " + self.procCoefficient);
return orig.Invoke(self, ray);
};
<>c.<>9__13_2 = val3;
obj3 = (object)val3;
}
GenericBulletBaseState.GenerateBulletAttack += (hook_GenerateBulletAttack)obj3;
object obj4 = <>c.<>9__13_3;
if (obj4 == null)
{
hook_Fire val4 = delegate(orig_Fire orig, BulletAttack self)
{
Log.Debug("Firing bullet proc " + self.procCoefficient);
orig.Invoke(self);
};
<>c.<>9__13_3 = val4;
obj4 = (object)val4;
}
BulletAttack.Fire += (hook_Fire)obj4;
object obj5 = <>c.<>9__13_4;
if (obj5 == null)
{
hook_Fire val5 = delegate(orig_Fire orig, OverlapAttack self, List<HurtBox> hurtboxes)
{
Log.Debug("Firing overlap proc " + self.procCoefficient);
return orig.Invoke(self, hurtboxes);
};
<>c.<>9__13_4 = val5;
obj5 = (object)val5;
}
OverlapAttack.Fire += (hook_Fire)obj5;
object obj6 = <>c.<>9__13_5;
if (obj6 == null)
{
hook_OnHitAll val6 = delegate(orig_OnHitAll orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hit)
{
Log.Debug("hit by proc " + damageInfo.procCoefficient);
orig.Invoke(self, damageInfo, hit);
};
<>c.<>9__13_5 = val6;
obj6 = (object)val6;
}
GlobalEventManager.OnHitAll += (hook_OnHitAll)obj6;
}
private void Update()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
if (!Input.GetKeyDown((KeyCode)286))
{
return;
}
Log.Info("F5 pressed ,,. extracting !!!!");
long num = 0L;
long num2 = 0L;
long num3 = 0L;
long num4 = 0L;
long num5 = 0L;
long num6 = 0L;
WikiFormat.WikiTryGetProcs = trygettingprocs.Value;
Enumerator<ReadOnlyContentPack> enumerator = ContentManager.allLoadedContentPacks.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ReadOnlyContentPack current = enumerator.Current;
if (useModnameInDirectory.Value)
{
WikiFormat.WikiOutputPath = Path.Combine(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) ?? throw new InvalidOperationException(), "wiki"), ((ReadOnlyContentPack)(ref current)).identifier);
}
else
{
WikiFormat.WikiOutputPath = Path.Combine(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) ?? throw new InvalidOperationException(), "wiki"));
WikiFormat.WikiAppend = true;
}
if (useModnameInFile.Value)
{
WikiFormat.WikiModname = "_" + ((ReadOnlyContentPack)(ref current)).identifier;
}
else
{
WikiFormat.WikiModname = "";
}
timer.Start();
WikiFormat.FormatItem(current);
num += timer.ElapsedMilliseconds;
timer.Restart();
WikiFormat.FormatEquipment(current);
num2 += timer.ElapsedMilliseconds;
timer.Restart();
WikiFormat.FormatSurvivor(current);
num3 += timer.ElapsedMilliseconds;
timer.Restart();
WikiFormat.FormatSkill(current);
num4 += timer.ElapsedMilliseconds;
timer.Restart();
WikiFormat.FormatChallenges(current);
num5 += timer.ElapsedMilliseconds;
timer.Restart();
WikiFormat.FormatBodies(current);
num6 += timer.ElapsedMilliseconds;
timer.Restart();
timer.Stop();
try
{
if (Directory.GetFiles(WikiFormat.WikiOutputPath, "*", SearchOption.TopDirectoryOnly).Length == 0)
{
Directory.Delete(WikiFormat.WikiOutputPath);
}
}
catch (Exception data)
{
Log.Debug(data);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
Log.Info("Exported items in " + num + "ms");
Log.Info("Exported equips in " + num2 + "ms");
Log.Info("Exported survivors in " + num3 + "ms");
Log.Info("Exported skills in " + num4 + "ms");
Log.Info("Exported challenges in " + num5 + "ms");
Log.Info("Exported bodies in " + num6 + "ms");
Log.Info("complete !!!! located at: " + Path.Combine(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location))));
}
}
public static class WikiFormat
{
private const string WIKI_OUTPUT_FOLDER = "wiki";
private const string WIKI_OUTPUT_ITEM = "Items.txt";
private const string WIKI_OUTPUT_EQUIPMENT = "Equipments.txt";
private const string WIKI_OUTPUT_SURVIVORS = "Survivors.txt";
private const string WIKI_OUTPUT_SKILLS = "Skills.txt";
private const string WIKI_OUTPUT_CHALLENGES = "Challenges.txt";
private const string WIKI_OUTPUT_BODIES = "Bodies.txt";
public static string WikiOutputPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)AssetExtractor.Instance).Info.Location) ?? throw new InvalidOperationException(), "wiki");
public static string WikiModname = "";
public static bool WikiTryGetProcs = false;
public static bool WikiAppend = false;
private static Dictionary<string, string> FormatR2ToWiki = new Dictionary<string, string>
{
{ "</style>", "}}" },
{ "<style=cStack>", "{{Stack|" },
{ "<style=cIsDamage>", "{{Color|d|" },
{ "<style=cIsHealing>", "{{Color|h|" },
{ "<style=cIsUtility>", "{{Color|u|" },
{ "<style=cIsHealth>", "{{Color|hp|" },
{ "<style=cDeath>", "{{Color|hp|" },
{ "<style=cIsVoid>", "{{Color|v|" },
{ "<style=cIsLunar>", "{{Color|lunar|" },
{ "<style=cHumanObjective>", "{{Color|human|" },
{ "<style=cShrine>", "{{Color|boss|" }
};
public static void FormatItem(ReadOnlyContentPack readOnlyContentPack)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(WikiOutputPath, "Items.txt");
string f2 = "items[\"{0}\"] = {{\n\tRarity = \"{1}\",\n\tQuote = \"{2}\",\n\tDesc = \"{3}\",\n\tCategory = {{ {4} }},\n\tUnlock = \"{5}\",\n\tCorrupt = \"{6}\", \n\tUncorrupt = \"{7}\",\n\tID = ,\n\tStats = {{\n\t\t {{\n\t\t\tStat = \"\",\n\t\t\tValue = \"\",\n\t\t\tStack = \"\",\n\t\t\tAdd = \"\"\n\t\t}}\n\t}},\n\tLocalizationInternalName = \"{8}\",\n\t}}";
if (!Directory.Exists(WikiOutputPath))
{
Directory.CreateDirectory(WikiOutputPath);
}
TextWriter textWriter = new StreamWriter(text, WikiAppend);
AssetEnumerator<ItemDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).itemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
ItemDefFormat(current, textWriter, f2);
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
textWriter.Close();
long length = new FileInfo(text).Length;
if (length <= 0)
{
File.Delete(text);
}
static void ItemDefFormat(ItemDef def, TextWriter tw, string f)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected I4, but got Unknown
try
{
string text2 = "";
string text3 = "";
string text4 = "";
string text5 = "";
string text6 = "";
if (!((Object)(object)def == (Object)null))
{
if (def.nameToken != null)
{
text2 = Language.GetString(def.nameToken);
}
ItemTier tier = def.tier;
if (1 == 0)
{
}
string text7 = (int)tier switch
{
0 => "Common",
1 => "Uncommon",
2 => "Legendary",
3 => "Lunar",
4 => "Boss",
6 => "Void",
7 => "Void",
8 => "Void",
9 => "Void",
5 => "Untiered",
_ => "Untiered",
};
if (1 == 0)
{
}
string text8 = text7;
if (def.pickupToken != null)
{
text3 = Language.GetString(def.pickupToken);
}
if (def.descriptionToken != null)
{
text4 = Language.GetString(def.descriptionToken);
}
for (int i = 0; i < def.tags.Length; i++)
{
text5 = text5 + "\"" + Enum.GetName(typeof(ItemTag), def.tags[i]) + "\"";
if (i < def.tags.Length - 1)
{
text5 += ",";
}
}
string text9 = "";
if (Object.op_Implicit((Object)(object)def.unlockableDef))
{
AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(def.unlockableDef.cachedName);
if (achievementDefFromUnlockable != null && !string.IsNullOrEmpty(achievementDefFromUnlockable.nameToken))
{
text9 = Language.GetString(achievementDefFromUnlockable.nameToken);
}
}
if (def.nameToken != null && def.nameToken.EndsWith("_NAME"))
{
text6 = def.nameToken.Remove(def.nameToken.Length - 5);
}
else if (def.nameToken != null)
{
text6 = def.nameToken;
}
string text10 = Language.GetStringFormatted(f, new object[9]
{
text2,
text8,
text3,
text4,
text5,
text9,
string.Empty,
string.Empty,
text6
});
foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
{
text10 = text10.Replace(item.Key, item.Value);
}
tw.WriteLine(text10);
if (Object.op_Implicit((Object)(object)def.pickupIconTexture))
{
string text11 = WikiOutputPath + "\\items\\";
Directory.CreateDirectory(text11);
try
{
if (text2 == "")
{
Log.Debug("item name is blank ! using toke n");
exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text11, text6 + WikiModname + ".png"));
}
else
{
exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text11, text2.Replace(" ", "_") + WikiModname + ".png"));
}
return;
}
catch (Exception data)
{
Log.Debug(data);
Log.Debug("erm ,,.,. failed to export equip icon with proper name ,,. trying with tokenm !! " + text2);
exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text11, text6 + WikiModname + ".png"));
return;
}
}
}
}
catch (Exception ex)
{
Log.Error("Error while exporting item: " + ex);
}
}
}
public static void FormatEquipment(ReadOnlyContentPack readOnlyContentPack)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(WikiOutputPath, "Equipments.txt");
string f2 = "equipments[\"{0}\"] = {{\n\tRarity = \"{1}\",\n\tQuote = \"{2}\",\n\tDesc = \"{3}\",\n\tUnlock = \"{4}\",\n\t ID = ,\n\tLocalizationInternalName = \"{5}\",\n\t}}";
TextWriter textWriter = new StreamWriter(text, WikiAppend);
AssetEnumerator<EquipmentDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).equipmentDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
EquipmentDef current = enumerator.Current;
FormatEquipmentDef(current, textWriter, f2);
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
textWriter.Close();
long length = new FileInfo(text).Length;
if (length <= 0)
{
File.Delete(text);
}
static void FormatEquipmentDef(EquipmentDef def, TextWriter tw, string f)
{
try
{
if (!((Object)(object)def == (Object)null))
{
string text2 = "";
string text3 = (def.isLunar ? "Lunar Equipment" : "Equipment");
string text4 = "";
string text5 = "";
string text6 = "";
string text7 = "";
if (def.nameToken != null)
{
text2 = Language.GetString(def.nameToken);
}
if (def.nameToken != null)
{
text2 = Language.GetString(def.nameToken);
if (def.nameToken != null && def.nameToken.EndsWith("_NAME"))
{
text7 = def.nameToken.Remove(def.nameToken.Length - 5);
}
else if (def.nameToken != null)
{
text7 = def.nameToken;
}
}
if (def.pickupToken != null)
{
text4 = Language.GetString(def.pickupToken);
}
if (def.descriptionToken != null)
{
text5 = Language.GetString(def.descriptionToken);
}
if (Object.op_Implicit((Object)(object)def.unlockableDef))
{
string text8 = AchievementManager.GetAchievementDefFromUnlockable(def.unlockableDef.cachedName)?.nameToken;
if (text8 != null)
{
text6 = Language.GetString(text8);
}
}
string text9 = Language.GetStringFormatted(f, new object[6] { text2, text3, text4, text5, text6, text7 });
foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
{
text9 = text9.Replace(item.Key, item.Value);
}
tw.WriteLine(text9);
if (Object.op_Implicit((Object)(object)def.pickupIconTexture))
{
string text10 = WikiOutputPath + "\\equips\\";
Directory.CreateDirectory(text10);
try
{
if (text2 == "")
{
Log.Debug("equip name is blank ! using toke n");
exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text10, text7 + WikiModname + ".png"));
}
else
{
exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text10, text2.Replace(" ", "_") + WikiModname + ".png"));
}
return;
}
catch
{
Log.Debug("erm ,,.,. failed to export equip icon with proper name ,,. trying with tokenm !! " + text2);
exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text10, text7 + WikiModname + ".png"));
return;
}
}
}
}
catch (Exception ex)
{
Log.Error("Error while exporting equipment: " + ex);
}
}
}
public static void FormatSurvivor(ReadOnlyContentPack readOnlyContentPack)
{
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0508: Unknown result type (might be due to invalid IL or missing references)
//IL_058d: Unknown result type (might be due to invalid IL or missing references)
//IL_055f: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(WikiOutputPath, "Survivors.txt");
string text2 = "survivors[\"{0}\"] = {{\n";
text2 += "\tName = \"{1}\",\n";
text2 += "\tImage = \"{2}\",\n";
text2 += "\tBaseHealth = {3},\n";
text2 += "\tScalingHealth = {4},\n";
text2 += "\tBaseDamage = {5},\n";
text2 += "\tScalingDamage = {6},\n";
text2 += "\tBaseHealthRegen = {7},\n";
text2 += "\tScalingHealthRegen = {8},\n";
text2 += "\tBaseSpeed = {9},\n";
text2 += "\tBaseArmor = {10},\n";
text2 += "\tDescription = \"{11}\",\n";
text2 += "\tUnlock = \"{17}\",\n";
text2 += "\tUmbra= \"{18}\",\n";
text2 += "\tPhraseEscape = \"{12}\",\n";
text2 += "\tPhraseVanish = \"{13}\",\n";
text2 += "\tClass = \"\",\n";
text2 += "\tMass = {14},\n";
text2 += "\tLocalizationInternalName = \"{15}\",\n";
text2 += "\tColor = \"{16}\",\n";
text2 += "\t}}";
if (!Directory.Exists(WikiOutputPath))
{
Directory.CreateDirectory(WikiOutputPath);
}
TextWriter textWriter = new StreamWriter(text, WikiAppend);
AssetEnumerator<SurvivorDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).survivorDefs.GetEnumerator();
try
{
CharacterBody val = default(CharacterBody);
CharacterMotor val2 = default(CharacterMotor);
ModelLocator val4 = default(ModelLocator);
while (enumerator.MoveNext())
{
SurvivorDef current = enumerator.Current;
try
{
string text3 = "";
string text4 = "";
string text5 = "";
string text6 = "";
string text7 = "";
float num = 1E+14f;
float num2 = 1E+14f;
float num3 = 1E+14f;
float num4 = 1E+14f;
float num5 = 1E+14f;
float num6 = 1E+14f;
float num7 = 1E+14f;
float num8 = 1E+14f;
float num9 = 1E+14f;
string text8 = "";
string text9 = "";
string text10 = "";
string text11 = "";
if (current.displayNameToken != null)
{
text3 = Language.GetString(current.displayNameToken);
}
if (current.descriptionToken != null)
{
text4 = Language.GetString(current.descriptionToken);
}
_ = current.primaryColor;
if (true)
{
text7 = ColorUtility.ToHtmlStringRGB(current.primaryColor);
}
if ((Object)(object)current.unlockableDef != (Object)null)
{
string text12 = AchievementManager.GetAchievementDefFromUnlockable(current.unlockableDef.cachedName)?.nameToken;
if (text12 != null)
{
text5 = Language.GetString(text12);
}
}
if (current.displayNameToken != null && current.displayNameToken.EndsWith("_NAME"))
{
text6 = current.displayNameToken.Remove(current.displayNameToken.Length - 5);
}
else if (current.displayNameToken != null)
{
text6 = current.displayNameToken;
}
if (current.bodyPrefab.TryGetComponent<CharacterBody>(ref val))
{
num = val.baseMaxHealth;
num2 = val.levelMaxHealth;
num3 = val.baseDamage;
num4 = val.levelDamage;
num5 = val.baseRegen;
num6 = val.levelRegen;
num7 = val.baseMoveSpeed;
num8 = val.baseArmor;
}
if (current.bodyPrefab.TryGetComponent<CharacterMotor>(ref val2))
{
num9 = val2.mass;
}
if (current.mainEndingEscapeFailureFlavorToken != null)
{
text8 = Language.GetString(current.mainEndingEscapeFailureFlavorToken);
}
if (current.outroFlavorToken != null)
{
text9 = Language.GetString(current.outroFlavorToken);
}
if (val.subtitleNameToken != null)
{
text10 = Language.GetString(val.subtitleNameToken);
}
if (Object.op_Implicit((Object)(object)current.unlockableDef))
{
AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(current.unlockableDef.cachedName);
text11 = Language.GetString(achievementDefFromUnlockable.nameToken);
}
string text13 = Language.GetStringFormatted(text2, new object[19]
{
text3,
text3,
text3.Replace(" ", "_") + WikiModname + ".png",
num,
num2,
num3,
num4,
num5,
num6,
num7,
num8,
text4,
text9,
text8,
num9,
text6,
"#" + text7,
text11,
text10
});
foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
{
text13 = text13.Replace(item.Key, item.Value);
}
textWriter.WriteLine(text13);
if (!Object.op_Implicit((Object)(object)SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex)))
{
continue;
}
string text14 = WikiOutputPath + "\\survivors\\";
Directory.CreateDirectory(text14);
try
{
if (text3 == "")
{
Log.Debug("surv name is blank ! using toke n");
exportTexture(SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex), Path.Combine(text14, text6 + WikiModname + ".png"));
}
else
{
exportTexture(SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex), Path.Combine(text14, text3.Replace(" ", "_") + WikiModname + ".png"));
}
}
catch
{
Log.Debug("erm ,,.,. failed to export surv icon with proper name ,,. trying with tokenm !! " + text3);
exportTexture(SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex), Path.Combine(text14, text6 + WikiModname + ".png"));
}
SkinDef[] allSkinDefs = SkinCatalog.allSkinDefs;
foreach (SkinDef val3 in allSkinDefs)
{
string text15 = WikiOutputPath + "\\skins\\";
Directory.CreateDirectory(text15);
if (current.bodyPrefab.TryGetComponent<ModelLocator>(ref val4) && ((Object)val4.modelTransform).name != null && (Object)(object)val3.rootObject != (Object)null && ((Object)val4.modelTransform).name == ((Object)val3.rootObject).name)
{
try
{
string text16 = "";
string @string = Language.GetString(val3.nameToken);
exportTexture(path: Path.Combine(text15, ((!(@string == "Default")) ? Language.GetString(val3.nameToken) : ("Default " + text3)).Replace(" ", "_") + WikiModname + ".png"), sprite: val3.icon);
}
catch
{
Log.Debug("erm ,,.,. failed to export skin icon with proper name ,,. trying with tokenm !! " + Language.GetString(val3.nameToken));
exportTexture(val3.icon, Path.Combine(text15, val3.nameToken + WikiModname + ".png"));
}
}
}
}
catch (Exception ex)
{
Log.Error("Error while exporting skin: " + ex);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
textWriter.Close();
long length = new FileInfo(text).Length;
if (length <= 0)
{
File.Delete(text);
}
}
public static void FormatSkill(ReadOnlyContentPack readOnlyContentPack)
{
//IL_060a: Unknown result type (might be due to invalid IL or missing references)
//IL_0618: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0525: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0581: Unknown result type (might be due to invalid IL or missing references)
//IL_058f: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0420: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(WikiOutputPath, "Skills.txt");
string text2 = "skills[\"{0}\"] = {{\n";
text2 += "\tName = \"{1}\",\n";
text2 += "\tDesc = \"{2}\",\n";
text2 += "\tSurvivor = \"{3}\",\n";
text2 += "\tType = \"{4}\",\n";
text2 += "\tCooldown = \"{5}\",\n";
text2 += "\tUnlock = \"{6}\",\n";
if (!Directory.Exists(WikiOutputPath))
{
Directory.CreateDirectory(WikiOutputPath);
}
TextWriter textWriter = new StreamWriter(text, WikiAppend);
AssetEnumerator<SurvivorDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).survivorDefs.GetEnumerator();
try
{
CharacterBody val = default(CharacterBody);
ProjectileController val7 = default(ProjectileController);
while (enumerator.MoveNext())
{
SurvivorDef current = enumerator.Current;
try
{
if (!current.bodyPrefab.TryGetComponent<CharacterBody>(ref val))
{
continue;
}
GenericSkill[] components = ((Component)val).GetComponents<GenericSkill>();
SkillLocator component = ((Component)val).GetComponent<SkillLocator>();
GenericSkill[] array = components;
foreach (GenericSkill val2 in array)
{
string text3 = "Passive";
string text4 = "";
string text5 = "";
string text6 = "";
string text7 = "";
float num = 0f;
List<float> list = new List<float>();
text5 = Language.GetString(current.displayNameToken);
Variant[] variants = val2.skillFamily.variants;
foreach (Variant val3 in variants)
{
if (val3.skillDef.skillNameToken != null)
{
text4 = Language.GetString(val3.skillDef.skillNameToken);
}
if ((Object)(object)val2 == (Object)(object)component.primary)
{
text3 = "Primary";
}
else if ((Object)(object)val2 == (Object)(object)component.secondary)
{
text3 = "Secondary";
}
else if ((Object)(object)val2 == (Object)(object)component.utility)
{
text3 = "Utility";
}
else if ((Object)(object)val2 == (Object)(object)component.special)
{
text3 = "Special";
}
if (val3.skillDef.baseRechargeInterval != 0f)
{
num = val3.skillDef.baseRechargeInterval;
}
if (val3.skillDef.skillDescriptionToken != null)
{
text6 = Language.GetString(val3.skillDef.skillDescriptionToken);
}
if ((Object)(object)val3.unlockableDef != (Object)null)
{
AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(val3.unlockableDef.cachedName);
if (achievementDefFromUnlockable != null)
{
text7 = Language.GetString(achievementDefFromUnlockable.nameToken);
}
}
if (((SerializableEntityStateType)(ref val3.skillDef.activationState)).stateType != null && WikiTryGetProcs)
{
try
{
EntityState val4 = EntityStateCatalog.InstantiateState(EntityStateCatalog.stateTypeToIndex[((SerializableEntityStateType)(ref val3.skillDef.activationState)).stateType]);
if (val4 != null)
{
Enumerator<ReadOnlyContentPack> enumerator2 = ContentManager.allLoadedContentPacks.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
ReadOnlyContentPack current2 = enumerator2.Current;
Log.Warning("lookin through ,., " + ((ReadOnlyContentPack)(ref current2)).identifier);
AssetEnumerator<EntityStateConfiguration> enumerator3 = ((ReadOnlyContentPack)(ref current2)).entityStateConfigurations.GetEnumerator();
try
{
while (enumerator3.MoveNext())
{
EntityStateConfiguration current3 = enumerator3.Current;
if (!((Object)current3).name.Contains(((SerializableEntityStateType)(ref val3.skillDef.activationState)).stateType.ToString()))
{
continue;
}
Log.Warning("found config ! " + ((Object)current3).name);
SerializedField[] serializedFields = current3.serializedFieldsCollection.serializedFields;
foreach (SerializedField val5 in serializedFields)
{
if (val5.fieldName.ToLower().Contains("proc"))
{
list.Add(float.Parse(val5.fieldValue.stringValue));
}
else if (val5.fieldName.ToLower().Contains("projectile"))
{
if (val5.fieldValue.objectValue != (Object)null)
{
Object obj = Object.Instantiate(val5.fieldValue.objectValue);
GameObject val6 = (GameObject)(object)((obj is GameObject) ? obj : null);
if (val6.TryGetComponent<ProjectileController>(ref val7))
{
list.Add(val7.procCoefficient);
}
else
{
Log.Error("could not get projectile controller out of prefab ! ");
}
}
}
else if (val5.fieldName.ToLower().Contains("damage") && list.Count == 0)
{
list.Add(1f);
Log.Debug("no proc found ! defaulting to 1 ,., ");
}
}
}
}
finally
{
((IDisposable)enumerator3).Dispose();
}
}
}
finally
{
((IDisposable)enumerator2).Dispose();
}
}
}
catch (Exception ex)
{
Log.Error("Error while getting proc coefficient: " + ex);
}
}
if (!Object.op_Implicit((Object)(object)val3.skillDef.icon.texture))
{
continue;
}
string text8 = WikiOutputPath + "\\skills\\";
Directory.CreateDirectory(text8);
try
{
if (text4 == "")
{
Log.Debug("skill name is blank ! using toke n");
exportTexture(val3.skillDef.icon, Path.Combine(text8, val3.skillDef.skillNameToken + WikiModname + ".png"));
}
else
{
exportTexture(val3.skillDef.icon, Path.Combine(text8, text4.Replace(" ", "_") + WikiModname + ".png"));
}
}
catch
{
Log.Debug("erm ,,.,. failed to export skill icon with proper name ,,. trying with tokenm !! " + text4);
exportTexture(val3.skillDef.icon, Path.Combine(text8, val3.skillDef.skillNameToken + WikiModname + ".png"));
}
string text9 = "";
string text10 = text2;
if (list.Count == 0)
{
text10 += "\t}},";
text9 = Language.GetStringFormatted(text10, new object[7] { text4, text4, text6, text5, text3, num, text7 });
}
else
{
text10 += "\tProc = \"{7}\",\n";
text10 += "\t}},";
text9 = Language.GetStringFormatted(text10, new object[8] { text4, text4, text6, text5, text3, num, text7, list });
}
foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
{
text9 = text9.Replace(item.Key, item.Value);
}
textWriter.WriteLine(text9);
}
}
}
catch (Exception ex2)
{
Log.Error("Error while exporting skill: " + ex2);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
textWriter.Close();
long length = new FileInfo(text).Length;
if (length <= 0)
{
File.Delete(text);
}
}
public static void FormatChallenges(ReadOnlyContentPack readOnlyContentPack)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(WikiOutputPath, "Challenges.txt");
string text2 = "challenges[\"{0}\"] = {{\n";
text2 += "\tType = \"{1}\",\n";
text2 += "\tUnlock = {{ \"{2}\" }} ,\n";
text2 += "\tDesc = \"{3}\",\n";
text2 += "\t}}";
if (!Directory.Exists(WikiOutputPath))
{
Directory.CreateDirectory(WikiOutputPath);
}
TextWriter textWriter = new StreamWriter(text, WikiAppend);
AssetEnumerator<UnlockableDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).unlockableDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
UnlockableDef current = enumerator.Current;
string text3 = "";
string text4 = "";
string text5 = "";
string text6 = "";
AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(current.cachedName);
if (achievementDefFromUnlockable == null)
{
continue;
}
if (achievementDefFromUnlockable.nameToken != null)
{
text3 = Language.GetString(achievementDefFromUnlockable.nameToken);
}
if (achievementDefFromUnlockable.unlockableRewardIdentifier != null)
{
Enumerator<ItemDef> enumerator2 = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
ItemDef current2 = enumerator2.Current;
if ((Object)(object)current2.unlockableDef != (Object)(object)current)
{
continue;
}
text5 = Language.GetString(current2.nameToken);
text4 = "Items";
break;
}
}
finally
{
((IDisposable)enumerator2).Dispose();
}
foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
{
if (text5 != "")
{
break;
}
if ((Object)(object)allSurvivorDef.unlockableDef != (Object)(object)current)
{
continue;
}
text5 = Language.GetString(allSurvivorDef.displayNameToken);
text4 = "Survivors";
break;
}
EquipmentDef[] equipmentDefs = EquipmentCatalog.equipmentDefs;
foreach (EquipmentDef val in equipmentDefs)
{
if (text5 != "")
{
break;
}
if (!((Object)(object)val.unlockableDef != (Object)(object)current))
{
text5 = Language.GetString(val.nameToken);
text4 = "Equipment";
break;
}
}
SkinDef[] allSkinDefs = SkinCatalog.allSkinDefs;
foreach (SkinDef val2 in allSkinDefs)
{
if (text5 != "")
{
break;
}
if (!((Object)(object)val2.unlockableDef != (Object)(object)current))
{
text5 = Language.GetString(val2.nameToken);
text4 = "Skins";
break;
}
}
ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs;
foreach (ArtifactDef val3 in artifactDefs)
{
if (text5 != "")
{
break;
}
if (!((Object)(object)val3.unlockableDef != (Object)(object)current))
{
text5 = Language.GetString(val3.nameToken);
text4 = "Artifacts";
break;
}
}
SkillFamily[] allSkillFamilies = SkillCatalog._allSkillFamilies;
foreach (SkillFamily val4 in allSkillFamilies)
{
if (text5 != "")
{
break;
}
Variant[] variants = val4.variants;
foreach (Variant val5 in variants)
{
if (!((Object)(object)val5.unlockableDef != (Object)(object)current))
{
text5 = Language.GetString(val5.skillDef.skillNameToken);
text4 = "Skills";
break;
}
}
}
}
if (achievementDefFromUnlockable.descriptionToken != null)
{
text6 = Language.GetString(achievementDefFromUnlockable.descriptionToken);
}
try
{
string text7 = string.Format(text2, text3, text4, text5, text6);
foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
{
text7 = text7.Replace(item.Key, item.Value);
}
textWriter.WriteLine(text7);
}
catch (Exception ex)
{
Log.Error("Error while exporting challenge: " + ex);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
textWriter.Close();
long length = new FileInfo(text).Length;
if (length <= 0)
{
File.Delete(text);
}
}
public static void FormatBodies(ReadOnlyContentPack readOnlyContentPack)
{
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(WikiOutputPath, "Bodies.txt");
string text2 = "monsters[\"{0}\"] = {{\n";
text2 += "\tName = \"{1}\",\n";
text2 += "\tBaseDamage = \"{2}\",\n";
text2 += "\tBaseHealth = {3},\n";
text2 += "\tBaseHealthRegen = {4},\n";
text2 += "\tBaseSpeed = {5},\n";
text2 += "\tBaseHealth = {6},\n";
text2 += "\tBaseHealthRegen = {7},\n";
text2 += "\tScalingHealthRegen = {8},\n";
text2 += "\tBaseSpeed = {9},\n";
text2 += "\tBaseArmor = {10},\n";
text2 += "\tDescription = \"{11}\",\n";
text2 += "\tClass = \"\",\n";
text2 += "\tMass = {12},\n";
text2 += "\tLocalizationInternalName = \"{13}\",\n";
text2 += "\tColor = \"{14}\",\n";
text2 += "\t}}";
if (!Directory.Exists(WikiOutputPath))
{
Directory.CreateDirectory(WikiOutputPath);
}
TextWriter textWriter = new StreamWriter(text, WikiAppend);
AssetEnumerator<GameObject> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).bodyPrefabs.GetEnumerator();
try
{
CharacterBody val = default(CharacterBody);
ExpansionRequirementComponent val2 = default(ExpansionRequirementComponent);
CharacterMotor val3 = default(CharacterMotor);
while (enumerator.MoveNext())
{
GameObject current = enumerator.Current;
try
{
string text3 = "";
string text4 = "";
string text5 = "";
string text6 = "";
string text7 = "";
float num = 1E+14f;
float num2 = 1E+14f;
float num3 = 1E+14f;
float num4 = 1E+14f;
float num5 = 1E+14f;
float num6 = 1E+14f;
float num7 = 1E+14f;
float num8 = 1E+14f;
float num9 = 1E+14f;
bool flag = false;
foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
{
if ((Object)(object)allSurvivorDef.bodyPrefab == (Object)(object)current)
{
flag = true;
break;
}
}
if (flag || !current.TryGetComponent<CharacterBody>(ref val))
{
continue;
}
if (val.baseNameToken != null)
{
text3 = Language.GetString(val.baseNameToken);
}
if (val.subtitleNameToken != null)
{
text4 = Language.GetString(val.subtitleNameToken);
}
_ = val.bodyColor;
if (true)
{
text7 = ColorUtility.ToHtmlStringRGB(val.bodyColor);
}
if (((Component)val).TryGetComponent<ExpansionRequirementComponent>(ref val2) && (Object)(object)val2 != (Object)null)
{
text5 = Language.GetString(((Object)val2).name);
}
if (val.baseNameToken != null && val.baseNameToken.EndsWith("_NAME"))
{
text6 = val.baseNameToken.Remove(val.baseNameToken.Length - 5);
}
else if (val.baseNameToken != null)
{
text6 = val.baseNameToken;
}
num = val.baseMaxHealth;
num2 = val.levelMaxHealth;
num3 = val.baseDamage;
num4 = val.levelDamage;
num5 = val.baseRegen;
num6 = val.levelRegen;
num7 = val.baseMoveSpeed;
num8 = val.baseArmor;
if (((Component)val).TryGetComponent<CharacterMotor>(ref val3))
{
num9 = val3.mass;
}
string text8 = Language.GetStringFormatted(text2, new object[15]
{
text3,
text3,
text3.Replace(" ", "_") + WikiModname + ".png",
num,
num2,
num3,
num4,
num5,
num6,
num7,
num8,
text4,
num9,
text6,
"#" + text7
});
foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
{
text8 = text8.Replace(item.Key, item.Value);
}
textWriter.WriteLine(text8);
if (!Object.op_Implicit((Object)(object)val.portraitIcon))
{
continue;
}
string text9 = WikiOutputPath + "\\bodies\\";
Directory.CreateDirectory(text9);
try
{
if (text3 == "")
{
Log.Debug("body name is blank ! using toke n");
exportTexture(val.portraitIcon, Path.Combine(text9, text6 + WikiModname + ".png"));
}
else
{
exportTexture(val.portraitIcon, Path.Combine(text9, text3.Replace(" ", "_") + WikiModname + ".png"));
}
}
catch
{
Log.Debug("erm ,,.,. failed to export body icon with proper name ,,. trying with tokenm !! " + text3);
exportTexture(val.portraitIcon, Path.Combine(text9, text6 + WikiModname + ".png"));
}
}
catch (Exception ex)
{
Log.Error("Error while exporting body: " + ex);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
textWriter.Close();
long length = new FileInfo(text).Length;
if (length <= 0)
{
File.Delete(text);
}
}
public static void exportTexture(Texture texture, string path)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
RenderTexture temporary = RenderTexture.GetTemporary(texture.width, texture.height, 32);
((Object)temporary).name = "Whatever";
temporary.enableRandomWrite = true;
temporary.Create();
Graphics.Blit(texture, temporary);
RenderTexture active = RenderTexture.active;
RenderTexture.active = temporary;
Texture2D val = new Texture2D(texture.width, texture.height);
val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
val.Apply();
RenderTexture.active = active;
RenderTexture.ReleaseTemporary(temporary);
File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val));
Object.Destroy((Object)(object)val);
}
public static void exportTexture(Sprite sprite, string path)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_0089: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
RenderTexture temporary = RenderTexture.GetTemporary(((Texture)sprite.texture).width, ((Texture)sprite.texture).height, 32);
((Object)temporary).name = "Whatever";
temporary.enableRandomWrite = true;
temporary.Create();
Graphics.Blit((Texture)(object)sprite.texture, temporary);
RenderTexture active = RenderTexture.active;
RenderTexture.active = temporary;
Texture2D val = new Texture2D(((Texture)sprite.texture).width, ((Texture)sprite.texture).height);
val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
val.Apply();
RenderTexture.active = active;
RenderTexture.ReleaseTemporary(temporary);
Rect val2 = sprite.rect;
int num = (int)((Rect)(ref val2)).width;
val2 = sprite.rect;
Texture2D val3 = new Texture2D(num, (int)((Rect)(ref val2)).height);
val2 = sprite.textureRect;
int num2 = (int)((Rect)(ref val2)).x;
val2 = sprite.textureRect;
int num3 = (int)((Rect)(ref val2)).y;
val2 = sprite.textureRect;
int num4 = (int)((Rect)(ref val2)).width;
val2 = sprite.textureRect;
Color[] pixels = val.GetPixels(num2, num3, num4, (int)((Rect)(ref val2)).height);
val3.SetPixels(pixels);
val3.Apply();
File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val3));
Object.Destroy((Object)(object)val);
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}