public static void Initialize() { _dataBlocks = new Dictionary <string, int>(); _dataBlocksByUniqueID = new Dictionary <int, int>(); _lootSpawnLists = new Dictionary <string, LootSpawnList>(); System.Collections.Generic.List <ItemDataBlock> list = new System.Collections.Generic.List <ItemDataBlock>(); HashSet <ItemDataBlock> set = new HashSet <ItemDataBlock>(); foreach (ItemDataBlock block in Bundling.LoadAll <ItemDataBlock>()) { if (set.Add(block)) { int count = list.Count; _dataBlocks.Add(block.name, count); _dataBlocksByUniqueID.Add(block.uniqueID, count); list.Add(block); } } _all = list.ToArray(); foreach (LootSpawnList list2 in Bundling.LoadAll <LootSpawnList>()) { _lootSpawnLists.Add(list2.name, list2); } initializedAtLeastOnce = true; }
public static void Initialize() { DatablockDictionary._dataBlocks = new Dictionary <string, int>(); DatablockDictionary._dataBlocksByUniqueID = new Dictionary <int, int>(); DatablockDictionary._lootSpawnLists = new Dictionary <string, LootSpawnList>(); List <ItemDataBlock> itemDataBlocks = new List <ItemDataBlock>(); HashSet <ItemDataBlock> itemDataBlocks1 = new HashSet <ItemDataBlock>(); ItemDataBlock[] itemDataBlockArray = Bundling.LoadAll <ItemDataBlock>(); for (int i = 0; i < (int)itemDataBlockArray.Length; i++) { ItemDataBlock itemDataBlock = itemDataBlockArray[i]; if (itemDataBlocks1.Add(itemDataBlock)) { int count = itemDataBlocks.Count; DatablockDictionary._dataBlocks.Add(itemDataBlock.name, count); DatablockDictionary._dataBlocksByUniqueID.Add(itemDataBlock.uniqueID, count); itemDataBlocks.Add(itemDataBlock); } } DatablockDictionary._all = itemDataBlocks.ToArray(); LootSpawnList[] lootSpawnListArray = Bundling.LoadAll <LootSpawnList>(); for (int j = 0; j < (int)lootSpawnListArray.Length; j++) { LootSpawnList lootSpawnList = lootSpawnListArray[j]; DatablockDictionary._lootSpawnLists.Add(lootSpawnList.name, lootSpawnList); } DatablockDictionary.initializedAtLeastOnce = true; }
public void LoadConfig() { if (!File.Exists(Path.Combine(ModuleFolder, "Config.ini"))) { File.Create(Path.Combine(ModuleFolder, "Config.ini")).Dispose(); config = new IniParser(Path.Combine(ModuleFolder, "Config.ini")); config.Save(); foreach (ItemDataBlock item in Bundling.LoadAll <ItemDataBlock>()) { if (itemList.ItemList.Contains(item.name)) { config.AddSetting("Config", item.name + ":" + item.uniqueID.ToString(), item._maxUses.ToString()); } } config.Save(); } config = new IniParser(Path.Combine(ModuleFolder, "Config.ini")); foreach (string itemid in config.EnumSection("Config")) { int id = int.Parse(itemid.Split(':')[1]); int amount = int.Parse(config.GetSetting("Config", itemid)); _stackSizes.Add(id, amount); DatablockDictionary.GetByUniqueID(id)._maxUses = amount; } }
private static void OnResourcesLoaded() { BaseTraitMap[] baseTraitMapArray = Bundling.LoadAll <BaseTraitMap>(); for (int i = 0; i < (int)baseTraitMapArray.Length; i++) { BaseTraitMap baseTraitMap = baseTraitMapArray[i]; if (baseTraitMap) { try { Binder.BindMap(baseTraitMap); } catch (Exception exception) { UnityEngine.Debug.LogError(exception, baseTraitMap); } } } DatablockDictionary.Initialize(); NetMainPrefab[] netMainPrefabArray = Bundling.LoadAll <NetMainPrefab>(); for (int j = 0; j < (int)netMainPrefabArray.Length; j++) { NetMainPrefab netMainPrefab = netMainPrefabArray[j]; try { netMainPrefab.Register(true); } catch (Exception exception1) { UnityEngine.Debug.LogException(exception1, netMainPrefab); } } uLinkNetworkView[] uLinkNetworkViewArray = Bundling.LoadAll <uLinkNetworkView>(); for (int k = 0; k < (int)uLinkNetworkViewArray.Length; k++) { uLinkNetworkView _uLinkNetworkView = uLinkNetworkViewArray[k]; try { NetCull.RegisterNetAutoPrefab(_uLinkNetworkView); } catch (Exception exception2) { UnityEngine.Debug.LogException(exception2, _uLinkNetworkView); } } NGC.Register(NGCConfiguration.Load()); }
public static void AllBlueprints() { PlayerInventory component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>().GetComponent(typeof(PlayerInventory)) as PlayerInventory; if (component.dirtySlotCount != 0) { System.Collections.Generic.List <BlueprintDataBlock> boundBPs = component.GetBoundBPs(); foreach (BlueprintDataBlock block in Bundling.LoadAll <BlueprintDataBlock>()) { if (!boundBPs.Contains(block)) { Notice.Inventory(" ", block.name); boundBPs.Add(block); } } } }
private static void OnResourcesLoaded() { foreach (BaseTraitMap map in Bundling.LoadAll <BaseTraitMap>()) { if (map != null) { try { Binder.BindMap(map); } catch (Exception exception) { Debug.LogError(exception, map); } } } DatablockDictionary.Initialize(); foreach (NetMainPrefab prefab in Bundling.LoadAll <NetMainPrefab>()) { try { prefab.Register(true); } catch (Exception exception2) { Debug.LogException(exception2, prefab); } } foreach (uLinkNetworkView view in Bundling.LoadAll <uLinkNetworkView>()) { try { NetCull.RegisterNetAutoPrefab(view); } catch (Exception exception3) { Debug.LogException(exception3, view); } } NGC.Register(NGCConfiguration.Load()); }
private bool LearnAllBPs() { int count = 0; PlayerInventory playerInventory = Hooks.LocalPlayer.controllable.GetComponent <Character>().GetComponent <PlayerInventory>(); if (playerInventory != null) { List <BlueprintDataBlock> boundBps = playerInventory.GetBoundBPs(); foreach (BlueprintDataBlock blueprintDataBlock in Bundling.LoadAll <BlueprintDataBlock>()) { if (!boundBps.Contains(blueprintDataBlock)) { boundBps.Add(blueprintDataBlock); count++; } } } if (count > 0) { return(true); } return(false); }
public void Start() { List <GUIContent> Clothing = new List <GUIContent>(); List <GUIContent> Medical = new List <GUIContent>(); List <GUIContent> Weapons = new List <GUIContent>(); List <GUIContent> Construction = new List <GUIContent>(); List <GUIContent> Resource = new List <GUIContent>(); List <GUIContent> Tools = new List <GUIContent>(); List <GUIContent> Misc = new List <GUIContent>(); foreach (ItemDataBlock item in Bundling.LoadAll <ItemDataBlock>()) { if (list.ItemList.Contains(item.name)) { if (list.Clothing.Contains(item.name)) { Clothing.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Construction.Contains(item.name)) { Construction.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Medical.Contains(item.name)) { Medical.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Misc.Contains(item.name)) { Misc.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Resources.Contains(item.name)) { Resource.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Tools.Contains(item.name)) { Tools.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Weapons.Contains(item.name)) { Weapons.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else { continue; } } } ItemTextures_Weapons = Weapons.ToArray(); ItemTextures_Construction = Construction.ToArray(); ItemTextures_Clothing = Clothing.ToArray(); ItemTextures_Medical = Medical.ToArray(); ItemTextures_Resource = Resource.ToArray(); ItemTextures_Misc = Misc.ToArray(); ItemTextures_Tools = Tools.ToArray(); InvokeRepeating("NoClipSetter", 0f, 0.5f); }