Ejemplo n.º 1
0
        //Stores newly created projectiles into a list along with its originated item
        public void OnNewProjectile(object sender, GetDataHandlers.NewProjectileEventArgs args)
        {
            if (!PvPController.config.enablePlugin)
            {
                return;
            }

            PvPPlayer player = new PvPPlayer(args.Owner);

            if (player == null || !player.TPlayer.hostile)
            {
                return;
            }

            PvPItem weapon;

            if (MiscData.accessoryOrArmorProjectiles.ContainsKey(args.Type))
            {
                weapon        = new PvPItem();
                weapon.damage = MiscData.accessoryOrArmorProjectiles[args.Type];
                weapon.name   = Lang.GetProjectileName(args.Type).ToString();
            }
            else if (MiscData.fromWhatWeapon.ContainsKey(args.Type))
            {
                weapon = new PvPItem(MiscData.fromWhatWeapon[args.Type]);
            }
            else
            {
                weapon = player.GetPlayerItem();
            }

            projectiles[args.Identity] = new PvPProjectile(args.Type);
            projectiles[args.Identity].SetOwner(args.Owner);
            projectiles[args.Identity].SetOriginatedItem(weapon);
        }
Ejemplo n.º 2
0
 void OnProjectile(object sender, GetDataHandlers.NewProjectileEventArgs args)
 {
     if (args.Owner < 255)
     {
         var projectile = Main.projectile[args.Identity];
         if (projectile.active && projectile.type == 34 && cannonPlayers[args.Owner] && Main.player[args.Owner].channel && !projectileList.Contains(projectile))
         {
             projectileList.Add(projectile);
         }
     }
 }
Ejemplo n.º 3
0
        private static void OnNewProjectile(object sender, GetDataHandlers.NewProjectileEventArgs args)
        {
            TSPlayer player = TShock.Players[args.Owner];

            if (args.Handled || args.Type != 651 || player?.TPlayer == null)
            {
                return;
            }

            try
            {
                byte prefix;

                if (player.TPlayer.inventory[player.TPlayer.selectedItem].netID == ItemID.WireKite)
                {
                    prefix = player.TPlayer.inventory[player.TPlayer.selectedItem].prefix;
                }
                else
                {
                    return; // This means player is holding another item.Obtains by hacks.
                }
                if (playerDesignState[args.Owner] == DesignState.Waiting)
                {
                    playerDesignState[args.Owner] = DesignState.Begin;
                }
                else if (playerDesignState[args.Owner] == DesignState.Begin)
                {
                    int tileX = (int)Math.Floor((args.Position.X + 5) / 16);
                    int tileY = (int)Math.Floor((args.Position.Y + 5) / 16);

                    if (TUI.TUI.Touched(args.Owner, new Touch(tileX, tileY, TouchState.Begin, prefix, 0)))
                    {
                        TUI.TUI.Session[args.Owner].ProjectileID = args.Identity;
                    }
                    playerDesignState[args.Owner] = DesignState.Moving;
                    //args.Handled = true;
                }
                else
                {
                    int tileX = (int)Math.Floor((args.Position.X + 5) / 16);
                    int tileY = (int)Math.Floor((args.Position.Y + 5) / 16);
                    TUI.TUI.Touched(args.Owner, new Touch(tileX, tileY, TouchState.Moving, prefix, 0));
                }
            }
            catch (Exception e)
            {
                TShock.Log.ConsoleError(e.ToString());
            }
        }
Ejemplo n.º 4
0
        private static void OnNewProjectile(object sender, GetDataHandlers.NewProjectileEventArgs args)
        {
            var ply = TShock.Players[args.Owner];
            var rt  = RtPlayer.GetPlayerInfo(ply).CurrentRegion;

            if (rt?.HasEvent(Event.Projban) != true)
            {
                return;
            }

            if (rt.ProjectileIsBanned(args.Type) && !ply.HasPermission("regiontrigger.bypass.projban"))
            {
                ply.Disable($"Create banned projectile in region {rt.Region.Name}.", DisableFlags.WriteToLogAndConsole);
                ply.SendErrorMessage("This projectile is banned here.");
                ply.RemoveProjectile(args.Index, args.Owner);
            }
        }
Ejemplo n.º 5
0
        private void OnNewProjectile(object sender, GetDataHandlers.NewProjectileEventArgs args)
        {
            TSPlayer player = TShock.Players[args.Owner];

            if (!player.TPlayer.hostile)
            {
                return;
            }
            if (player.HasPermission("pvpchecks.ignore"))
            {
                return;
            }

            if (cfg.projBans.Contains(args.Type))
            {
                player.Disable("Used banned projectile in pvp.", DisableFlags.None);
                player.SendErrorMessage("You cannot create this projectile in PvP. See /pvpprojbans.");
            }
        }
Ejemplo n.º 6
0
        //Sticky Bomb, bomb and Fish bomb are available but there's a cooldown that lasts 7 seconds.
        public static void NewProjectile(object sender, GetDataHandlers.NewProjectileEventArgs e)
        {
            if (e.Handled || e.Player.HasPermission("server.jmod"))
            {
                return;
            }


            if (e.Type == 28 || e.Type == 37 || e.Type == 519 || e.Type == 773)
            {
                if ((SurvivalCore.SrvPlayers[e.Player.Index].BombCooldown - DateTime.Now).TotalSeconds > 0)
                {
                    e.Player.SendErrorMessage($"Zwolnij troche z wyrzucaniem ladunkow. Nastepny rzut bedzie mozliwy za {PowelderAPI.Utils.ExpireCountDown(SurvivalCore.SrvPlayers[e.Player.Index].BombCooldown)}");

                    if (e.Type == 28)
                    {
                        e.Player.GiveItem(166, 1);
                    }
                    else if (e.Type == 37)
                    {
                        e.Player.GiveItem(235, 1);
                    }
                    else if (e.Type == 519)
                    {
                        e.Player.GiveItem(3196, 1);
                    }
                    else if (e.Type == 773)
                    {
                        e.Player.GiveItem(4423, 1);
                    }

                    e.Player.RemoveProjectile(e.Identity, e.Owner);
                    e.Handled = true;
                    return;
                }

                SurvivalCore.SrvPlayers[e.Player.Index].BombCooldown = DateTime.Now.AddSeconds(7);
            }
        }
Ejemplo n.º 7
0
 public virtual void CreatingProj(GetDataHandlers.NewProjectileEventArgs args)
 {
 }
Ejemplo n.º 8
0
        private void OnNewProjectile(object sender, GetDataHandlers.NewProjectileEventArgs args)
        {
            var player = Players[args.Player.Index];

            player.OnNewProj(args);
        }