private void DocItems() { if (Generated) { return; } Jotunn.Logger.LogInfo("Documenting items"); AddHeader(1, "Item list"); AddText("All of the items currently in the game, with English localizations applied"); AddText("This file is automatically generated from Valheim using the JotunnDoc mod found on our GitHub."); AddTableHeader("Prefab", "Name", "Type", "Description"); foreach (GameObject obj in ObjectDB.instance.m_items) { ItemDrop item = obj.GetComponent <ItemDrop>(); ItemDrop.ItemData.SharedData shared = item.m_itemData.m_shared; AddTableRow( obj.name, JotunnDoc.Localize(shared.m_name), shared.m_itemType.ToString(), JotunnDoc.Localize(shared.m_description)); } Save(); }
public void docPieces(object sender, EventArgs e) { Debug.Log("Documenting pieces"); AddHeader(1, "Piece list"); AddText("All of the pieces currently in the game."); AddText("This file is automatically generated from Valheim using the JotunnDoc mod found on our GitHub."); AddTableHeader("Piece Table", "Prefab Name", "Piece Name", "Piece Description"); var pieceTables = ReflectionUtils.GetPrivateField <Dictionary <string, PieceTable> >(PieceManager.Instance, "pieceTables"); foreach (var pair in pieceTables) { foreach (GameObject obj in pair.Value.m_pieces) { Piece piece = obj.GetComponent <Piece>(); AddTableRow( pair.Key, obj.name, JotunnDoc.Localize(piece.m_name), JotunnDoc.Localize(piece.m_description)); } } Save(); }
private void DocStatusEffects() { if (Generated) { return; } Jotunn.Logger.LogInfo("Documenting status effects"); AddHeader(1, "Status effect list"); AddText("All of the status effects currently in the game, with English localizations applied"); AddText("This file is automatically generated from Valheim using the JotunnDoc mod found on our GitHub."); AddTableHeader("Object", "Name", "Category"); Dictionary <string, StatusEffect> statusEffects = new Dictionary <string, StatusEffect>(); foreach (GameObject obj in ObjectDB.instance.m_items) { ItemDrop item = obj.GetComponent <ItemDrop>(); ItemDrop.ItemData.SharedData shared = item.m_itemData.m_shared; if (shared.m_attackStatusEffect) { statusEffects[shared.m_attackStatusEffect.name] = shared.m_attackStatusEffect; } if (shared.m_consumeStatusEffect) { statusEffects[shared.m_consumeStatusEffect.name] = shared.m_consumeStatusEffect; } if (shared.m_equipStatusEffect) { statusEffects[shared.m_equipStatusEffect.name] = shared.m_equipStatusEffect; } if (shared.m_setStatusEffect) { statusEffects[shared.m_setStatusEffect.name] = shared.m_setStatusEffect; } } foreach (StatusEffect statusEffect in statusEffects.Values) { AddTableRow( statusEffect.name, JotunnDoc.Localize(statusEffect.m_name), JotunnDoc.Localize(statusEffect.m_category)); } Save(); }
public void docPieces() { if (Generated) { return; } Jotunn.Logger.LogInfo("Documenting pieces"); AddHeader(1, "Piece list"); AddText("All of the pieces currently in the game."); AddText("This file is automatically generated from Valheim using the JotunnDoc mod found on our GitHub."); AddTableHeader("Piece Table", "Prefab Name", "Piece Name", "Piece Description", "Resources required"); var pieceTables = ReflectionHelper.GetPrivateField <Dictionary <string, PieceTable> >(PieceManager.Instance, "PieceTables"); foreach (var pair in pieceTables) { foreach (GameObject obj in pair.Value.m_pieces) { Piece piece = obj.GetComponent <Piece>(); if (piece == null) { continue; } string resources = "<ul>"; foreach (Piece.Requirement req in piece.m_resources) { resources += "<li>" + req.m_amount + " " + JotunnDoc.Localize(req?.m_resItem?.m_itemData?.m_shared?.m_name) + "</li>"; } resources += "</ul>"; AddTableRow( pair.Key, obj.name, JotunnDoc.Localize(piece.m_name), JotunnDoc.Localize(piece.m_description), resources); } } Save(); }
private void DocRecipes() { if (Generated) { return; } Jotunn.Logger.LogInfo("Documenting recipes"); AddHeader(1, "Recipe list"); AddText("All of the recipes currently in the game, with English localizations applied"); AddText("This file is automatically generated from Valheim using the JotunnDoc mod found on our GitHub."); AddTableHeader("Name", "Item name", "Amount", "Resources required"); foreach (Recipe recipe in ObjectDB.instance.m_recipes) { if (recipe == null) { continue; } string resources = "<ul>"; foreach (Piece.Requirement req in recipe.m_resources) { resources += "<li>" + req.m_amount + " " + JotunnDoc.Localize(req?.m_resItem?.m_itemData?.m_shared?.m_name) + "</li>"; } resources += "</ul>"; AddTableRow( recipe.name, JotunnDoc.Localize(recipe?.m_item?.m_itemData?.m_shared?.m_name), recipe.m_amount.ToString(), resources); } Save(); }