Esempio n. 1
0
        static void SpawnRaw(Player dst, byte id, Entity e, Position pos, Orientation rot,
                             string skin, string name, string model)
        {
            dst.Session.SendSpawnEntity(id, name, skin, pos, rot);

            if (dst.hasChangeModel)
            {
                OnSendingModelEvent.Call(e, ref model, dst);
                if (!model.CaselessEq("humanoid"))
                {
                    dst.Session.SendChangeModel(id, model);
                }
            }

            if (dst.Supports(CpeExt.EntityProperty))
            {
                dst.Send(Packet.EntityProperty(id, EntityProp.RotX, Orientation.PackedToDegrees(rot.RotX)));
                dst.Send(Packet.EntityProperty(id, EntityProp.RotZ, Orientation.PackedToDegrees(rot.RotZ)));
                SendModelScales(dst, id, e);
            }
        }
Esempio n. 2
0
        static void SpawnRaw(Player dst, byte id, Entity e, Position pos, Orientation rot,
                             string skin, string name, string model)
        {
            // NOTE: Fix for standard clients
            if (id == Entities.SelfID)
            {
                pos.Y -= 22;
            }
            name = Colors.Cleanup(name, dst.hasTextColors);

            if (dst.Supports(CpeExt.ExtPlayerList, 2))
            {
                dst.Send(Packet.ExtAddEntity2(id, skin, name, pos, rot, dst.hasCP437, dst.hasExtPositions));
            }
            else if (dst.hasExtList)
            {
                dst.Send(Packet.ExtAddEntity(id, skin, name, dst.hasCP437));
                dst.Send(Packet.Teleport(id, pos, rot, dst.hasExtPositions));
            }
            else
            {
                dst.Send(Packet.AddEntity(id, name, pos, rot, dst.hasCP437, dst.hasExtPositions));
            }

            if (dst.hasChangeModel)
            {
                OnSendingModelEvent.Call(e, ref model, dst);
                if (!model.CaselessEq("humanoid"))
                {
                    SendModel(dst, id, model);
                }
            }

            if (dst.Supports(CpeExt.EntityProperty))
            {
                dst.Send(Packet.EntityProperty(id, EntityProp.RotX, Orientation.PackedToDegrees(rot.RotX)));
                dst.Send(Packet.EntityProperty(id, EntityProp.RotZ, Orientation.PackedToDegrees(rot.RotZ)));
                SendModelScales(dst, id, e);
            }
        }
Esempio n. 3
0
        internal static void BroadcastModel(Entity e, string m)
        {
            Player[] players = PlayerInfo.Online.Items;
            Level    lvl     = e.Level;

            foreach (Player pl in players)
            {
                if (pl.level != lvl || !pl.hasChangeModel)
                {
                    continue;
                }
                if (!pl.CanSeeEntity(e))
                {
                    continue;
                }

                byte   id    = (pl == e) ? Entities.SelfID : e.EntityID;
                string model = Chat.Format(m, pl, true, false);

                OnSendingModelEvent.Call(e, ref model, pl);
                SendModel(pl, id, model);
                SendModelScales(pl, id, e);
            }
        }