Grasscutter/src/main/java/emu/grasscutter/server/packet/send/PacketLifeStateChangeNotify.java

33 lines
1.1 KiB
Java
Raw Normal View History

2022-04-17 12:43:07 +00:00
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.entity.GameEntity;
2022-04-17 12:43:07 +00:00
import emu.grasscutter.game.props.LifeState;
import emu.grasscutter.net.packet.BasePacket;
2022-04-17 12:43:07 +00:00
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.LifeStateChangeNotifyOuterClass.LifeStateChangeNotify;
public class PacketLifeStateChangeNotify extends BasePacket {
public PacketLifeStateChangeNotify(GameEntity attacker, GameEntity target, LifeState lifeState) {
2022-04-17 12:43:07 +00:00
super(PacketOpcodes.LifeStateChangeNotify);
LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder()
.setEntityId(target.getId())
.setLifeState(lifeState.getValue())
.setSourceEntityId(attacker.getId())
.build();
this.setData(proto);
}
public PacketLifeStateChangeNotify(int attackerId, GameEntity target, LifeState lifeState) {
2022-04-17 12:43:07 +00:00
super(PacketOpcodes.LifeStateChangeNotify);
LifeStateChangeNotify proto = LifeStateChangeNotify.newBuilder()
.setEntityId(target.getId())
.setLifeState(lifeState.getValue())
.setSourceEntityId(attackerId)
.build();
this.setData(proto);
}
}