コード例 #1
0
        void DoCollisions(Player[] aliveList, Player[] deadList, Random random)
        {
            int dist = ZombieGameProps.HitboxPrecision;

            foreach (Player killer in deadList)
            {
                killer.Game.Infected = true;
                UpdatePlayerColor(killer, InfectCol);
                aliveList = Alive.Items;

                foreach (Player alive in aliveList)
                {
                    if (alive == killer)
                    {
                        continue;
                    }
                    UpdatePlayerColor(alive, alive.color);
                    if (!MovementCheck.InRange(alive, killer, dist))
                    {
                        continue;
                    }

                    if (killer.Game.Infected && !alive.Game.Infected &&
                        !alive.Game.Referee && !killer.Game.Referee &&
                        killer.level.name.CaselessEq(CurLevelName) &&
                        alive.level.name.CaselessEq(CurLevelName))
                    {
                        InfectPlayer(alive, killer);
                        alive.Game.LastInfecter = killer.name;

                        if (lastPlayerToInfect == killer.name)
                        {
                            infectCombo++;
                            if (infectCombo >= 2)
                            {
                                killer.SendMessage("You gained " + (2 + infectCombo) + " " + Server.moneys);
                                killer.SetMoney(killer.money + (2 + infectCombo));
                                CurLevel.ChatLevel("&c" + killer.DisplayName + " %Sis on a rampage! " + (infectCombo + 1) + " infections in a row!");
                            }
                        }
                        else
                        {
                            infectCombo = 0;
                        }

                        lastPlayerToInfect = killer.name;
                        killer.Game.CurrentInfected++;
                        killer.Game.TotalInfected++;
                        killer.Game.MaxInfected = Math.Max(killer.Game.CurrentInfected, killer.Game.MaxInfected);

                        ShowInfectMessage(random, alive, killer);
                        UpdatePlayerColor(alive, InfectCol);
                        Thread.Sleep(50);
                    }
                }
            }
        }
コード例 #2
0
ファイル: CtfGame.Round.cs プロジェクト: derekdinan/MCGalaxy
        void Tick()
        {
            int dist = (int)(Config.TagDistance * 32);

            Player[] online = PlayerInfo.Online.Items;

            foreach (Player p in online)
            {
                if (p.level != Map)
                {
                    continue;
                }
                CtfTeam team = TeamOf(p);
                CtfData data = Get(p);

                // Draw flag above player head
                if (data.HasFlag)
                {
                    DrawPlayerFlag(p, data);
                }

                if (team == null || data.TagCooldown)
                {
                    continue;
                }
                if (!OnOwnTeamSide(p.Pos.BlockZ, team))
                {
                    continue;
                }
                CtfTeam opposing = Opposing(team);

                Player[] opponents = opposing.Members.Items;
                foreach (Player other in opponents)
                {
                    if (!MovementCheck.InRange(p, other, dist))
                    {
                        continue;
                    }
                    CtfData otherData = Get(other);

                    otherData.TagCooldown = true;
                    other.Message(p.ColoredName + " %Stagged you!");
                    PlayerActions.Respawn(other);
                    Thread.Sleep(300); // TODO: get rid of this

                    if (otherData.HasFlag)
                    {
                        DropFlag(p, opposing);
                    }
                    data.Points      += cfg.Tag_PointsGained;
                    otherData.Points -= cfg.Tag_PointsLost;
                    data.Tags++;
                    otherData.TagCooldown = false;
                }
            }
        }
コード例 #3
0
ファイル: ZSGame.Round.cs プロジェクト: DiresHosting/MCDire
        void DoCollisions(Player[] aliveList, Player[] deadList, Random random)
        {
            int dist = (int)(Config.HitboxDist * 32);

            foreach (Player killer in deadList)
            {
                ZSData killerData = Get(killer);
                killerData.Infected = true;
                aliveList           = Alive.Items;

                foreach (Player alive in aliveList)
                {
                    if (alive == killer)
                    {
                        continue;
                    }
                    if (!MovementCheck.InRange(alive, killer, dist))
                    {
                        continue;
                    }

                    if (killerData.Infected && !Get(alive).Infected &&
                        !alive.Game.Referee && !killer.Game.Referee &&
                        killer.level == Map && alive.level == Map)
                    {
                        InfectPlayer(alive, killer);

                        if (lastKiller == killer.name)
                        {
                            infectCombo++;
                            if (infectCombo >= 2)
                            {
                                killer.Message("You gained " + (2 + infectCombo) + " " + ServerConfig.Currency);
                                killer.SetMoney(killer.money + (2 + infectCombo));
                                Map.Message("&c" + killer.DisplayName + " %Sis on a rampage! " + (infectCombo + 1) + " infections in a row!");
                            }
                        }
                        else
                        {
                            infectCombo = 0;
                        }

                        lastKiller = killer.name;
                        killerData.CurrentInfected++;
                        killerData.TotalInfected++;
                        killerData.MaxInfected = Math.Max(killerData.CurrentInfected, killerData.MaxInfected);

                        ShowInfectMessage(random, alive, killer);
                        Thread.Sleep(50);
                    }
                }
            }
        }
コード例 #4
0
ファイル: ZSGame.Plugin.cs プロジェクト: netzbasis/MCGalaxy
        void HandlePlayerMove(Player p, Position next, byte rotX, byte rotY)
        {
            if (!RoundInProgress || p.level != Map)
            {
                return;
            }

            bool reverted = MovementCheck.DetectNoclip(p, next) ||
                            MovementCheck.DetectSpeedhack(p, next, Config.MaxMoveDist);

            if (reverted)
            {
                p.cancelmove = true;
            }
        }
コード例 #5
0
        public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
                                             byte rotX, byte rotY)
        {
            if (!Running || !RoundInProgress)
            {
                return(false);
            }
            if (p.level == null || !p.level.name.CaselessEq(CurLevelName))
            {
                return(false);
            }

            return(MovementCheck.DetectNoclip(p, x, y, z) ||
                   MovementCheck.DetectSpeedhack(p, x, y, z, ZombieGameProps.MaxMoveDistance));
        }
コード例 #6
0
        void CheckTagging(object sender, System.Timers.ElapsedEventArgs e)
        {
            Player[] online = PlayerInfo.Online.Items;
            foreach (Player p in online)
            {
                if (p.level != Map)
                {
                    continue;
                }

                CtfTeam2 team = TeamOf(p);
                if (team == null || Get(p).tagging)
                {
                    continue;
                }
                if (!OnOwnTeamSide(p.Pos.BlockZ, team))
                {
                    continue;
                }
                CtfTeam2 opposing = Opposing(team);

                Player[] opponents = opposing.Members.Items;
                foreach (Player other in opponents)
                {
                    if (!MovementCheck.InRange(p, other, 2 * 32))
                    {
                        continue;
                    }

                    Get(other).tagging = true;
                    Player.Message(other, p.ColoredName + " %Stagged you!");
                    Command.all.FindByName("Spawn").Use(other, "");
                    Thread.Sleep(300);

                    if (Get(other).hasflag)
                    {
                        DropFlag(p, opposing);
                    }
                    Get(p).Points     += Config.Tag_PointsGained;
                    Get(other).Points -= Config.Tag_PointsLost;
                    Get(p).Tags++;
                    Get(other).tagging = false;
                }
            }
        }
コード例 #7
0
ファイル: CtfGame.cs プロジェクト: Benedani/MCGalaxy
        void CheckTagging(object sender, System.Timers.ElapsedEventArgs e)
        {
            Player[] online = PlayerInfo.Online.Items;
            foreach (Player p in online)
            {
                if (p.level != mainlevel)
                {
                    continue;
                }

                ushort x = p.pos[0], y = p.pos[1], z = p.pos[2];
                Base   b = null;
                if (redteam.members.Contains(p))
                {
                    b = redbase;
                }
                else if (blueteam.members.Contains(p))
                {
                    b = bluebase;
                }
                else
                {
                    continue;
                }

                if (GetPlayer(p).tagging)
                {
                    continue;
                }
                if (!OnSide(p.pos[2], b))
                {
                    continue;
                }

                List <Player> opponents = redteam.members;
                if (redteam.members.Contains(p))
                {
                    opponents = blueteam.members;
                }

                foreach (Player other in opponents)
                {
                    if (!MovementCheck.InRange(p, other, 5 * 32))
                    {
                        continue;
                    }

                    GetPlayer(other).tagging = true;
                    Player.Message(other, p.ColoredName + " %Stagged you!");
                    b.SendToSpawn(mainlevel, this, other);
                    Thread.Sleep(300);

                    if (GetPlayer(other).hasflag)
                    {
                        Chat.MessageLevel(mainlevel, redteam.color + p.name + " DROPPED THE FLAG!");
                        GetPlayer(other).points -= caplose;
                        mainlevel.Blockchange(b.x, b.y, b.z, b.block);
                        GetPlayer(other).hasflag = false;
                    }

                    GetPlayer(p).points     += tagpoint;
                    GetPlayer(other).points -= taglose;
                    GetPlayer(p).tag++;
                    GetPlayer(other).tagging = false;
                }
            }
        }