Skip to content

Commit

Permalink
Packet 157 - Get User Remote Screenshots
Browse files Browse the repository at this point in the history
Added Outbound Packet UserScreenshots
* This would give you a list of screenshots given the metadata sent.
* Major thanks to Zelaron just plugging away at it until we cracked the code

Added Screenshot Model
* Written by Zelaron, this Model holds all the relevant data for a screenshot.

* Per usual, this is a frontened-orientated packet, so it has no runtime functionality, but is ready to accept and send data.

Usual MessageType added.
  • Loading branch information
desukuran committed Apr 9, 2024
1 parent ee7b583 commit dfac7e9
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/PFire.Core/Models/Screenshot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

namespace PFire.Core.Entities
{
public class Screenshot
{
public int Id { get; set; } = 0;
public bool AdultContent { get; set; } = false;
public string FileName { get; set; }
public string Description { get; set; } = "";
public DateTime Uploaded { get; set; }
public DateTime Created { get; set; }
public string GameShortName { get; set; } = "";
public string GameLongName { get; set; } = "";
public string Nickname { get; set; } = "";
public int ViewCount { get; set; } = 0;
public int ServerIp { get; set; } = 0;
public int ServerPort { get; set; } = 0;
public int GameId { get; set; } = 0;
public int FileSize { get; set; } = 0;
public int CreatedUnixTimestamp { get; set; }
public int LockedState { get; set; } = 0;
}
}
55 changes: 55 additions & 0 deletions src/PFire.Core/Protocol/Messages/Outbound/UserScreenshots.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using PFire.Core.Protocol.Messages;
using PFire.Core.Protocol;
using PFire.Core.Session;
using System.Collections.Generic;
using System.Threading.Tasks;
using PFire.Core.Entities;

/*
* Packet 157 - Remote User Screenshots
* This is a list pulled from the server that are remote screenshots by the user.
* Interestingly, if you push the packet every log in, it will just add in the client itself.
*
*/

internal sealed class UserScreenshots : XFireMessage
{
public UserScreenshots() : base(XFireMessageType.UserScreenshots)
{
}

public UserScreenshots(IEnumerable<Screenshot> screenshots) : base(XFireMessageType.UserScreenshots)
{
foreach (var screen in screenshots)
{
ScreenshotIds.Add(screen.Id);
GameIds.Add(screen.GameId);
ServerIps.Add(screen.ServerIp);
GamePorts.Add(screen.ServerPort);
Descriptions.Add(screen.Description);
Created.Add(screen.CreatedUnixTimestamp);
LockedState.Add(screen.LockedState);
Filenames.Add(screen.FileName);
Filesizes.Add(screen.FileSize);
}
}

[XMessageField(0x5c)]
public List<int> ScreenshotIds { get; set; } = new();
[XMessageField(0x21)]
public List<int> GameIds { get; set; } = new();
[XMessageField(0x22)]
public List<int> ServerIps { get; set; } = new();
[XMessageField(0x23)]
public List<int> GamePorts { get; set; } = new();
[XMessageField(0x54)]
public List<string> Descriptions { get; set; } = new();
[XMessageField(0x50)]
public List<int> Created { get; set; } = new();
[XMessageField(0x5d)]
public List<int> LockedState { get; set; } = new();
[XMessageField(0x5e)]
public List<string> Filenames { get; set; } = new();
[XMessageField(0x55)]
public List<int> Filesizes { get; set; } = new();
}
1 change: 1 addition & 0 deletions src/PFire.Core/Protocol/Messages/XFireMessageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public enum XFireMessageType : short
FriendStatusChange = 154,
ChatRooms = 155,
FriendGameClientData = 156,
UserScreenshots = 157,
FriendNameChange = 161,
SystemBroadcast = 169,

Expand Down

0 comments on commit dfac7e9

Please sign in to comment.