ace/Source/ACE.Server/Network/GameEvent/Events/GameEventBookPageDataResponse.cs
Mag-nus bb8e6a9ac3
Improvements to help garbage collection (#4104)
* Enum ToSentence improvements

* Network.EnqueueSend improvements

* Improve SerializePhysicsData

* GameMessage improvements

* GameEventMessage updates

* more initial sizes

* Few more GameMessages

* few more
2024-03-13 02:37:40 +00:00

31 lines
1.3 KiB
C#

using ACE.Entity.Models;
namespace ACE.Server.Network.GameEvent.Events
{
public class GameEventBookPageDataResponse : GameEventMessage
{
public GameEventBookPageDataResponse(Session session, uint bookID, int pageIndex, PropertiesBookPageData pageData)
: base(GameEventType.BookPageDataResponse, GameMessageGroup.UIQueue, session, 512) // 465 is the average seen in retail pcaps, 1,084 is the max seen in retail pcaps
{
// unused?
Writer.Write(bookID);
Writer.Write(pageIndex);
Writer.Write(pageData.AuthorId);
Writer.WriteString16L(pageData.AuthorName);
// Check if player is admin and hide AuthorAccount if not. Potential security hole if we are sending out account usernames.
if (session.Player.IsAdmin)
Writer.WriteString16L(pageData.AuthorAccount);
else
Writer.WriteString16L("Password is cheese");
Writer.Write(0xFFFF0002); // flags
Writer.Write(1); // textIncluded - Will also be the case, even if we are sending an empty string.
if (pageData.IgnoreAuthor)
Writer.Write(1); // ignoreAuthor
else
Writer.Write(0); // ignoreAuthor
Writer.WriteString16L(pageData.PageText);
}
}
}