Esempio n. 1
0
        /// <summary> Spawns this player to all other players that can see the player in the current world. </summary>
        public static void GlobalSpawn(Player p, ushort x, ushort y, ushort z,
                                       byte rotx, byte roty, bool self, string possession = "")
        {
            Player[] players = PlayerInfo.Online.Items;
            p.Game.lastSpawnColor = p.Game.Infected ? ZombieGame.InfectCol : p.color;
            TabList.Update(p, self);

            foreach (Player other in players)
            {
                if ((other.Loading && p != other) || p.level != other.level)
                {
                    continue;
                }

                if (p != other && Entities.CanSeeEntity(other, p))
                {
                    Spawn(other, p, p.id, x, y, z, rotx, roty, possession);
                }
                else if (p == other && self)
                {
                    other.pos = new ushort[3] {
                        x, y, z
                    }; other.rot = new byte[2] {
                        rotx, roty
                    };
                    other.oldpos = other.pos; other.oldrot = other.rot;
                    Spawn(other, p, Entities.SelfID, x, y, z, rotx, roty, possession);
                }
            }
        }
Esempio n. 2
0
        /// <summary> Spawns this player to all other players that can see the player in the current world. </summary>
        public static void GlobalSpawn(Player p, Position pos, Orientation rot, bool self, string possession = "")
        {
            Player[] players = PlayerInfo.Online.Items;
            p.Game.lastSpawnColor = p.Game.Infected ? ZSGame.InfectCol : p.color;
            TabList.Update(p, self);

            foreach (Player other in players)
            {
                if ((other.Loading && p != other) || p.level != other.level)
                {
                    continue;
                }

                if (p != other && other.CanSeeEntity(p))
                {
                    Spawn(other, p, pos, rot, possession);
                }
                else if (p == other && self)
                {
                    other.Pos     = pos; other.SetYawPitch(rot.RotY, rot.HeadX);
                    other.lastPos = other.Pos; other.lastRot = other.Rot;
                    Spawn(other, p, pos, rot, possession);
                }
            }
        }
Esempio n. 3
0
 static void SetChat(Player p, Level l, string v)
 {
     Toggle(p, l, ref l.Config.ServerWideChat, "Local level only chat", true);
     Player[] players = PlayerInfo.Online.Items;
     foreach (Player pl in players)
     {
         if (pl.level == l)
         {
             TabList.Update(pl, true);
         }
     }
 }
Esempio n. 4
0
        /// <summary> Attempts to change the nickname of the target player </summary>
        /// <remarks> Not allowed when players who cannot speak (e.g. muted) </remarks>
        public static bool SetNick(Player p, string target, string nick)
        {
            if (Colors.Strip(nick).Length >= 30)
            {
                p.Message("Nick must be under 30 letters.");
                return(false);
            }
            Player who = PlayerInfo.FindExact(target);

            if (nick.Length == 0)
            {
                MessageAction(p, target, who, "λACTOR &Sremoved λTARGET nick");
                nick = Server.ToRawUsername(target);
            }
            else
            {
                if (!p.CheckCanSpeak("change nicks"))
                {
                    return(false);
                }

                // TODO: select color from database?
                string color = who != null ? who.color : Group.GroupIn(target).Color;
                MessageAction(p, target, who, "λACTOR &Schanged λTARGET nick to " + color + nick);
            }

            if (who != null)
            {
                who.DisplayName = nick;
            }
            if (who != null)
            {
                TabList.Update(who, true);
            }
            PlayerDB.SetNick(target, nick);
            return(true);
        }