mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 02:08:20 +00:00
Address being able to friend yourself (#779)
* Address being able to friend yourself Fix an issue where players could friend themselves. Also stops yourself as appearing as a friend on your own friends list. * Send a Response instead Send a MYTHRAN response since the player is attempting to friend a Mythran.
This commit is contained in:
parent
409d682c9d
commit
f02e9c0f6a
@ -33,9 +33,10 @@ void ChatPacketHandler::HandleFriendlistRequest(Packet* packet) {
|
|||||||
"WHEN friend_id = ? THEN player_id "
|
"WHEN friend_id = ? THEN player_id "
|
||||||
"END AS requested_player, best_friend FROM friends) AS fr "
|
"END AS requested_player, best_friend FROM friends) AS fr "
|
||||||
"JOIN charinfo AS ci ON ci.id = fr.requested_player "
|
"JOIN charinfo AS ci ON ci.id = fr.requested_player "
|
||||||
"WHERE fr.requested_player IS NOT NULL;"));
|
"WHERE fr.requested_player IS NOT NULL AND fr.requested_player != ?;"));
|
||||||
stmt->setUInt(1, static_cast<uint32_t>(playerID));
|
stmt->setUInt(1, static_cast<uint32_t>(playerID));
|
||||||
stmt->setUInt(2, static_cast<uint32_t>(playerID));
|
stmt->setUInt(2, static_cast<uint32_t>(playerID));
|
||||||
|
stmt->setUInt(3, static_cast<uint32_t>(playerID));
|
||||||
|
|
||||||
std::vector<FriendData> friends;
|
std::vector<FriendData> friends;
|
||||||
|
|
||||||
@ -113,6 +114,10 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) {
|
|||||||
inStream.Read(isBestFriendRequest);
|
inStream.Read(isBestFriendRequest);
|
||||||
|
|
||||||
auto requestor = playerContainer.GetPlayerData(requestorPlayerID);
|
auto requestor = playerContainer.GetPlayerData(requestorPlayerID);
|
||||||
|
if (requestor->playerName == playerName) {
|
||||||
|
SendFriendResponse(requestor, requestor, AddFriendResponseType::MYTHRAN);
|
||||||
|
return;
|
||||||
|
};
|
||||||
std::unique_ptr<PlayerData> requestee(playerContainer.GetPlayerData(playerName));
|
std::unique_ptr<PlayerData> requestee(playerContainer.GetPlayerData(playerName));
|
||||||
|
|
||||||
// Check if player is online first
|
// Check if player is online first
|
||||||
|
Loading…
Reference in New Issue
Block a user