Exemplo n.º 1
0
        private void Awake()
        {
            _magicRarityColor           = Config.Bind("Item Colors", "Magic Rarity Color", "Blue", "The color of Magic rarity items, the lowest magic item tier. (Optional, use an HTML hex color starting with # to have a custom color.) Available options: Red, Orange, Yellow, Green, Teal, Blue, Indigo, Purple, Pink, Gray");
            _magicMaterialIconColor     = Config.Bind("Item Colors", "Magic Crafting Material Icon Index", 5, "Indicates the color of the icon used for magic crafting materials. A number between 0 and 9. Available options: 0=Red, 1=Orange, 2=Yellow, 3=Green, 4=Teal, 5=Blue, 6=Indigo, 7=Purple, 8=Pink, 9=Gray");
            _rareRarityColor            = Config.Bind("Item Colors", "Rare Rarity Color", "Yellow", "The color of Rare rarity items, the second magic item tier. (Optional, use an HTML hex color starting with # to have a custom color.) Available options: Red, Orange, Yellow, Green, Teal, Blue, Indigo, Purple, Pink, Gray");
            _rareMaterialIconColor      = Config.Bind("Item Colors", "Rare Crafting Material Icon Index", 2, "Indicates the color of the icon used for rare crafting materials. A number between 0 and 9. Available options: 0=Red, 1=Orange, 2=Yellow, 3=Green, 4=Teal, 5=Blue, 6=Indigo, 7=Purple, 8=Pink, 9=Gray");
            _epicRarityColor            = Config.Bind("Item Colors", "Epic Rarity Color", "Purple", "The color of Epic rarity items, the third magic item tier. (Optional, use an HTML hex color starting with # to have a custom color.) Available options: Red, Orange, Yellow, Green, Teal, Blue, Indigo, Purple, Pink, Gray");
            _epicMaterialIconColor      = Config.Bind("Item Colors", "Epic Crafting Material Icon Index", 7, "Indicates the color of the icon used for epic crafting materials. A number between 0 and 9. Available options: 0=Red, 1=Orange, 2=Yellow, 3=Green, 4=Teal, 5=Blue, 6=Indigo, 7=Purple, 8=Pink, 9=Gray");
            _legendaryRarityColor       = Config.Bind("Item Colors", "Legendary Rarity Color", "Teal", "The color of Legendary rarity items, the highest magic item tier. (Optional, use an HTML hex color starting with # to have a custom color.) Available options: Red, Orange, Yellow, Green, Teal, Blue, Indigo, Purple, Pink, Gray");
            _legendaryMaterialIconColor = Config.Bind("Item Colors", "Legendary Crafting Material Icon Index", 4, "Indicates the color of the icon used for legendary crafting materials. A number between 0 and 9. Available options: 0=Red, 1=Orange, 2=Yellow, 3=Green, 4=Teal, 5=Blue, 6=Indigo, 7=Purple, 8=Pink, 9=Gray");
            _setItemColor                = Config.Bind("Item Colors", "Set Item Color", "#26ffff", "The color of set item text and the set item icon. Use a hex color, default is cyan");
            _magicRarityDisplayName      = Config.Bind("Rarity", "Magic Rarity Display Name", "Magic", "The name of the lowest rarity.");
            _rareRarityDisplayName       = Config.Bind("Rarity", "Rare Rarity Display Name", "Rare", "The name of the second rarity.");
            _epicRarityDisplayName       = Config.Bind("Rarity", "Epic Rarity Display Name", "Epic", "The name of the third rarity.");
            _legendaryRarityDisplayName  = Config.Bind("Rarity", "Legendary Rarity Display Name", "Legendary", "The name of the highest rarity.");
            UseScrollingCraftDescription = Config.Bind("Crafting UI", "Use Scrolling Craft Description", true, "Changes the item description in the crafting panel to scroll instead of scale when it gets too long for the space.");
            _gatedItemTypeModeConfig     = Config.Bind("Balance", "Item Drop Limits", GatedItemTypeMode.MustKnowRecipe, "Sets how the drop system limits what item types can drop. Unlimited: no limits, exactly what's in the loot table will drop. MustKnowRecipe: items will drop so long as the player has discovered their recipe. MustHaveCrafted: items will only drop once the player has crafted one or picked one up. If an item type cannot drop, it will downgrade to an item of the same type and skill that the player has unlocked (i.e. swords will stay swords)");

            MagicItemEffectDefinitions.Initialize(LoadJsonFile <MagicItemEffectsList>("magiceffects.json"));
            LootRoller.Initialize(LoadJsonFile <LootConfig>("loottables.json"));
            GatedItemTypeHelper.Initialize(LoadJsonFile <ItemInfoConfig>("iteminfo.json"));
            RecipesHelper.Initialize(LoadJsonFile <RecipesConfig>("recipes.json"));
            PrintInfo();

            LoadAssets();

            ExtendedItemData.LoadExtendedItemData += SetupTestMagicItem;
            ExtendedItemData.LoadExtendedItemData += MagicItemComponent.OnNewExtendedItemData;
            ExtendedItemData.NewExtendedItemData  += MagicItemComponent.OnNewExtendedItemData;

            _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), PluginId);

            LootTableLoaded?.Invoke();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static void InitializeConfig()
 {
     LootRoller.Initialize(_lootConfigFile.Value);
     MagicItemEffectDefinitions.Initialize(_magicEffectsConfigFile.Value);
     GatedItemTypeHelper.Initialize(_itemInfoConfigFile.Value);
     RecipesHelper.Initialize(_recipesConfigFile.Value);
     EnchantCostsHelper.Initialize(_enchantCostsConfigFile.Value);
     MagicItemNames.Initialize(_itemNamesConfigFile.Value);
     AdventureDataManager.Initialize(_adventureDataConfigFile.Value);
 }
Exemplo n.º 4
0
        private static List <GameObject> RollLootTableInternal(LootTable lootTable, int level, string objectName, Vector3 dropPoint, bool initializeObject)
        {
            var results = new List <GameObject>();

            if (lootTable == null || level <= 0 || string.IsNullOrEmpty(objectName))
            {
                return(results);
            }

            var drops = GetDropsForLevel(lootTable, level);

            if (ArrayUtils.IsNullOrEmpty(drops))
            {
                return(results);
            }

            if (EpicLoot.AlwaysDropCheat)
            {
                drops = drops.Where(x => x.Length > 0 && x[0] != 0).ToArray();
            }

            _weightedDropCountTable.Setup(drops, dropPair => dropPair.Length == 2 ? dropPair[1] : 1);
            var dropCountRollResult = _weightedDropCountTable.Roll();
            var dropCount           = dropCountRollResult != null && dropCountRollResult.Length >= 1 ? dropCountRollResult[0] : 0;

            if (dropCount == 0)
            {
                return(results);
            }

            var loot = GetLootForLevel(lootTable, level);

            _weightedLootTable.Setup(loot, x => x.Weight);
            var selectedDrops = _weightedLootTable.Roll(dropCount);

            foreach (var ld in selectedDrops)
            {
                var lootDrop = ResolveLootDrop(ld, ld.Rarity);
                var itemID   = GatedItemTypeHelper.GetGatedItemID(lootDrop.Item);

                var itemPrefab = ObjectDB.instance.GetItemPrefab(itemID);
                if (itemPrefab == null)
                {
                    Debug.LogError($"Tried to spawn loot ({itemID}) for ({objectName}), but the item prefab was not found!");
                    continue;
                }

                var randomRotation = Quaternion.Euler(0.0f, Random.Range(0.0f, 360.0f), 0.0f);
                ZNetView.m_forceDisableInit = !initializeObject;
                var item = Object.Instantiate(itemPrefab, dropPoint, randomRotation);
                ZNetView.m_forceDisableInit = false;
                var itemDrop = item.GetComponent <ItemDrop>();
                if (EpicLoot.CanBeMagicItem(itemDrop.m_itemData) && !ArrayUtils.IsNullOrEmpty(lootDrop.Rarity))
                {
                    var itemData           = new ExtendedItemData(itemDrop.m_itemData);
                    var magicItemComponent = itemData.AddComponent <MagicItemComponent>();
                    var magicItem          = RollMagicItem(lootDrop, itemData);
                    magicItemComponent.SetMagicItem(magicItem);

                    itemDrop.m_itemData = itemData;
                    InitializeMagicItem(itemData);
                    MagicItemGenerated?.Invoke(itemData, magicItem);
                }

                results.Add(item);
            }

            return(results);
        }