private List <SecretStashItemInfo> GetAvailableGambles() { var availableGambles = new List <SecretStashItemInfo>(); foreach (var itemConfig in AdventureDataManager.Config.Gamble.Gambles) { var gatingMode = EpicLoot.GetGatedItemTypeMode(); if (gatingMode == GatedItemTypeMode.Unlimited) { gatingMode = GatedItemTypeMode.MustKnowRecipe; } var itemId = GatedItemTypeHelper.GetGatedItemID(itemConfig, gatingMode); var itemDrop = CreateItemDrop(itemId); if (itemDrop == null) { EpicLoot.LogWarning($"[AdventureData] Could not find item type (gated={itemId} orig={itemConfig}) in ObjectDB!"); continue; } var itemData = itemDrop.m_itemData; var cost = GetGambleCost(itemId); availableGambles.Add(new SecretStashItemInfo(itemId, itemData, cost, true)); Object.Destroy(itemDrop.gameObject); } return(availableGambles); }
public static string GetGatedItemID(string itemID) { if (string.IsNullOrEmpty(itemID)) { Debug.LogError($"Tried to get gated itemID with null or empty itemID!"); return(null); } var mode = EpicLoot.GetGatedItemTypeMode(); if (mode == GatedItemTypeMode.Unlimited) { return(itemID); } var player = Player.m_localPlayer; if (player == null) { Debug.LogError($"Tried to get gated itemID ({itemID}) with null player!"); return(null); } if (ObjectDB.instance == null || ObjectDB.instance.m_items.Count == 0) { Debug.LogError($"Tried to get gated itemID ({itemID}) but ObjectDB is not initialized!"); return(null); } if (!ItemInfoByID.TryGetValue(itemID, out var info)) { Debug.LogWarning($"Tried to get gated itemID from itemID ({itemID}), but no data exists for it in iteminfo.json. Returning itemID."); return(itemID); } var itemName = GetItemName(itemID); if (string.IsNullOrEmpty(itemName)) { return(null); } while (CheckIfItemNeedsGate(player, mode, itemName)) { Debug.Log("Yes..."); var index = info.Items.IndexOf(itemID); if (index < 0) { Debug.LogError($"Something has gone completely wrong, the ItemInfo ({info.Type}) did not contain the itemID ({itemID})."); return(null); } if (index == 0) { Debug.Log($"Reached end of gated list. Fallback is ({info.Fallback}), returning ({(string.IsNullOrEmpty(info.Fallback) ? itemID : info.Fallback)}){(string.IsNullOrEmpty(info.Fallback) ? "" : " (fallback)")}"); return(string.IsNullOrEmpty(info.Fallback) ? itemID : info.Fallback); } itemID = info.Items[index - 1]; itemName = GetItemName(itemID); Debug.Log($"Next lower tier item is ({itemID})"); } Debug.Log($"No, return ({itemID})"); return(itemID); }
public static string GetGatedItemID(string itemID) { return(GetGatedItemID(itemID, EpicLoot.GetGatedItemTypeMode())); }