Cameras help

Maatt

Active Member
Aug 29, 2012
162
158
Hello everyone,

Trying to fix cameras on my hotel but is nae going well. I want to edit my SWF so it posts the picture to my webserver. I've tried to do it myself but I just end up breaking my SWF and I can't use one of the existing ones because the build numbers are different.

I don't really wanna have to change my whole SWF build just to get this working.

Does anyone know how this is done for PRODUCTION-201701242205-837386173 (Plus R2 default build). Also if anyone can locate the packet headers it would be helpful.

Many thx.
 

Sonay

Sonay#0001
Mar 24, 2016
103
53
You can use Habkit with rawcam command to send raw blob as packet to your emulator and creating a png file.

If you done it, you can easy use it like I did.

C#:
namespace Plus.Communication.Packets.Incoming.Rooms.Camera
{
    public class CameraRoomPictureEvent : IPacketEvent
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(CameraRoomPictureEvent));
        
        public void Parse(GameClient session, ClientPacket packet)
        {
            byte[] data = packet.ReadBytes(packet.ReadInt());
            
            if (!session.GetHabbo().InRoom) return;

            string fileName = $"{session.GetHabbo().Id}_{session.GetHabbo().CurrentRoomId}_{PlusEnvironment.GetUnixTimestamp()}";
            try
            {
                using (MemoryStream ms = new MemoryStream(data))
                {
                    // Big photo
                    Image bigPhoto = Image.FromStream(ms, true, true);
                    bigPhoto.Save(PlusEnvironment.GetSettingsManager().TryGetValue("camera.output.path") + fileName + ".png",
                        ImageFormat.Png);

                    // Small photo
                    Image smallPhoto = bigPhoto.GetThumbnailImage(110, 110, () => false, IntPtr.Zero);
                    smallPhoto.Save(PlusEnvironment.GetSettingsManager().TryGetValue("camera.output.path") + fileName + "_small.png",
                        ImageFormat.Png);
                }
            }
            catch (Exception e)
            {
                log.Error(e);
                ExceptionLogger.LogException(e);
            }

            session.GetHabbo().LastTakenPhoto = fileName;

            session.SendPacket(new CameraPhotoPreviewComposer(fileName + ".png"));
        }
    }
}
 

Users who are viewing this thread

Top