Exemple #1
0
        private void GiveItems(On.RoR2.Run.orig_SetupUserCharacterMaster orig, Run run, NetworkUser user)
        {
            orig(run, user);

            if (!DropInConfig.StartWithItems ||
                run.fixedTime < 5f) // Don't try to give items to players who spawn with the server
            {
                return;
            }

            if (DropInConfig.GiveExactItems)
            {
                ItemsHelper.CopyItemsFromRandom(user);
            }
            else
            {
                ItemsHelper.GiveAveragedItems(user, DropInConfig.GiveRedItems, DropInConfig.GiveLunarItems, DropInConfig.GiveBossItems);
            }
        }
Exemple #2
0
        public static string LogDropItemsToFile(string baseFolderPath = null)
        {
            baseFolderPath = baseFolderPath ?? System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "RiskOfRain2Items");

            Directory.CreateDirectory(baseFolderPath);

            foreach (ItemTier itemTier in ItemsHelper.ItemTiers)
            {
                IEnumerable <PickupIndex> items   = ItemsHelper.GetDropListForTier(itemTier, true);
                StringBuilder             builder = new StringBuilder();
                builder.AppendLine("Display Name,Internal Name");
                foreach (PickupIndex item in items)
                {
                    PickupDef pickupDef = PickupCatalog.GetPickupDef(item);
                    // Removing ItemIndex. because its automatically added, and removing commas because we need commas for comma seperated values
                    builder.AppendLine($"{Language.GetString(pickupDef.nameToken).Replace(",","")},{pickupDef.internalName.Replace("ItemIndex.", "")}");
                }
                File.WriteAllText(System.IO.Path.Combine(baseFolderPath, $"{itemTier}.csv"), builder.ToString());
            }

            return(baseFolderPath);
        }
Exemple #3
0
        private void GiveItems(On.RoR2.Run.orig_SetupUserCharacterMaster orig, Run run, NetworkUser user)
        {
            orig(run, user);

            if (!_config.StartWithItems ||
                !run.isServer ||    // If we are not the server don't try to give items, let the server handle it
                run.fixedTime < 5f) // Don't try to give items to players who spawn with the server
            {
                return;
            }

            if (_config.GiveExactItems)
            {
                Debug.Log("Giving exact items");
                ItemsHelper.CopyItemsFromRandom(user);
            }
            else
            {
                Debug.Log("Giving averaged items");
                ItemsHelper.GiveAveragedItems(user, _config.GiveRedItems, _config.GiveLunarItems, _config.GiveBossItems);
            }
        }
Exemple #4
0
 public static void AddInvalidItems(IEnumerable <ItemIndex> items, bool alsoInvalidForCount = false)
 {
     ItemsHelper.AddInvalidItems(items, alsoInvalidForCount);
 }