Beispiel #1
0
        public static void Process(WeaponData weapon)
        {
            var components = WeaponComponentCollection.GetComponentsFromHash(weapon.hash);

            foreach (var component in components)
            {
                if (weapon.components.ContainsKey((uint)component))
                {
                    continue;
                }

                var displayName = WeaponComponent.GetComponentDisplayNameFromHash(weapon.hash, component);
                var name        = "COMPONENT_" +
                                  Enum.GetName(typeof(WeaponComponentHash), component)?.ToUnderscoreCase().ToUpper();
                name = FixNameProcessor.FixWeaponName(name);

                var comp = new WeaponComponentData
                {
                    name               = name,
                    displayName        = displayName,
                    displayDescription = displayName.ReplaceAt(2, 'D')
                };
                comp.Hash();

                if (comp.hash != component)
                {
                    Console.Error("WRONG HASH! -> " + name);
                }

                Main.WeaponStorage.AddWeaponComponent(weapon, comp);
            }
        }
Beispiel #2
0
        public static string GetPath(string path, bool create = false)
        {
            string resultPath = Path.Combine(BasePath, path);

            Console.Info(resultPath);
            if (create)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(resultPath));
            }

            return(resultPath);
        }