mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-23 12:24:43 +01:00
optimize npc group load & fix some NPE in suite
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.game.entity.EntityNPC;
|
||||
import emu.grasscutter.data.binout.SceneNpcBornEntry;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.GroupSuiteNotifyOuterClass;
|
||||
@@ -10,14 +10,18 @@ import java.util.List;
|
||||
public class PacketGroupSuiteNotify extends BasePacket {
|
||||
|
||||
/**
|
||||
* control which npc suite is loaded
|
||||
* Real control which npc suite is loaded
|
||||
* EntityNPC is useless
|
||||
*/
|
||||
public PacketGroupSuiteNotify(List<EntityNPC> list) {
|
||||
public PacketGroupSuiteNotify(List<SceneNpcBornEntry> npcBornEntries) {
|
||||
super(PacketOpcodes.GroupSuiteNotify);
|
||||
|
||||
var proto = GroupSuiteNotifyOuterClass.GroupSuiteNotify.newBuilder();
|
||||
|
||||
list.forEach(item -> proto.putGroupMap(item.getGroupId(), item.getSuiteId()));
|
||||
npcBornEntries.forEach(x ->
|
||||
x.getSuiteIdList().forEach(y ->
|
||||
proto.putGroupMap(x.getGroupId(), y)
|
||||
));
|
||||
|
||||
this.setData(proto);
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.GroupUnloadNotifyOuterClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PacketGroupUnloadNotify extends BasePacket {
|
||||
|
||||
public PacketGroupUnloadNotify(List<Integer> groupList) {
|
||||
super(PacketOpcodes.GroupUnloadNotify);
|
||||
|
||||
var proto = GroupUnloadNotifyOuterClass.GroupUnloadNotify.newBuilder();
|
||||
|
||||
proto.addAllGroupList(groupList);
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user