mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-20 02:45:52 +01:00
Add drowning. Better movement ticking.
This commit is contained in:
@@ -9,6 +9,10 @@ import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.AvatarLifeStateChangeNotifyOuterClass.AvatarLifeStateChangeNotify;
|
||||
import emu.grasscutter.net.proto.PlayerDieTypeOuterClass.PlayerDieType;
|
||||
import emu.grasscutter.net.proto.ServerBuffOuterClass;
|
||||
import emu.grasscutter.net.proto.ServerBuffOuterClass.ServerBuff;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PacketAvatarLifeStateChangeNotify extends BasePacket {
|
||||
|
||||
@@ -22,7 +26,7 @@ public class PacketAvatarLifeStateChangeNotify extends BasePacket {
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
public PacketAvatarLifeStateChangeNotify(Avatar avatar,int attackerId,LifeState lifeState) {
|
||||
public PacketAvatarLifeStateChangeNotify(Avatar avatar, int attackerId, LifeState lifeState) {
|
||||
super(PacketOpcodes.AvatarLifeStateChangeNotify);
|
||||
|
||||
AvatarLifeStateChangeNotify proto = AvatarLifeStateChangeNotify.newBuilder()
|
||||
@@ -33,4 +37,26 @@ public class PacketAvatarLifeStateChangeNotify extends BasePacket {
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketAvatarLifeStateChangeNotify(Avatar avatar, LifeState lifeState, PlayerDieType dieType) {
|
||||
this(avatar, lifeState, null, "", dieType);
|
||||
}
|
||||
|
||||
public PacketAvatarLifeStateChangeNotify(Avatar avatar, LifeState lifeState, GameEntity sourceEntity,
|
||||
String attackTag, PlayerDieType dieType) {
|
||||
super(PacketOpcodes.AvatarLifeStateChangeNotify);
|
||||
|
||||
AvatarLifeStateChangeNotify.Builder proto = AvatarLifeStateChangeNotify.newBuilder();
|
||||
|
||||
proto.setAvatarGuid(avatar.getGuid());
|
||||
proto.setLifeState(lifeState.getValue());
|
||||
if (sourceEntity != null) {
|
||||
proto.setSourceEntityId(sourceEntity.getId());
|
||||
}
|
||||
proto.setDieType(dieType);
|
||||
proto.setAttackTag((attackTag));
|
||||
|
||||
this.setData(proto.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.game.avatar.Avatar;
|
||||
import emu.grasscutter.game.entity.GameEntity;
|
||||
import emu.grasscutter.game.props.LifeState;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.LifeStateChangeNotifyOuterClass.LifeStateChangeNotify;
|
||||
import emu.grasscutter.net.proto.PlayerDieTypeOuterClass.PlayerDieType;
|
||||
import emu.grasscutter.net.proto.ServerBuffOuterClass.ServerBuff;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PacketLifeStateChangeNotify extends BasePacket {
|
||||
public PacketLifeStateChangeNotify(GameEntity attacker, GameEntity target, LifeState lifeState) {
|
||||
@@ -26,7 +31,29 @@ public class PacketLifeStateChangeNotify extends BasePacket {
|
||||
.setLifeState(lifeState.getValue())
|
||||
.setSourceEntityId(attackerId)
|
||||
.build();
|
||||
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
|
||||
public PacketLifeStateChangeNotify(GameEntity entity, LifeState lifeState, PlayerDieType dieType) {
|
||||
this(entity, lifeState, null, "", dieType);
|
||||
}
|
||||
|
||||
public PacketLifeStateChangeNotify(GameEntity entity, LifeState lifeState, GameEntity sourceEntity,
|
||||
String attackTag, PlayerDieType dieType) {
|
||||
super(PacketOpcodes.LifeStateChangeNotify);
|
||||
|
||||
LifeStateChangeNotify.Builder proto = LifeStateChangeNotify.newBuilder();
|
||||
|
||||
|
||||
proto.setEntityId(entity.getId());
|
||||
proto.setLifeState(lifeState.getValue());
|
||||
if (sourceEntity != null) {
|
||||
proto.setSourceEntityId(sourceEntity.getId());
|
||||
}
|
||||
proto.setAttackTag(attackTag);
|
||||
proto.setDieType(dieType);
|
||||
|
||||
this.setData(proto.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.world.World;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.WorldPlayerReviveRspOuterClass.WorldPlayerReviveRsp;
|
||||
|
||||
public class PacketWorldPlayerReviveRsp extends BasePacket {
|
||||
|
||||
public PacketWorldPlayerReviveRsp() {
|
||||
super(PacketOpcodes.WorldPlayerReviveRsp);
|
||||
|
||||
WorldPlayerReviveRsp.Builder proto = WorldPlayerReviveRsp.newBuilder();
|
||||
|
||||
this.setData(proto.build());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user