Ejemplo n.º 1
0
        /// <summary>
        /// Adds a Buff to the game
        /// </summary>
        /// <param name="Bparam">The Buff data to add to the game</param>
        /// <param name="param">Common object loading parameters</param>
        public static void AddToGame(BuffParameters Bparam, LoadParameters param)
        {
            int type = Defs.buffNextType++;

            if (!Main.dedServ)
            {
                Main.buffTexture.Add(type, Bparam.Texture);
            }

            Defs.buffNames[type] = param.ModBase.modName + ":" + param.Name;
            Defs.buffType[param.ModBase.modName + ":" + param.Name] = type;

            if (!String.IsNullOrEmpty(param.SubClassTypeName))
            {
                Defs.buffs.Add(type, (ModBuff)param.Assembly.CreateInstance(param.SubClassTypeName, false, BindingFlags.Public | BindingFlags.Instance,
                                                                            null, new object[] { param.ModBase }, System.Globalization.CultureInfo.CurrentCulture, new object[] { }));

                if (Defs.buffs[type] != null)
                {
                    Defs.FillCallPriorities(Defs.buffs[type].GetType());
                }
            }

            Array.Resize(ref Main.buffName, Main.buffName.Length + 1);
            Main.buffName[type] = param.Name;
            Array.Resize(ref Main.buffTip, Main.buffTip.Length + 1);
            Main.buffTip[type] = Bparam.Tip;
            Array.Resize(ref Main.debuff, Main.debuff.Length + 1);
            Main.debuff[type] = (Bparam.Type & BuffType.Debuff) == BuffType.Debuff;
            Array.Resize(ref Main.vanityPet, Main.vanityPet.Length + 1);
            Main.vanityPet[type] = Bparam.VanityPet;
            Array.Resize(ref Main.lightPet, Main.lightPet.Length + 1);
            Main.vanityPet[type] = Bparam.LightPet;
            Array.Resize(ref Main.meleeBuff, Main.meleeBuff.Length + 1);
            Main.meleeBuff[type] = (Bparam.Type & BuffType.WeaponBuff) == BuffType.WeaponBuff;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a Buff to the game
        /// </summary>
        /// <param name="Bparam">The Buff data to add to the game</param>
        /// <param name="param">Common object loading parameters</param>
        public static void AddToGame(BuffParameters Bparam, LoadParameters param)
        {
            int type = Defs.buffNextType++;

            if (!Main.dedServ)
                Main.buffTexture.Add(type, Bparam.Texture);

            Defs.buffNames[type] = param.ModBase.modName + ":" + param.Name;
            Defs.buffType[param.ModBase.modName + ":" + param.Name] = type;

            if (!String.IsNullOrEmpty(param.SubClassTypeName))
            {
                Defs.buffs.Add(type, (ModBuff)param.Assembly.CreateInstance(param.SubClassTypeName, false, BindingFlags.Public | BindingFlags.Instance,
                    null, new object[] { param.ModBase }, System.Globalization.CultureInfo.CurrentCulture, new object[] { }));

                if (Defs.buffs[type] != null)
                    Defs.FillCallPriorities(Defs.buffs[type].GetType());
            }

            Array.Resize(ref Main.buffName, Main.buffName.Length + 1);
            Main.buffName[type] = param.Name;
            Array.Resize(ref Main.buffTip, Main.buffTip.Length + 1);
            Main.buffTip[type] = Bparam.Tip;
            Array.Resize(ref Main.debuff, Main.debuff.Length + 1);
            Main.debuff[type] = (Bparam.Type & BuffType.Debuff) == BuffType.Debuff;
            Array.Resize(ref Main.vanityPet, Main.vanityPet.Length + 1);
            Main.vanityPet[type] = Bparam.VanityPet;
            Array.Resize(ref Main.lightPet, Main.lightPet.Length + 1);
            Main.vanityPet[type] = Bparam.LightPet;
            Array.Resize(ref Main.meleeBuff, Main.meleeBuff.Length + 1);
            Main.meleeBuff[type] = (Bparam.Type & BuffType.WeaponBuff) == BuffType.WeaponBuff;
        }