mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-04-26 08:36:30 +00:00
address feedback
This commit is contained in:
parent
b388b03251
commit
78e52904e5
@ -70,7 +70,7 @@ namespace Mail {
|
||||
}
|
||||
|
||||
void SendRequest::Handle() {
|
||||
SendResponse response(eSendResponse::UnknownError);
|
||||
SendResponse response;
|
||||
auto* character = player->GetCharacter();
|
||||
if (character && !(character->HasPermission(ePermissionMap::RestrictedMailAccess) || character->GetParentUser()->GetIsMuted())) {
|
||||
mailInfo.recipient = std::regex_replace(mailInfo.recipient, std::regex("[^0-9a-zA-Z]+"), "");
|
||||
@ -178,7 +178,7 @@ namespace Mail {
|
||||
}
|
||||
|
||||
void AttachmentCollectRequest::Handle() {
|
||||
auto response = AttachmentCollectResponse(eAttachmentCollectResponse::UnknownError);
|
||||
AttachmentCollectResponse response;
|
||||
auto inv = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (mailID > 0 && playerID == player->GetObjectID() && inv) {
|
||||
@ -211,8 +211,9 @@ namespace Mail {
|
||||
}
|
||||
|
||||
void DeleteRequest::Handle() {
|
||||
auto response = DeleteResponse(mailID);
|
||||
|
||||
DeleteResponse response;
|
||||
response.mailID = mailID;
|
||||
|
||||
auto mailData = Database::Get()->GetMail(mailID);
|
||||
if (mailData && !(mailData->itemLOT != 0 && mailData->itemCount > 0)) {
|
||||
Database::Get()->DeleteMail(mailID);
|
||||
@ -239,7 +240,8 @@ namespace Mail {
|
||||
}
|
||||
|
||||
void ReadRequest::Handle() {
|
||||
auto response = ReadResponse(mailID);
|
||||
ReadResponse response;
|
||||
response.mailID = mailID;
|
||||
|
||||
if (Database::Get()->GetMail(mailID)) {
|
||||
response.status = eReadResponse::Success;
|
||||
@ -255,7 +257,7 @@ namespace Mail {
|
||||
}
|
||||
|
||||
void NotificationRequest::Handle() {
|
||||
auto response = NotificationResponse(eNotificationResponse::UnknownError);
|
||||
NotificationResponse response;
|
||||
auto character = player->GetCharacter();
|
||||
if (character) {
|
||||
auto unreadMailCount = Database::Get()->GetUnreadMailCount(character->GetID());
|
||||
@ -352,6 +354,7 @@ void Mail::SendMail(const LWOOBJID sender, const std::string& senderName, LWOOBJ
|
||||
Database::Get()->InsertNewMail(mailInsert);
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) return; // TODO: Echo to chat server
|
||||
|
||||
NotificationResponse(eNotificationResponse::NewMail).Send(sysAddr);
|
||||
NotificationResponse response;
|
||||
response.status = eNotificationResponse::NewMail;
|
||||
response.Send(sysAddr);
|
||||
}
|
||||
|
@ -125,8 +125,6 @@ namespace Mail {
|
||||
|
||||
struct SendResponse :public MailLUBitStream {
|
||||
eSendResponse status = eSendResponse::UnknownError;
|
||||
|
||||
SendResponse(eSendResponse _status) : MailLUBitStream(eMessageID::SendResponse), status{_status} {};
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
};
|
||||
|
||||
@ -134,8 +132,7 @@ namespace Mail {
|
||||
eNotificationResponse status = eNotificationResponse::UnknownError;
|
||||
LWOOBJID auctionID = LWOOBJID_EMPTY;
|
||||
uint32_t mailCount = 1;
|
||||
NotificationResponse(eNotificationResponse _status) : MailLUBitStream(eMessageID::NotificationResponse), status{_status} {};
|
||||
NotificationResponse(eNotificationResponse _status, uint32_t _mailCount) : MailLUBitStream(eMessageID::NotificationResponse), status{_status}, mailCount{_mailCount} {};
|
||||
NotificationResponse() : MailLUBitStream(eMessageID::NotificationResponse) {};
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
};
|
||||
|
||||
@ -165,8 +162,7 @@ namespace Mail {
|
||||
struct AttachmentCollectResponse : public MailLUBitStream {
|
||||
eAttachmentCollectResponse status = eAttachmentCollectResponse::UnknownError;
|
||||
uint64_t mailID = 0;
|
||||
AttachmentCollectResponse(eAttachmentCollectResponse _status) : MailLUBitStream(eMessageID::AttachmentCollectResponse), status{_status} {};
|
||||
AttachmentCollectResponse(eAttachmentCollectResponse _status, uint64_t _mailID) : MailLUBitStream(eMessageID::AttachmentCollectResponse), status{_status}, mailID{_mailID} {};
|
||||
AttachmentCollectResponse() : MailLUBitStream(eMessageID::AttachmentCollectResponse) {};
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
};
|
||||
|
||||
@ -174,7 +170,6 @@ namespace Mail {
|
||||
uint64_t mailID = 0;
|
||||
LWOOBJID playerID = LWOOBJID_EMPTY;
|
||||
|
||||
|
||||
DeleteRequest() : MailLUBitStream(eMessageID::DeleteRequest) {};
|
||||
bool Deserialize(RakNet::BitStream& bitStream) override;
|
||||
void Handle() override;
|
||||
@ -183,8 +178,7 @@ namespace Mail {
|
||||
struct DeleteResponse : public MailLUBitStream {
|
||||
eDeleteResponse status = eDeleteResponse::UnknownError;
|
||||
uint64_t mailID = 0;
|
||||
DeleteResponse(uint64_t _mailID) : MailLUBitStream(eMessageID::DeleteResponse), mailID{_mailID} {};
|
||||
DeleteResponse(eDeleteResponse _status, uint64_t _mailID) : MailLUBitStream(eMessageID::DeleteResponse), status{_status}, mailID{_mailID} {};
|
||||
DeleteResponse() : MailLUBitStream(eMessageID::DeleteResponse) {};
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
};
|
||||
|
||||
@ -201,7 +195,6 @@ namespace Mail {
|
||||
eReadResponse status = eReadResponse::UnknownError;
|
||||
|
||||
ReadResponse() : MailLUBitStream(eMessageID::ReadResponse) {};
|
||||
ReadResponse(uint64_t _mailID) : MailLUBitStream(eMessageID::ReadResponse), mailID{_mailID} {};
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
};
|
||||
|
||||
|
@ -217,7 +217,10 @@ namespace GMZeroCommands {
|
||||
}
|
||||
|
||||
void RequestMailCount(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||
Mail::NotificationResponse(Mail::eNotificationResponse::NewMail, Database::Get()->GetUnreadMailCount(entity->GetCharacter()->GetID())).Send(sysAddr);
|
||||
Mail::NotificationResponse response;
|
||||
response.status = Mail::eNotificationResponse::NewMail;
|
||||
response.mailCount = Database::Get()->GetUnreadMailCount(entity->GetCharacter()->GetID());
|
||||
response.Send(sysAddr);
|
||||
}
|
||||
|
||||
void InstanceInfo(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||
|
@ -60,4 +60,4 @@ bool MailInfo::Deserialize(RakNet::BitStream& bitStream) {
|
||||
DluAssert(bitStream.GetNumberOfUnreadBits() == 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user