Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public override void Initialize()
        {
            C3Tools.SetupConfig();

            if (C3Config.CTFEnabled)
            {
                GameHooks.Update += CTF.OnUpdate;
            }
            if (C3Config.DuelsEnabled)
            {
                GameHooks.Update += Duel.OnUpdate;
            }
            if (C3Config.OneFlagEnabled)
            {
                GameHooks.Update += OneFlagCTF.OnUpdate;
            }
            if (C3Config.TeamDeathmatchEnabled)
            {
                GameHooks.Update += TDM.OnUpdate;
            }
            if (C3Config.MonsterApocalypseEnabled)
            {
                GameHooks.Update += Apocalypse.OnUpdate;
            }
            if (C3Config.FreeForAllEnabled)
            {
                GameHooks.Update += FFA.OnUpdate;
            }

            GameHooks.Update     += OnUpdate;
            GameHooks.Initialize += OnInitialize;
            NetHooks.GreetPlayer += OnGreetPlayer;
            ServerHooks.Leave    += OnLeave;
            NetHooks.GetData     += GetData;

            GetDataHandlers.InitGetDataHandler();
        }
Exemplo n.º 4
0
        public override void Initialize()
        {
            C3Tools.SetupConfig();

            if (C3Config.CTFEnabled)
            {
                ServerApi.Hooks.GameUpdate.Register(this, CTF.OnUpdate);
            }
            if (C3Config.DuelsEnabled)
            {
                ServerApi.Hooks.GameUpdate.Register(this, Duel.OnUpdate);
            }
            if (C3Config.OneFlagEnabled)
            {
                ServerApi.Hooks.GameUpdate.Register(this, OneFlagCTF.OnUpdate);
            }
            if (C3Config.TeamDeathmatchEnabled)
            {
                ServerApi.Hooks.GameUpdate.Register(this, TDM.OnUpdate);
            }
            if (C3Config.MonsterApocalypseEnabled)
            {
                ServerApi.Hooks.GameUpdate.Register(this, Apocalypse.OnUpdate);
            }
            if (C3Config.FreeForAllEnabled)
            {
                ServerApi.Hooks.GameUpdate.Register(this, FFA.OnUpdate);
            }

            ServerApi.Hooks.GameUpdate.Register(this, OnUpdate);
            ServerApi.Hooks.GameInitialize.Register(this, OnInitialize);
            ServerApi.Hooks.NetGreetPlayer.Register(this, OnGreetPlayer);
            ServerApi.Hooks.ServerLeave.Register(this, OnLeave);
            ServerApi.Hooks.NetGetData.Register(this, GetData);

            GetDataHandlers.InitGetDataHandler();
        }