コード例 #1
0
ファイル: Entities.cs プロジェクト: Peteys93/MCGalaxy
        internal static void Spawn(Player dst, Player p, byte id, ushort x, ushort y, ushort z,
                                   byte rotx, byte roty, string possession = "")
        {
            if (!Server.zombie.Running || !p.Game.Infected)
            {
                string col = p.color;
                if (col.Length >= 2 && !Colors.IsStandardColor(col[1]) && !dst.HasCpeExt(CpeExt.TextColors))
                {
                    col = "&" + Colors.GetFallback(col[1]);
                }
                string group = p.Game.Referee ? "&2Referees" : "&fPlayers";

                if (dst.hasExtList)
                {
                    dst.SendExtAddEntity2(id, p.skinName, col + p.truename + possession, x, y, z, rotx, roty);
                    dst.SendExtAddPlayerName(id, p.skinName, col + p.truename, group, 0);
                }
                else
                {
                    dst.SendSpawn(id, col + p.truename + possession, x, y, z, rotx, roty);
                }
                return;
            }

            string name = p.truename, skinName = p.skinName;

            if (ZombieGame.ZombieName != "" && !dst.Game.Aka)
            {
                name = ZombieGame.ZombieName; skinName = name;
            }

            if (dst.hasExtList)
            {
                dst.SendExtAddEntity2(id, skinName, Colors.red + name + possession, x, y, z, rotx, roty);
                dst.SendExtAddPlayerName(id, skinName, Colors.red + name, "&cZombies", 0);
            }
            else
            {
                dst.SendSpawn(id, Colors.red + name + possession, x, y, z, rotx, roty);
            }

            if (dst.hasChangeModel && id != 0xFF)
            {
                dst.SendChangeModel(id, ZombieGame.ZombieModel);
            }
        }
コード例 #2
0
        internal static void Spawn(Player dst, Player p, byte id, ushort x, ushort y, ushort z,
                                   byte rotx, byte roty, string possession = "")
        {
            if (!Server.TablistGlobal)
            {
                TabList.Add(dst, p, id);
            }
            if (!Server.zombie.Running || !p.Game.Infected)
            {
                string col = GetSupportedCol(dst, p.color);
                if (dst.hasExtList)
                {
                    dst.SendExtAddEntity2(id, p.skinName, col + p.truename + possession, x, y, z, rotx, roty);
                }
                else
                {
                    dst.SendSpawn(id, col + p.truename + possession, x, y, z, rotx, roty);
                }
                return;
            }

            string name = p.truename, skinName = p.skinName;

            if (ZombieGameProps.ZombieName != "" && !dst.Game.Aka)
            {
                name = ZombieGameProps.ZombieName; skinName = name;
            }

            if (dst.hasExtList)
            {
                dst.SendExtAddEntity2(id, skinName, Colors.red + name + possession, x, y, z, rotx, roty);
            }
            else
            {
                dst.SendSpawn(id, Colors.red + name + possession, x, y, z, rotx, roty);
            }

            if (dst.hasChangeModel && id != Entities.SelfID)
            {
                dst.SendChangeModel(id, ZombieGameProps.ZombieModel);
            }
        }
コード例 #3
0
ファイル: Entities.cs プロジェクト: Peteys93/MCGalaxy
 internal static void Spawn(Player dst, PlayerBot b)
 {
     if (dst.hasExtList)
     {
         dst.SendExtAddEntity2(b.id, b.skinName, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
         dst.SendExtAddPlayerName(b.id, b.skinName, b.color + b.name, "Bots", 0);
     }
     else
     {
         dst.SendSpawn(b.id, b.color + b.skinName, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
     }
 }
コード例 #4
0
        internal static void Spawn(Player dst, PlayerBot b)
        {
            string name = Chat.Format(b.color + b.DisplayName, dst, true, true, false);

            if (b.DisplayName.CaselessEq("empty"))
            {
                name = "";
            }
            string skin = Chat.Format(b.SkinName, dst, true, true, false);

            if (dst.hasExtList)
            {
                dst.SendExtAddEntity2(b.id, skin, name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
            }
            else
            {
                dst.SendSpawn(b.id, name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
            }
            if (Server.TablistBots)
            {
                TabList.Add(dst, b);
            }
        }
コード例 #5
0
ファイル: Team.cs プロジェクト: tommyz56/MCGalaxy
        public void SpawnPlayer(Player p)
        {
            //p.spawning = true;
            if (spawns.Count != 0)
            {
                Random random = new Random();
                int rnd = random.Next(0, spawns.Count);
                ushort x, y, z, rotx;

                x = spawns[rnd].x;
                y = spawns[rnd].y;
                z = spawns[rnd].z;

                ushort x1 = (ushort)((0.5 + x) * 32);
                ushort y1 = (ushort)((1 + y) * 32);
                ushort z1 = (ushort)((0.5 + z) * 32);
                rotx = spawns[rnd].rotx;
                unchecked
                {
                    p.SendSpawn((byte)-1, p.name, x1, y1, z1, (byte)rotx, 0);
                }
                //p.health = 100;
            }
            else
            {
                ushort x = (ushort)((0.5 + mapOn.spawnx) * 32);
                ushort y = (ushort)((1 + mapOn.spawny) * 32);
                ushort z = (ushort)((0.5 + mapOn.spawnz) * 32);
                ushort rotx = mapOn.rotx;
                ushort roty = mapOn.roty;

                unchecked
                {
                    p.SendSpawn((byte)-1, p.name, x, y, z, (byte)rotx, (byte)roty);
                }
            }
            //p.spawning = false;
        }