public static DM_Merchant ParseMerchant(Merchant merchant) { var merchantHolder = new DM_Merchant { Name = merchant.ShopName?.Trim(), UID = merchant.HolderUID }; if (At.GetField(merchant, "m_dropableInventory") is Dropable dropper) { merchantHolder.DropTable = DM_DropTable.ParseDropable(dropper, merchant); } foreach (var priceMod in merchant.GetComponentsInChildren <PriceModifier>()) { if (priceMod.BuyMultiplierAdded != 0f || priceMod.SellMultiplierAdded != 0f) { //SL.Log("Merchant " + merchantHolder.Name + " has buy or sell mods! Buy: " + priceMod.BuyMultiplierAdded + ", Sell: " + priceMod.SellMultiplierAdded); merchantHolder.BuyModifiers.Add(priceMod.BuyMultiplierAdded); merchantHolder.SellModifiers.Add(priceMod.SellMultiplierAdded); } } string dir = Serializer.Folders.Merchants; string saveName = SceneManager.Instance.GetCurrentLocation(merchant.transform.position) + " - " + merchantHolder.Name + " (" + merchantHolder.UID + ")"; if (ListManager.Merchants.ContainsKey(saveName)) { return(null); } Serializer.SaveToXml(dir, saveName, merchantHolder); ListManager.Merchants.Add(saveName, merchantHolder); return(merchantHolder); }
internal void Update() { if (Input.GetKeyDown(KeyCode.F11)) { DM_Enemy.ParseAllEnemies(); //StartCoroutine(ForceSpawnAllBuildings()); } if (Input.GetKeyDown(KeyCode.ScrollLock)) { DM_Merchant.ParseAllMerchants(); } if (Input.GetKeyDown(KeyCode.Pause)) { if (!m_parsing) { if (CharacterManager.Instance.GetFirstLocalCharacter() != null) { SL.Log("___________ Starting Scenes Parse ___________"); m_coroutine = StartCoroutine(ParseCoroutine()); m_parsing = true; } } else { m_parsing = false; if (m_coroutine != null) { SL.Log("___________ Stopping Scenes Parse ___________"); StopCoroutine(m_coroutine); } } } }
private IEnumerator ParseCoroutine() { foreach (string sceneName in SceneHelper.SceneBuildNames.Keys) { /* Load Scene */ if (SceneManagerHelper.ActiveSceneName != sceneName) { SL.Log("--- Loading " + sceneName + " ---"); NetworkLevelLoader.Instance.RequestSwitchArea(sceneName, 0, 1.5f); yield return(new WaitForSeconds(5f)); while (NetworkLevelLoader.Instance.IsGameplayPaused || NetworkLevelLoader.Instance.InLoading) { NetworkLevelLoader loader = NetworkLevelLoader.Instance; At.SetField(loader, "m_continueAfterLoading", true); yield return(new WaitForSeconds(1f)); } yield return(new WaitForSeconds(2f)); MenuManager.Instance.HideMasterLoadingScreen(); } SL.Log("Parsing scene " + sceneName + "..."); /* Parse Scene */ //// Disable the TreeBehaviour Managers while we do stuff with enemies //DisableCanvases(); // Parse Enemies SL.Log("Parsing enemies"); DM_Enemy.ParseAllEnemies(); // Parse Merchants SL.Log("Parsing merchants"); DM_Merchant.ParseAllMerchants(); // Parse Loot (+ item sources) SL.Log("Parsing loot"); ParseAllLoot(); // check if New Sirocco if (SceneManagerHelper.ActiveSceneName == "NewSirocco") { SL.LogWarning("NEW SIROCCO: Dumping all buildings..."); StartCoroutine(DatamineBuildings()); while (!s_doneBuildings) { yield return(null); } ClearScene(); yield return(new WaitForSeconds(1f)); } SL.Log("--- Finished Scene: " + SceneManagerHelper.ActiveSceneName + " ---"); } SL.Log("___________ Finished Scenes Parse ___________"); SL.Log("[Dataminer] Saving lists..."); ListManager.SaveLists(); SL.Log("[Dataminer] Finished."); }
private IEnumerator DatamineBuildings() { var player = CharacterManager.Instance.GetFirstLocalCharacter(); var buildingsObj = GameObject.Find("Buildings"); var buildings = References.RPM_ITEM_PREFABS.Values.Where(it => it is Building); //var created = new List<Building>(); foreach (Building prefab in buildings) { SL.Log("Checking prefab " + prefab.ItemID + ": " + prefab.Name); if (!(At.GetField(prefab, "m_upgradePhases") is Building.ConstructionPhase[] upgrades)) { SL.Log("m_upgradePhases was null"); continue; } ClearScene(); yield return(new WaitForSeconds(1f)); MakeBuilding(prefab); yield return(new WaitForSeconds(1f)); DM_Merchant.ParseAllMerchants(); ParseAllLoot(); ClearScene(); yield return(new WaitForSeconds(1f)); if (upgrades.Length > 0) { for (int i = 0; i < upgrades.Length; i++) { MakeBuilding(prefab, i); yield return(new WaitForSeconds(1f)); DM_Merchant.ParseAllMerchants(); ParseAllLoot(); ClearScene(); yield return(new WaitForSeconds(1f)); } } } yield return(new WaitForSeconds(1f)); s_doneBuildings = true; GameObject MakeBuilding(Building prefab, int upgradePhase = -1) { var building = ItemManager.Instance.GenerateItemNetwork(prefab.ItemID) as Building; At.SetField(building, "m_currentUpgradePhaseIndex", upgradePhase); At.SetField(building, "m_remainingConstructionTime", 0); At.SetField(building, "m_pendingUpgradePhaseIndex", -1); building.UpdateConstruction(0f); //At.Invoke(building, "ActivateLevelVisuals", Enumerable.Empty<Type>()); building.transform.parent = buildingsObj.transform; //building.transform.position = player.transform.position; //created.Add(building); SL.LogWarning("Activated building " + building.Name + " (" + building.ItemID + "), phase: " + upgradePhase); return(building.gameObject); } }