using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.SceneManagement;
[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("MoreConsumablesInShop")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("More Consumables In Shop")]
[assembly: AssemblyTitle("MoreConsumablesInShop")]
[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 MoreConsumablesInShop
{
internal static class Extensions
{
public static void AddIf<T>(this List<T> self, T item, bool cond)
{
if (cond)
{
self.Add(item);
}
}
}
[BepInPlugin("MoreConsumablesInShop", "More Consumables In Shop", "1.0.0")]
[Harmony]
public class Plugin : BaseUnityPlugin
{
private enum ConsumableItemID
{
GeoFrayed,
GeoSmall,
GeoMedium,
GeoLarge,
GeoHuge,
ShardSmall,
ShardBig,
ShardMech,
ShardHornet,
ShardHornetAct3,
Count
}
private enum VendorID
{
ForgeDaughter,
Frey,
Grindle,
Jubilina,
Mort,
MottledSkarr,
Pebb,
TwelfthArchitect,
Count
}
private enum ConsumableGroups
{
Rosaries = 1,
Shards,
Both
}
internal static ManualLogSource Logger;
private const string GEO_FRAYED = "INV_NAME_COIN_SET_F";
private const string GEO_SMALL = "INV_NAME_COIN_SET_S";
private const string GEO_MEDIUM = "INV_NAME_COIN_SET_M";
private const string GEO_LARGE = "INV_NAME_COIN_SET_M2";
private const string GEO_HUGE = "INV_NAME_COIN_SET_L";
private const string SHARD_SMALL = "INV_NAME_SHARD_POUCH";
private const string SHARD_BIG = "INV_NAME_GREAT_SHARD";
private const string SHARD_MECH = "INV_NAME_PRISTINE_CORE";
private const string SHARD_HORNET = "INV_NAME_FIXER_IDOL";
private static ShopItem[,] ShopItems;
private static bool ShopItemsAreSetUp;
private static ConfigEntry<bool>[] canSellConfig;
private static ConfigEntry<int>[] sellPriceConfig;
private static List<ShopItemList> ModifiedShopList;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("MoreConsumablesInShop");
val.PatchAll();
SetupConfig(((BaseUnityPlugin)this).Config);
ModifiedShopList = new List<ShopItemList>();
SceneManager.activeSceneChanged += ClearModifiedShopList;
Logger.LogInfo((object)"Plugin MoreConsumablesInShop is loaded!");
}
private static void SetupConfig(ConfigFile config)
{
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Expected O, but got Unknown
canSellConfig = new ConfigEntry<bool>[10];
sellPriceConfig = new ConfigEntry<int>[10];
ConsumableItemID[] array = (ConsumableItemID[])Enum.GetValues(typeof(ConsumableItemID));
for (int i = 0; i < array.Length; i++)
{
ConsumableItemID consumableItemID = array[i];
if (consumableItemID != ConsumableItemID.Count)
{
int num = (int)consumableItemID;
if (consumableItemID == ConsumableItemID.ShardHornetAct3)
{
canSellConfig[num] = canSellConfig[8];
sellPriceConfig[num] = sellPriceConfig[8];
}
string empty = string.Empty;
int num2 = 0;
ConsumableGroups consumableGroups = ConsumableGroups.Rosaries;
switch (consumableItemID)
{
case ConsumableItemID.GeoFrayed:
empty = "Frayed Rosary String";
num2 = 50;
break;
case ConsumableItemID.GeoSmall:
empty = "Rosary String";
num2 = 80;
break;
case ConsumableItemID.GeoMedium:
empty = "Rosary Necklace";
num2 = 140;
break;
case ConsumableItemID.GeoLarge:
empty = "Heavy Rosary Necklace";
num2 = 240;
break;
case ConsumableItemID.GeoHuge:
empty = "Pale Rosary Necklace";
num2 = 360;
break;
case ConsumableItemID.ShardSmall:
empty = "Shard Bundle";
num2 = 50;
consumableGroups = ConsumableGroups.Shards;
break;
case ConsumableItemID.ShardBig:
empty = "Beast Shard";
num2 = 90;
consumableGroups = ConsumableGroups.Shards;
break;
case ConsumableItemID.ShardMech:
empty = "Pristine Core";
num2 = 140;
consumableGroups = ConsumableGroups.Shards;
break;
case ConsumableItemID.ShardHornet:
empty = "Hornet Statuette";
num2 = 200;
consumableGroups = ConsumableGroups.Shards;
break;
default:
Logger.LogWarning((object)("ConsumableItemID." + consumableItemID.ToString() + " does not have a config value"));
continue;
}
string text = string.Concat(empty.Where((char c) => c != ' '));
string text2 = consumableGroups.ToString() + "." + text;
canSellConfig[num] = config.Bind<bool>(text2, "canSell", true, "Whether shops can sell " + empty + "s");
sellPriceConfig[num] = config.Bind<int>(text2, "sellPrice", num2, new ConfigDescription("The sell price of " + empty + "s in Rosaries", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 9999999), Array.Empty<object>()));
}
}
}
private static void ClearModifiedShopList(Scene from, Scene to)
{
if (((Scene)(ref to)).name == "Menu_Title")
{
ModifiedShopList.Clear();
}
}
[HarmonyPatch(typeof(ShopOwnerBase), "SpawnUpdateShop")]
[HarmonyPrefix]
private static void InitializeSkarrMerchantShopItemList(ShopOwnerBase __instance)
{
ShopOwner val = default(ShopOwner);
if (((Component)__instance).TryGetComponent<ShopOwner>(ref val) && ((Object)__instance).name == "Ant Merchant" && (Object)(object)val.stockList == (Object)null)
{
Logger.LogInfo((object)("Creating ShopItemList for \"" + ((Object)val).name + "\""));
val.stockList = ScriptableObject.CreateInstance<ShopItemList>();
((Object)val.stockList).name = "Ant Merchant Stock";
val.stockList.shopItems = val.stock;
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
private static void AddItemsToShop(ShopItemList __instance)
{
if (__instance.shopItems == null)
{
return;
}
Logger.LogInfo((object)"Trying to set up the shop");
if (!ShopItemsAreSetUp)
{
SetupShopItems();
}
int num = 1;
bool flag = false;
int num2;
ConsumableGroups consumableGroups;
switch (((Object)__instance).name)
{
case "Forgedaughter Stock":
num2 = 0;
consumableGroups = ConsumableGroups.Shards;
break;
case "Bellhart Stock":
num2 = 1;
consumableGroups = ConsumableGroups.Both;
num++;
break;
case "Grindle Stock":
num2 = 2;
consumableGroups = ConsumableGroups.Rosaries;
break;
case "City Merchant Stock":
num2 = 3;
consumableGroups = ConsumableGroups.Rosaries;
break;
case "Pilgrims Rest Stock":
num2 = 4;
consumableGroups = ConsumableGroups.Both;
num++;
flag = true;
break;
case "Ant Merchant Stock":
num2 = 5;
consumableGroups = ConsumableGroups.Shards;
break;
case "Bonebottom Peddler Stock":
num2 = 6;
consumableGroups = ConsumableGroups.Rosaries;
break;
case "Architect Stock":
num2 = 7;
consumableGroups = ConsumableGroups.Shards;
break;
default:
Logger.LogInfo((object)("\"" + ((Object)__instance).name + "\" case not handled. Shop will not be set up"));
return;
}
if (ModifiedShopList.Contains(__instance))
{
Logger.LogInfo((object)("Shop \"" + ((Object)__instance).name + "\" is already set up"));
return;
}
ModifiedShopList.Add(__instance);
Logger.LogInfo((object)("Trying to set up shop: \"" + ((Object)__instance).name + "\", " + $"vendor: \"{(VendorID)num2}\" ({num2}), group: \"{consumableGroups}\" ({(int)consumableGroups}), popCount: {num}"));
List<ShopItem> list = __instance.shopItems.ToList();
Logger.LogInfo((object)$"Popping {num} items from stock");
for (int i = 0; i < num; i++)
{
list.RemoveAt(list.Count - 1);
}
if (flag && (consumableGroups == ConsumableGroups.Rosaries || consumableGroups == ConsumableGroups.Both))
{
Logger.LogInfo((object)"Adding rosaries");
list.AddIf(ShopItems[0, num2], canSellConfig[0].Value);
list.AddIf(ShopItems[1, num2], canSellConfig[1].Value);
list.AddIf(ShopItems[2, num2], canSellConfig[2].Value);
list.AddIf(ShopItems[3, num2], canSellConfig[3].Value);
list.AddIf(ShopItems[4, num2], canSellConfig[4].Value);
}
if (consumableGroups == ConsumableGroups.Shards || consumableGroups == ConsumableGroups.Both)
{
Logger.LogInfo((object)"Adding shards");
list.AddIf(ShopItems[5, num2], canSellConfig[5].Value);
list.AddIf(ShopItems[6, num2], canSellConfig[6].Value);
list.AddIf(ShopItems[7, num2], canSellConfig[7].Value);
list.AddIf((PlayerData.instance.act3_wokeUp && !QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Building Materials (Statue)").IsCompleted) ? ShopItems[9, num2] : ShopItems[8, num2], canSellConfig[8].Value);
}
if (!flag && (consumableGroups == ConsumableGroups.Rosaries || consumableGroups == ConsumableGroups.Both))
{
Logger.LogInfo((object)"Adding rosaries");
list.AddIf(ShopItems[0, num2], canSellConfig[0].Value);
list.AddIf(ShopItems[1, num2], canSellConfig[1].Value);
list.AddIf(ShopItems[2, num2], canSellConfig[2].Value);
list.AddIf(ShopItems[3, num2], canSellConfig[3].Value);
list.AddIf(ShopItems[4, num2], canSellConfig[4].Value);
}
__instance.shopItems = list.ToArray();
Logger.LogInfo((object)"Done");
}
private static void SetupShopItems()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_048a: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04d8: 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_05c6: Unknown result type (might be due to invalid IL or missing references)
//IL_060c: Unknown result type (might be due to invalid IL or missing references)
//IL_060e: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_0650: Unknown result type (might be due to invalid IL or missing references)
//IL_0690: Unknown result type (might be due to invalid IL or missing references)
//IL_0692: Unknown result type (might be due to invalid IL or missing references)
//IL_0699: Unknown result type (might be due to invalid IL or missing references)
//IL_069b: Unknown result type (might be due to invalid IL or missing references)
//IL_071e: Unknown result type (might be due to invalid IL or missing references)
//IL_0725: Expected O, but got Unknown
//IL_0731: Unknown result type (might be due to invalid IL or missing references)
//IL_0743: Unknown result type (might be due to invalid IL or missing references)
//IL_074c: Unknown result type (might be due to invalid IL or missing references)
//IL_0760: Unknown result type (might be due to invalid IL or missing references)
//IL_076d: Unknown result type (might be due to invalid IL or missing references)
//IL_076f: Unknown result type (might be due to invalid IL or missing references)
//IL_0779: Unknown result type (might be due to invalid IL or missing references)
//IL_077b: Unknown result type (might be due to invalid IL or missing references)
//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
//IL_07c1: Expected O, but got Unknown
//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
//IL_07df: Unknown result type (might be due to invalid IL or missing references)
//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0809: Unknown result type (might be due to invalid IL or missing references)
//IL_080b: Unknown result type (might be due to invalid IL or missing references)
//IL_0814: Unknown result type (might be due to invalid IL or missing references)
//IL_081d: Unknown result type (might be due to invalid IL or missing references)
//IL_0831: Unknown result type (might be due to invalid IL or missing references)
//IL_083e: Unknown result type (might be due to invalid IL or missing references)
//IL_0840: Unknown result type (might be due to invalid IL or missing references)
//IL_084a: Unknown result type (might be due to invalid IL or missing references)
//IL_084c: Unknown result type (might be due to invalid IL or missing references)
//IL_0894: Unknown result type (might be due to invalid IL or missing references)
//IL_08da: Unknown result type (might be due to invalid IL or missing references)
//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0917: Unknown result type (might be due to invalid IL or missing references)
//IL_091e: Expected O, but got Unknown
//IL_092a: Unknown result type (might be due to invalid IL or missing references)
//IL_093c: Unknown result type (might be due to invalid IL or missing references)
//IL_0945: Unknown result type (might be due to invalid IL or missing references)
//IL_0959: Unknown result type (might be due to invalid IL or missing references)
//IL_0966: Unknown result type (might be due to invalid IL or missing references)
//IL_0968: Unknown result type (might be due to invalid IL or missing references)
//IL_0972: Unknown result type (might be due to invalid IL or missing references)
//IL_0974: Unknown result type (might be due to invalid IL or missing references)
ShopItemsAreSetUp = true;
Logger.LogInfo((object)"Creating all shop items");
ShopItems = new ShopItem[10, 8];
for (int i = 0; i < 8; i++)
{
string desc = "";
string text = "";
QuestTest val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Belltown House Start");
val.CheckCompleted = true;
val.IsCompleted = true;
QuestTest val2 = val;
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Belltown House Mid");
val.CheckCompleted = true;
val.IsCompleted = true;
QuestTest val3 = val;
QuestTest? val4 = null;
QuestTest? extraQuestTest = null;
ConsumableGroups consumableGroups;
string text2;
string text3;
switch ((VendorID)i)
{
case VendorID.ForgeDaughter:
consumableGroups = ConsumableGroups.Shards;
text2 = "UI";
text3 = "Forge";
text = "FORGE_SHARD_POUCH_DESC";
break;
case VendorID.Frey:
consumableGroups = ConsumableGroups.Both;
text2 = "UI";
text3 = "Belltown";
desc = "SHOP_ITEM_ROSARYSTRING_M_DESC";
text = "SHOP_ITEM_SHARD_POUCH";
val4 = new QuestTest
{
Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Save Courier Short"),
CheckCompleted = true,
IsCompleted = true
};
extraQuestTest = val4;
break;
case VendorID.Grindle:
consumableGroups = ConsumableGroups.Rosaries;
text2 = "UI";
text3 = "Wanderers";
desc = "GRINDLE_ITEM_ROSARY_STRING";
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Citadel Ascent Lift");
val.CheckCompleted = true;
val.IsCompleted = true;
val2 = val;
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Black Thread Pt0");
val.CheckAccepted = true;
val.IsAccepted = true;
val3 = val;
break;
case VendorID.Jubilina:
consumableGroups = ConsumableGroups.Rosaries;
text2 = "UI";
text3 = "Enclave";
desc = "CITY_MERCHANT_ITEM_ROSARYSTRING";
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Songclave Donation 1");
val.CheckCompleted = true;
val.IsCompleted = true;
val2 = val;
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Songclave Donation 2");
val.CheckCompleted = true;
val.IsCompleted = true;
val3 = val;
break;
case VendorID.Mort:
consumableGroups = ConsumableGroups.Both;
text2 = "UI";
text3 = "Wilds";
desc = "PILGRIM_REST_SHOP_ITEM_DESC_COINSET_S";
text = "PILGRIM_REST_SHOP_ITEM_DESC_SHARD_POUCH";
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Courier Delivery Pilgrims Rest");
val.CheckWasEverCompleted = true;
val.WasEverCompleted = true;
val2 = val;
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Courier Delivery Pilgrims Rest");
val.CheckWasEverCompleted = true;
val.WasEverCompleted = true;
val3 = val;
extraQuestTest = new QuestTest
{
Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Courier Delivery Pilgrims Rest"),
CheckWasEverCompleted = true,
WasEverCompleted = true
};
break;
case VendorID.MottledSkarr:
consumableGroups = ConsumableGroups.Shards;
text2 = "UI";
text3 = "Wilds";
text = "ANT_MERCHANT_SHARD_POUCH_DESC";
break;
case VendorID.Pebb:
consumableGroups = ConsumableGroups.Rosaries;
text2 = "UI";
text3 = "Bonebottom";
desc = "BB_SHOPKEEP_ITEM_ROSARY_SET_DESC";
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Courier Delivery Bonebottom");
val.CheckWasEverCompleted = true;
val.WasEverCompleted = true;
val2 = val;
val = default(QuestTest);
val.Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Skull King");
val.CheckCompleted = true;
val.IsCompleted = true;
val3 = val;
break;
case VendorID.TwelfthArchitect:
consumableGroups = ConsumableGroups.Shards;
text2 = "UI";
text3 = "Under";
text = "ARCHITECT_SHOP_DESC_SHARDPOUCH";
break;
default:
Logger.LogWarning((object)$"No case set up for VendorID \"{(VendorID)i}\" ({i}), skipping...");
continue;
}
if (consumableGroups == ConsumableGroups.Rosaries || consumableGroups == ConsumableGroups.Both)
{
ShopItems[0, i] = CreateShopItem("INV_NAME_COIN_SET_F", text2, desc, text3, sellPriceConfig[0].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Rosary_Set_Frayed"), null, null, val4);
ShopItems[1, i] = CreateShopItem("INV_NAME_COIN_SET_S", text2, desc, text3, sellPriceConfig[1].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Rosary_Set_Small"), null, null, val4);
ShopItems[2, i] = CreateShopItem("INV_NAME_COIN_SET_M", text2, desc, text3, sellPriceConfig[2].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Rosary_Set_Medium"), (QuestTest[])(object)new QuestTest[1]
{
new QuestTest
{
Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "The Threadspun Town"),
CheckCompleted = true,
IsCompleted = true
}
}, null, val4);
ShopItems[3, i] = CreateShopItem("INV_NAME_COIN_SET_M2", text2, desc, text3, sellPriceConfig[3].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Rosary_Set_Large"), (QuestTest[])(object)new QuestTest[1] { val2 }, null, val4);
ShopItems[4, i] = CreateShopItem("INV_NAME_COIN_SET_L", text2, desc, text3, sellPriceConfig[4].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Rosary_Set_Huge_White"), (QuestTest[])(object)new QuestTest[2] { val3, val2 }, null, val4);
}
if (consumableGroups == ConsumableGroups.Shards || consumableGroups == ConsumableGroups.Both)
{
ShopItems[5, i] = CreateShopItem("INV_NAME_SHARD_POUCH", text2, text, text3, sellPriceConfig[5].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Shard Pouch"), null, null, extraQuestTest);
ShopItem[,] shopItems = ShopItems;
int num = i;
string nameSheet = text2;
string desc2 = text;
string descSheet = text3;
int value = sellPriceConfig[6].Value;
CollectableItem itemByName = CollectableItemManager.GetItemByName("Great Shard");
PlayerDataTest val5 = new PlayerDataTest();
val5.TestGroups = (TestGroup[])(object)new TestGroup[1]
{
new TestGroup
{
Tests = (Test[])(object)new Test[1]
{
new Test
{
Type = (TestType)0,
FieldName = "act2Started",
NumType = (NumTestType)0,
BoolValue = true
}
}
}
};
shopItems[6, num] = CreateShopItem("INV_NAME_GREAT_SHARD", nameSheet, desc2, descSheet, value, (SavedItem)(object)itemByName, null, val5, extraQuestTest);
ShopItem[,] shopItems2 = ShopItems;
int num2 = i;
string nameSheet2 = text2;
string desc3 = text;
string descSheet2 = text3;
int value2 = sellPriceConfig[7].Value;
CollectableItem itemByName2 = CollectableItemManager.GetItemByName("Pristine Core");
val5 = new PlayerDataTest();
val5.TestGroups = (TestGroup[])(object)new TestGroup[1]
{
new TestGroup
{
Tests = (Test[])(object)new Test[2]
{
new Test
{
Type = (TestType)0,
FieldName = "HasMelodyArchitect",
NumType = (NumTestType)0,
BoolValue = true
},
new Test
{
Type = (TestType)0,
FieldName = "MetArchitect",
NumType = (NumTestType)0,
BoolValue = true
}
}
}
};
shopItems2[7, num2] = CreateShopItem("INV_NAME_PRISTINE_CORE", nameSheet2, desc3, descSheet2, value2, (SavedItem)(object)itemByName2, null, val5, extraQuestTest);
ShopItems[8, i] = CreateShopItem("INV_NAME_FIXER_IDOL", text2, text, text3, sellPriceConfig[8].Value, (SavedItem)(object)CollectableItemManager.GetItemByName("Fixer Idol"), (QuestTest[])(object)new QuestTest[1]
{
new QuestTest
{
Quest = QuestManager.GetAllFullQuests().First((FullQuestBase q) => ((Object)q).name == "Building Materials (Statue)"),
CheckCompleted = true,
IsCompleted = true
}
}, null, extraQuestTest);
ShopItem[,] shopItems3 = ShopItems;
int num3 = i;
string nameSheet3 = text2;
string desc4 = text;
string descSheet3 = text3;
int value3 = sellPriceConfig[9].Value;
CollectableItem itemByName3 = CollectableItemManager.GetItemByName("Fixer Idol");
val5 = new PlayerDataTest();
val5.TestGroups = (TestGroup[])(object)new TestGroup[1]
{
new TestGroup
{
Tests = (Test[])(object)new Test[1]
{
new Test
{
Type = (TestType)0,
FieldName = "seenBonetownDestroyed",
NumType = (NumTestType)0,
BoolValue = true
}
}
}
};
shopItems3[9, num3] = CreateShopItem("INV_NAME_FIXER_IDOL", nameSheet3, desc4, descSheet3, value3, (SavedItem)(object)itemByName3, null, val5, extraQuestTest);
}
}
Logger.LogInfo((object)"Shop items created");
}
private static ShopItem CreateShopItem(string name, string nameSheet, string desc, string descSheet, int cost, SavedItem item, QuestTest[] questsAppearConditions = null, PlayerDataTest extraAppearConditions = null, QuestTest? extraQuestTest = null)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: 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)
if ((Object)(object)item == (Object)null)
{
Logger.LogError((object)("CreateShopItem \"" + name + "\" - SavedItem parameter is null"));
return null;
}
Logger.LogInfo((object)$"Creating ${cost} ShopItem \"{name}\" (\"{nameSheet}\"), \"{desc}\" (\"{descSheet}\")");
ShopItem val = ShopItem.CreateTemp(name);
val.displayName = new LocalisedString(nameSheet, name);
val.description = new LocalisedString(descSheet, desc);
val.cost = cost;
val.currencyType = (CurrencyType)0;
val.savedItem = item;
if (extraQuestTest.HasValue)
{
if (questsAppearConditions == null)
{
questsAppearConditions = (QuestTest[])(object)new QuestTest[1] { extraQuestTest.Value };
}
else
{
List<QuestTest> list = questsAppearConditions.ToList();
list.Add(extraQuestTest.Value);
questsAppearConditions = list.ToArray();
}
}
if (questsAppearConditions != null)
{
val.questsAppearConditions = questsAppearConditions;
}
if (extraAppearConditions != null)
{
val.extraAppearConditions = extraAppearConditions;
}
return val;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "MoreConsumablesInShop";
public const string PLUGIN_NAME = "More Consumables In Shop";
public const string PLUGIN_VERSION = "1.0.0";
}
}