mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 21:10:54 +00:00
Added ChangeMailStarNotify (change importance level)
This commit is contained in:
parent
3a677ff6d2
commit
2e26e16d4d
@ -0,0 +1,35 @@
|
|||||||
|
package emu.grasscutter.server.packet.recv;
|
||||||
|
|
||||||
|
import emu.grasscutter.game.Mail;
|
||||||
|
import emu.grasscutter.net.packet.Opcodes;
|
||||||
|
import emu.grasscutter.net.packet.PacketHandler;
|
||||||
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
import emu.grasscutter.net.proto.ChangeMailStarNotifyOuterClass;
|
||||||
|
import emu.grasscutter.server.game.GameSession;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketMailChangeNotify;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Opcodes(PacketOpcodes.ChangeMailStarNotify)
|
||||||
|
public class HandlerChangeMailStarNotify extends PacketHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
|
ChangeMailStarNotifyOuterClass.ChangeMailStarNotify req = ChangeMailStarNotifyOuterClass.ChangeMailStarNotify.parseFrom(payload);
|
||||||
|
|
||||||
|
List<Mail> updatedMail = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int mailId : req.getMailIdListList()) {
|
||||||
|
Mail message = session.getPlayer().getMailById(mailId);
|
||||||
|
int messageIndex = session.getPlayer().getMailIndex(message);
|
||||||
|
|
||||||
|
message.importance = req.getIsStar() == true ? 1 : 0;
|
||||||
|
|
||||||
|
session.getPlayer().replaceMailByIndex(messageIndex, message);
|
||||||
|
updatedMail.add(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
session.send(new PacketMailChangeNotify(session.getPlayer(), updatedMail));
|
||||||
|
}
|
||||||
|
}
|
@ -18,5 +18,4 @@ public class HandlerGetAllMailReq extends PacketHandler {
|
|||||||
GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload);
|
GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload);
|
||||||
session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getIsGiftMail()));
|
session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getIsGiftMail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user