示例#1
0
 public static void OnNetDefaults(ref int nettype, Item item)
 {
     if (ItemHooks.NetDefaults == null)
     {
         return;
     }
     SetDefaultsEventArgs<Item, int> setDefaultsEventArgs = new SetDefaultsEventArgs<Item, int>
     {
         Object = item,
         Info = nettype
     };
     ItemHooks.NetDefaults(setDefaultsEventArgs);
     nettype = setDefaultsEventArgs.Info;
 }
示例#2
0
        public static void OnSetDefaultsString(ref string itemname, Item item)
        {
            if (SetDefaultsString == null)
                return;
            var args = new SetDefaultsEventArgs<Item, string>()
            {
                Object = item,
                Info = itemname,
            };

            SetDefaultsString(args);

            itemname = args.Info;
        }
 public static void OnSetDefaults(ref int type, Projectile proj)
 {
     if (SetDefaults == null)
     {
         return;
     }
     SetDefaultsEventArgs<Projectile, int> setDefaultsEventArgs = new SetDefaultsEventArgs<Projectile, int>
     {
         Object = proj,
         Info = type
     };
     SetDefaults(setDefaultsEventArgs);
     type = setDefaultsEventArgs.Info;
 }
示例#4
0
 public static void OnSetDefaultsString(ref string npcname, NPC npc)
 {
     if (NpcHooks.SetDefaultsString == null)
     {
         return;
     }
     SetDefaultsEventArgs<NPC, string> setDefaultsEventArgs = new SetDefaultsEventArgs<NPC, string>
     {
         Object = npc,
         Info = npcname
     };
     NpcHooks.SetDefaultsString(setDefaultsEventArgs);
     npcname = setDefaultsEventArgs.Info;
 }
示例#5
0
 public static void OnSetDefaultsInt(ref int npctype, NPC npc)
 {
     if (NpcHooks.SetDefaultsInt == null)
     {
         return;
     }
     SetDefaultsEventArgs<NPC, int> setDefaultsEventArgs = new SetDefaultsEventArgs<NPC, int>
     {
         Object = npc,
         Info = npctype
     };
     NpcHooks.SetDefaultsInt(setDefaultsEventArgs);
     npctype = setDefaultsEventArgs.Info;
 }
示例#6
0
 public static void OnSetDefaultsInt(ref int itemtype, Item item)
 {
     if (ItemHooks.SetDefaultsInt == null)
     {
         return;
     }
     SetDefaultsEventArgs<Item, int> setDefaultsEventArgs = new SetDefaultsEventArgs<Item, int>
     {
         Object = item,
         Info = itemtype
     };
     ItemHooks.SetDefaultsInt(setDefaultsEventArgs);
     itemtype = setDefaultsEventArgs.Info;
 }
示例#7
0
        public static void OnSetDefaultsString(ref string npcname, NPC npc)
        {
            if (SetDefaultsString == null)
                return;
            var args = new SetDefaultsEventArgs<NPC, string>()
            {
                Object = npc,
                Info = npcname,
            };

            SetDefaultsString(args);

            npcname = args.Info;
        }
示例#8
0
 public static void OnSetDefaultsString(ref string itemname, Item item)
 {
     if (ItemHooks.SetDefaultsString == null)
     {
         return;
     }
     SetDefaultsEventArgs<Item, string> setDefaultsEventArgs = new SetDefaultsEventArgs<Item, string>
     {
         Object = item,
         Info = itemname
     };
     ItemHooks.SetDefaultsString(setDefaultsEventArgs);
     itemname = setDefaultsEventArgs.Info;
 }
示例#9
0
        public static void OnSetDefaultsInt(ref int itemtype, Item item)
        {
            if (SetDefaultsInt == null)
                return;

            var args = new SetDefaultsEventArgs<Item, int>()
            {
                Object = item,
                Info = itemtype,
            };

            SetDefaultsInt(args);

            itemtype = args.Info;
        }
示例#10
0
        public static void OnSetDefaultsInt(ref int npctype, NPC npc)
        {
            if (SetDefaultsInt == null)
                return;

            var args = new SetDefaultsEventArgs<NPC, int>()
            {
                Object = npc,
                Info = npctype,
            };

            SetDefaultsInt(args);

            npctype = args.Info;
        }
示例#11
0
文件: TShock.cs 项目: InanZen/TShock
 private void OnNpcSetDefaults(SetDefaultsEventArgs<NPC, int> e)
 {
     if (Itembans.ItemIsBanned(e.Object.name, null))
     {
         e.Object.SetDefaults(0);
     }
 }
示例#12
0
 void OnProjectileSetDefaults(SetDefaultsEventArgs<Projectile, int> e)
 {
     if (e.Info == 43)
         if (Config.DisableTombstones)
             e.Object.SetDefaults(0);
 }
 public void OnSetDefaultsString(SetDefaultsEventArgs<NPC, string> e)
 {
     CustomMonster CM = CustomMonsters.Find(cm => cm.ID == e.Object.whoAmI);
     CustomMonsters.Remove(CM);
 }
示例#14
0
		internal bool InvokeProjectileSetDefaults(ref int type, Projectile projectile)
		{
			SetDefaultsEventArgs<Projectile, int> args = new SetDefaultsEventArgs<Projectile, int>
			{
				Object = projectile,
				Info = type
			};

			this.ProjectileSetDefaults.Invoke(args);

			type = args.Info;
			return args.Handled;
		}
示例#15
0
 /// <summary>
 /// ProjectileSetDefaults callback.
 /// </summary>
 /// <param name="args"></param>
 private void OnProjectileSetDefaults(SetDefaultsEventArgs<Projectile, int> args)
 {
     lock (this.m_AddonsLock)
     {
         this.m_Addons.ForEach(a =>
             {
                 var ret = a.Value.InvokeEvent("ProjectileSetDefaults", args);
                 if (ret != null && ret.Length >= 1)
                 {
                     bool result;
                     if (bool.TryParse(ret[0].ToString(), out result) && result)
                         args.Handled = true;
                 }
             });
     }
 }
示例#16
0
		internal bool InvokeNpcSetDefaultsString(ref string npcName, NPC npc)
		{
			SetDefaultsEventArgs<NPC, string> args = new SetDefaultsEventArgs<NPC, string>
			{
				Object = npc, 
				Info = npcName
			};

			this.NpcSetDefaultsString.Invoke(args);

			npcName = args.Info;
			return args.Handled;
		}
示例#17
0
		internal bool InvokeNpcNetDefaults(ref int netType, NPC npc)
		{
			SetDefaultsEventArgs<NPC, int> args = new SetDefaultsEventArgs<NPC, int>
			{
				Object = npc,
				Info = netType
			};

			this.NpcNetDefaults.Invoke(args);

			netType = args.Info;
			return args.Handled;
		}
示例#18
0
		internal bool InvokeItemNetDefaults(ref int netType, Item item)
		{
			SetDefaultsEventArgs<Item, int> args = new SetDefaultsEventArgs<Item, int>
			{
				Info = netType,
				Object = item
			};

			this.ItemNetDefaults.Invoke(args);

			netType = args.Info;
			return args.Handled;
		}
示例#19
0
		internal bool InvokeItemSetDefaultsString(ref string itemName, Item item)
		{
			SetDefaultsEventArgs<Item, string> args = new SetDefaultsEventArgs<Item, string>
			{
				Info = itemName,
				Object = item
			};

			this.ItemSetDefaultsString.Invoke(args);

			itemName = args.Info;
			return args.Handled;
		}
示例#20
0
文件: TShock.cs 项目: InanZen/TShock
 private void OnProjectileSetDefaults(SetDefaultsEventArgs<Projectile, int> e)
 {
     if (e.Info == 43)
         if (Config.DisableTombstones)
             e.Object.SetDefaults(0);
     if (e.Info == 75)
         if (Config.DisableClownBombs)
             e.Object.SetDefaults(0);
     if (e.Info == 109)
         if (Config.DisableSnowBalls)
             e.Object.SetDefaults(0);
 }
示例#21
0
 private void OnNpcSetDefaults(SetDefaultsEventArgs<NPC, int> e)
 {
     if (!Config.Hardmode)
     {
         if (Itembans.ItemIsBanned(e.Object.name, null))
         {
             e.Object.SetDefaults(0);
         }
         if (e.Object.name.Contains("Giant Worm") || e.Object.name.Contains("Digger") || e.Object.name.Equals("Voodoo Demon"))
         {
             e.Object.SetDefaults(0);
         }
     }
 }
示例#22
0
文件: TShock.cs 项目: B-BOB/TShock
 /// <summary>OnProjectileSetDefaults - Called when a projectile sets the default attributes for itself.</summary>
 /// <param name="e">e - The SetDefaultsEventArgs object praameterized with Projectile and int.</param>
 private void OnProjectileSetDefaults(SetDefaultsEventArgs<Projectile, int> e)
 {
     //tombstone fix.
     if (e.Info == 43 || (e.Info >= 201 && e.Info <= 205) || (e.Info >= 527 && e.Info <= 531))
         if (Config.DisableTombstones)
             e.Object.SetDefaults(0);
     if (e.Info == 75)
         if (Config.DisableClownBombs)
             e.Object.SetDefaults(0);
     if (e.Info == 109)
         if (Config.DisableSnowBalls)
             e.Object.SetDefaults(0);
 }