Esempio n. 1
0
        object OnLootSpawn(LootContainer container)
        {
            if (INIT)
            {
                if (container?.inventory?.itemList == null)
                {
                    return(null);
                }

                if (!IsLootContainerEnabled(container))
                {
                    return(null);
                }

                RepopulateContainer(container);

                // Debug msg
                if (Convert.ToBoolean(Config["DeveloperDebug", "_EnableLogs"]) && Convert.ToBoolean(Config["DeveloperDebug", "LootRefresh"]))
                {
                    string debugs = "Repopulated: " + container.ToString() + " : isLootable[" + container.isLootable + "]"; Puts(debugs);
                }

                if (container.shouldRefreshContents && container.isLootable)
                {
                    // Debug msg
                    if (Convert.ToBoolean(Config["DeveloperDebug", "_EnableLogs"]) && Convert.ToBoolean(Config["DeveloperDebug", "LootRefresh"]))
                    {
                        string debugs = "Invoked refresh on " + container.ToString(); Puts(debugs);
                    }

                    container.Invoke(new Action(container.SpawnLoot), UnityEngine.Random.Range(container.minSecondsBetweenRefresh, container.maxSecondsBetweenRefresh));
                }
                return(container);
            }
            return(null);
        }