示例#1
0
        private static bool HandlePlayerKillMe(GetDataHandlerArgs args)
        {
            int   index        = args.Player.Index;    //Attacking Player
            byte  PlayerID     = (byte)args.Data.ReadByte();
            byte  hitDirection = (byte)args.Data.ReadByte();
            Int16 Damage       = (Int16)args.Data.ReadInt16();
            bool  PVP          = args.Data.ReadBoolean();
            var   player       = C3Tools.GetC3PlayerByIndex(PlayerID);

            if (player.SpawnProtectionEnabled)
            {
                NetMessage.SendData(4, -1, PlayerID, player.PlayerName, PlayerID, 0f, 0f, 0f, 0);
                return(true);
            }

            if (player.GameType == "ffa")
            {
                player.KillingPlayer.FFAScore++;
                C3Tools.BroadcastMessageToGametype("ffa", player.KillingPlayer.PlayerName + " - Score : " + player.KillingPlayer.FFAScore + " -- kills -- " + player.PlayerName + " - Score : " + player.FFAScore, Color.Black);
                player.Dead = true;
                player.TSPlayer.TPlayer.dead = true;
            }

            if (player.KillingPlayer != null)
            {
                C3Events.Death(player.KillingPlayer, player, player.GameType, PVP);
                player.KillingPlayer = null;
            }

            return(false);
        }
示例#2
0
        private static bool HandlePlayerDamage(GetDataHandlerArgs args)
        {
            int   index        = args.Player.Index;          //Attacking Player
            byte  PlayerID     = (byte)args.Data.ReadByte(); //Damaged Player
            byte  hitDirection = (byte)args.Data.ReadByte();
            Int16 Damage       = (Int16)args.Data.ReadInt16();
            var   player       = C3Tools.GetC3PlayerByIndex(PlayerID);
            bool  PVP          = args.Data.ReadBoolean();
            bool  Crit         = args.Data.ReadBoolean();

            if (player.SpawnProtectionEnabled)
            {
                C3Tools.GetC3PlayerByIndex(index).TSPlayer.SendData(PacketTypes.PlayerUpdate, "", PlayerID);
                return(true);
            }

            if (index != PlayerID)
            {
                player.KillingPlayer = C3Tools.GetC3PlayerByIndex(index);
            }
            else
            {
                player.KillingPlayer = null;
            }

            return(false);
        }