// Token: 0x06000030 RID: 48 RVA: 0x00004188 File Offset: 0x00002388
        public static StatusEffect MakeBurstOfDivinityPrefab()
        {
            StatusEffect statusEffect = TinyEffectManager.MakeStatusEffectPrefab("Burst of Divinity", "Burst of Divinity", "Reduces the mana cost of spells, but stacks are expended when a spell is casted.", 30f, -1f, StatusEffectFamily.StackBehaviors.StackAll, "Mana Ratio Recovery 3", false, null, null, "com.ehaugw.templarclass");

            statusEffect.OverrideIcon = CustomTextures.CreateSprite(SL.Packs["Templar"].Texture2D["burstOfDivinityIcon"], 0);
            return(statusEffect);
        }
        // Token: 0x0600002F RID: 47 RVA: 0x00004114 File Offset: 0x00002314
        public static StatusEffect MakeSurgeOfDivinityPrefab()
        {
            StatusEffect statusEffect = TinyEffectManager.MakeStatusEffectPrefab("Surge of Divinity", "Surge of Divinity", "Greatly increases Burst of Divinity buildup.", 90f, -1f, StatusEffectFamily.StackBehaviors.Override, "Mana Ratio Recovery 3", false, null, null, "com.ehaugw.templarclass");

            statusEffect.OverrideIcon = CustomTextures.CreateSprite(SL.Packs["Templar"].Texture2D["surgeOfDivinityIcon"], 0);
            return(statusEffect);
        }
Exemple #3
0
        protected internal override Texture2D LoadTexture2D(string relativeDirectory, string file, bool mipmap = false, bool linear = false)
        {
            if (!FileExists(relativeDirectory, file))
            {
                return(null);
            }

            var data = ReadAllBytes(relativeDirectory, file);

            return(CustomTextures.LoadTexture(data, mipmap, linear));
        }
        // Token: 0x06000031 RID: 49 RVA: 0x000041FC File Offset: 0x000023FC
        public static StatusEffect MakeRadiatingPrefab()
        {
            StatusEffect    statusEffect          = TinyEffectManager.MakeStatusEffectPrefab("Radiating", "Radiating", "Damages you and your nearby allies.", 15f, 1f, StatusEffectFamily.StackBehaviors.Override, "Doom", true, 134.ToString(), null, "com.ehaugw.templarclass");
            EffectSignature statusEffectSignature = statusEffect.StatusEffectSignature;
            Radiating       radiating             = TinyEffectManager.MakeFreshObject("Effects", true, true, statusEffectSignature.transform).AddComponent <Radiating>();

            radiating.UseOnce             = false;
            statusEffectSignature.Effects = new List <Effect>
            {
                radiating
            };
            statusEffect.OverrideIcon = CustomTextures.CreateSprite(SL.Packs["Templar"].Texture2D["radiatingIcon"], 0);
            return(statusEffect);
        }
Exemple #5
0
        private static Item NewHellstone(int baseItemID, int newItemId, String name, String desc)
        {
            int totalWeight = CurrencyEffects.ALL[newItemId].Sum(x => x.GetWeight());

            desc += "\n";

            CurrencyEffects.ALL[newItemId].ForEach(x =>
            {
                float chance = (float)x.GetWeight() / (float)totalWeight * 100;

                desc += "\n" + chance + "% to: " + x.Get().GetDescription() + "\n";
            });

            desc += "\n Use when your desired gear is in your pouch (and no other gear there).";

            if (HELLSTONE_OF_ARCANA_ID != newItemId) // this hellstone is used on non magical items, unlike others
            {
                desc += "\n Only works on Magical items.";
            }
            else
            {
                desc += "\n Only works on Non Magical items.";
            }

            var template = new SL_Item()
            {
                Name          = name,
                Description   = desc,
                Target_ItemID = baseItemID,
                New_ItemID    = newItemId,
                Tags          = new string[]

                {
                    TagSourceManager.Valuable.TagName
                },
                IsUsable = true
            };

            var item = CustomItems.CreateCustomItem(template);

            var effects = item.transform.Find("Effects");

            if (effects == null)
            {
                // If the item doesn't have "Effects", just add it.
                effects = new GameObject("Effects").transform;
                effects.transform.parent = item.transform;
                // If you didn't use CreateCustomItem, you'd need to call DontDestroyOnLoad(gaberries.gameObject);
            }
            CurrencyEffectComponent eff = effects.gameObject.AddComponent <CurrencyEffectComponent>();

            UnityEngine.Object.DontDestroyOnLoad(eff);

            var png    = CustomTextures.LoadTexture(@"BepInEx\plugins\Grindward\Icons\" + newItemId + ".png", false, false);
            var sprite = CustomTextures.CreateSprite(png, CustomTextures.SpriteBorderTypes.ItemIcon);

            CustomItemVisuals.SetSpriteLink(item, sprite);

            At.SetValue(sprite, typeof(Item), item, "m_itemIcon");

            return(item);
        }
Exemple #6
0
        /// <summary>
        /// Baut ein Terrain-Modell
        /// </summary>
        /// <param name="name">Name des Modells</param>
        /// <param name="heightmap">Height Map Textur</param>
        /// <param name="texture">Textur der Oberfläche</param>
        /// <param name="width">Breite</param>
        /// <param name="height">Höhe</param>
        /// <param name="depth">Tiefe</param>
        /// <param name="texRepeatX">Texturwiederholung Breite</param>
        /// <param name="texRepeatZ">Texturwiederholung Tiefe</param>
        /// <param name="isFile">false, wenn die Texturen Teil der EXE sind (Eingebettete Ressource)</param>
        public static void BuildTerrainModel(string name, string heightmap, string texture, float width, float height, float depth, float texRepeatX = 1, float texRepeatZ = 1, bool isFile = true)
        {
            if (Models.ContainsKey(name))
            {
                throw new Exception("There already is a model with that name. Please choose a different name.");
            }
            GeoModel terrainModel = new GeoModel();

            terrainModel.Name    = name;
            terrainModel.Meshes  = new Dictionary <string, GeoMesh>();
            terrainModel.IsValid = true;

            GeoMeshHitbox meshHitBox = new GeoMeshHitbox(0 + width / 2, 0 + height / 2, 0 + depth / 2, 0 - width / 2, 0 - height / 2, 0 - depth / 2);

            meshHitBox.Model = terrainModel;
            meshHitBox.Name  = name;

            terrainModel.MeshHitboxes = new List <GeoMeshHitbox>();
            terrainModel.MeshHitboxes.Add(meshHitBox);

            GeoTerrain t           = new GeoTerrain();
            GeoMesh    terrainMesh = t.BuildTerrain(new Vector3(0, 0, 0), heightmap, width, height, depth, texRepeatX, texRepeatZ, isFile);

            terrainMesh.Terrain = t;
            GeoMaterial mat = new GeoMaterial();

            mat.BlendMode     = OpenTK.Graphics.OpenGL4.BlendingFactor.OneMinusSrcAlpha;
            mat.ColorDiffuse  = new Vector4(1, 1, 1, 1);
            mat.ColorEmissive = new Vector4(0, 0, 0, 0);
            mat.Name          = name + "-Material";
            mat.SpecularArea  = 512;
            mat.SpecularPower = 0;

            GeoTexture texDiffuse = new GeoTexture(name + "-TextureDiffuse");

            texDiffuse.Filename    = texture;
            texDiffuse.Type        = GeoTexture.TexType.Diffuse;
            texDiffuse.UVMapIndex  = 0;
            texDiffuse.UVTransform = new Vector2(texRepeatX, texRepeatZ);

            bool dictFound = CustomTextures.TryGetValue(CurrentWorld, out Dictionary <string, int> texDict);

            if (dictFound && texDict.ContainsKey(texture))
            {
                texDiffuse.OpenGLID = texDict[texture];
            }
            else
            {
                texDiffuse.OpenGLID = isFile ? HelperTexture.LoadTextureForModelExternal(texture) : HelperTexture.LoadTextureForModelInternal(texture);
                if (dictFound)
                {
                    texDict.Add(texture, texDiffuse.OpenGLID);
                }
            }
            mat.TextureDiffuse = texDiffuse;


            terrainMesh.Material = mat;
            terrainModel.Meshes.Add("Terrain", terrainMesh);
            KWEngine.Models.Add(name, terrainModel);
        }
Exemple #7
0
        /// <summary>
        /// Baut ein Terrain-Modell
        /// </summary>
        /// <param name="name">Name des Modells</param>
        /// <param name="heightmap">Height Map Textur</param>
        /// <param name="texture">Textur der Oberfläche</param>
        /// <param name="width">Breite</param>
        /// <param name="height">Höhe</param>
        /// <param name="depth">Tiefe</param>
        /// <param name="texRepeatX">Texturwiederholung Breite</param>
        /// <param name="texRepeatZ">Texturwiederholung Tiefe</param>
        /// <param name="isFile">false, wenn die Texturen Teil der EXE sind (Eingebettete Ressource)</param>
        public static void BuildTerrainModel(string name, string heightmap, string texture, float width, float height, float depth, float texRepeatX = 1, float texRepeatZ = 1, bool isFile = true)
        {
            if (Models.ContainsKey(name))
            {
                HelperGeneral.ShowErrorAndQuit("KWEngine::BuildTerrainModel()", "There already is a model with that name. Please choose a different name.");
                return;
            }
            GeoModel terrainModel = new GeoModel();

            terrainModel.Name    = name;
            terrainModel.Meshes  = new Dictionary <string, GeoMesh>();
            terrainModel.IsValid = true;

            GeoMeshHitbox meshHitBox = new GeoMeshHitbox(0 + width / 2, 0 + height / 2, 0 + depth / 2, 0 - width / 2, 0 - height / 2, 0 - depth / 2, null);

            meshHitBox.Model = terrainModel;
            meshHitBox.Name  = name;

            terrainModel.MeshHitboxes = new List <GeoMeshHitbox>();
            terrainModel.MeshHitboxes.Add(meshHitBox);

            GeoTerrain t           = new GeoTerrain();
            GeoMesh    terrainMesh = t.BuildTerrain2(new Vector3(0, 0, 0), heightmap, width, height, depth, texRepeatX, texRepeatZ, isFile);

            terrainMesh.Terrain = t;
            GeoMaterial mat = new GeoMaterial();

            mat.BlendMode     = BlendingFactor.OneMinusSrcAlpha;
            mat.ColorAlbedo   = new Vector4(1, 1, 1, 1);
            mat.ColorEmissive = new Vector4(0, 0, 0, 0);
            mat.Opacity       = 1;
            mat.Metalness     = 0;
            mat.Roughness     = 1;

            GeoTexture texDiffuse = new GeoTexture();

            texDiffuse.Filename    = texture;
            texDiffuse.Type        = TextureType.Albedo;
            texDiffuse.UVMapIndex  = 0;
            texDiffuse.UVTransform = new Vector2(texRepeatX, texRepeatZ);

            bool dictFound = CustomTextures.TryGetValue(CurrentWorld, out Dictionary <string, int> texDict);

            if (dictFound && texDict.ContainsKey(texture))
            {
                texDiffuse.OpenGLID = texDict[texture];
            }
            else
            {
                int texId = isFile ? HelperTexture.LoadTextureForModelExternal(texture) : HelperTexture.LoadTextureForModelInternal(texture);
                texDiffuse.OpenGLID = texId > 0 ? texId : KWEngine.TextureDefault;

                if (dictFound && texId > 0)
                {
                    texDict.Add(texture, texDiffuse.OpenGLID);
                }
            }
            mat.TextureAlbedo = texDiffuse;


            terrainMesh.Material = mat;
            terrainModel.Meshes.Add("Terrain", terrainMesh);
            KWEngine.Models.Add(name, terrainModel);
        }