Exemplo n.º 1
0
        private void FixupLootTables()
        {
            // Fixup loot tables
            if (Alias == "mining:base_loot_table")
            {
                JsonFileData jsonFileData = FileData as JsonFileData;

                if (JsonHelper.FixupLootTable(jsonFileData.Json, "mineable_blocks.*"))
                {
                    jsonFileData.TrySetFlatFileData(jsonFileData.GetJsonFileString());
                    jsonFileData.TrySaveFile();
                }
            }
            else
            {
                JsonFileData jsonFileData = FileData as JsonFileData;
                if (jsonFileData != null && jsonFileData.Json != null)
                {
                    JToken harvestLootTable = jsonFileData.Json.SelectToken("entity_data.stonehearth:harvest_beast_loot_table");
                    if (harvestLootTable != null)
                    {
                        if (harvestLootTable["entries"] == null)
                        {
                            if (JsonHelper.FixupLootTable(jsonFileData.Json, "entity_data.stonehearth:harvest_beast_loot_table"))
                            {
                                jsonFileData.TrySetFlatFileData(jsonFileData.GetJsonFileString());
                                jsonFileData.TrySaveFile();
                            }
                        }
                    }

                    JToken destroyedLootTable = jsonFileData.Json.SelectToken("entity_data.stonehearth:destroyed_loot_table");
                    if (destroyedLootTable != null)
                    {
                        if (destroyedLootTable["entries"] == null)
                        {
                            if (JsonHelper.FixupLootTable(jsonFileData.Json, "entity_data.stonehearth:destroyed_loot_table"))
                            {
                                jsonFileData.TrySetFlatFileData(jsonFileData.GetJsonFileString());
                                jsonFileData.TrySaveFile();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected void FixupLoot(string selector)
 {
     NodeFile.IsModified = JsonHelper.FixupLootTable(NodeFile.Json, selector);
     NodeFile.SaveIfNecessary();
 }