不能申请自己为好友

This commit is contained in:
hahwu 2025-07-10 18:30:49 +08:00
parent da2ae614f3
commit 642703bc6a

View File

@ -1489,6 +1489,13 @@ func ReqApplyFriend(player *Player, buf []byte) error {
proto.Unmarshal(buf, req) proto.Unmarshal(buf, req)
Uid := int(req.Uid) Uid := int(req.Uid)
FriendMod := player.PlayMod.getFriendMod() FriendMod := player.PlayMod.getFriendMod()
if Uid == int(player.M_DwUin) {
player.SendErrClienRes(&msg.ResApplyFriend{
Code: msg.RES_CODE_FAIL,
Msg: "cannot apply yourself",
})
return fmt.Errorf("cannot apply yourself")
}
if FriendMod.CheckFriend(Uid) { if FriendMod.CheckFriend(Uid) {
player.SendErrClienRes(&msg.ResApplyFriend{ player.SendErrClienRes(&msg.ResApplyFriend{
Code: msg.RES_CODE_FAIL, Code: msg.RES_CODE_FAIL,