Example #1
0
        private static void SharedLabel(Packet p)
        {
            bool  toremove = p.ReadBool();
            short x        = (short)p.ReadUShort();
            short y        = (short)p.ReadUShort();
            byte  map      = p.ReadByte();

            if (toremove)
            {
                UserObject        user  = RenderObjectsManager.GetUser(p.ReadASCII(p.ReadByte()));
                SharedLabelObject label = RenderObjectsManager.Get <SharedLabelObject>().FirstOrDefault(s => s.Parent == user && s.Position.X == x && s.Position.Y == y && s.Map == map);
                label?.Dispose();

                UOClientManager.SysMessage(string.Format("[SharedLabel][{0}] Removed a shared label!", user.Name), 83);
            }
            else
            {
                string     description = p.ReadASCII(p.ReadByte());
                string     username    = p.ReadASCII(p.ReadByte());
                UserObject user        = RenderObjectsManager.GetUser(username);
                if (user == null)
                {
                    RenderObjectsManager.AddUser(user = new UserObject(username));
                }

                RenderObjectsManager.AddSharedLabel(new SharedLabelObject(user, x, y, map, description));
                UOClientManager.SysMessage(string.Format("[SharedLabel][{0}] Added a shared label!", user.Name), 83);
            }
        }