[Anime Game Version update] Support 2.7 (#1072)

* feature(2.7 version): support 2.7 version & upload new protos

1. Support GC in GI 2.7.0;
2. Upload new protos;
3. Fix some bugs cuz by new protos.

BREAKING CHANGE: all

* fix(database helper): fix player uid issues

* fix(ability embryo): uint32 to fixed32

* fix(proto): map mark

rename MAP_MARK_FROM_TYPE_NOE to MAP_MARK_FROM_TYPE_NONE

* fix(game version): change game version to 2.7.0

* perf(proto): remove unused protos

1. Remove unused protos;
2. Temporarily commented out some of the proto fields.

* fix(proto): uint32 to fixed32
This commit is contained in:
Yazawazi 2022-05-28 14:58:12 +08:00 committed by Melledy
parent a95002fd40
commit f139818224
50 changed files with 1726 additions and 1727 deletions

View File

@ -6,7 +6,7 @@ import emu.grasscutter.utils.Position;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
public final class GameConstants { public final class GameConstants {
public static String VERSION = "2.6.0"; public static String VERSION = "2.7.0";
public static final int MAX_TEAMS = 4; public static final int MAX_TEAMS = 4;
public static final int MAIN_CHARACTER_MALE = 10000005; public static final int MAIN_CHARACTER_MALE = 10000005;

View File

@ -43,19 +43,19 @@ public class AbilityManager {
public void onAbilityInvoke(AbilityInvokeEntry invoke) throws Exception { public void onAbilityInvoke(AbilityInvokeEntry invoke) throws Exception {
// Grasscutter.getLogger().info(invoke.getArgumentType() + " (" + invoke.getArgumentTypeValue() + "): " + Utils.bytesToHex(invoke.toByteArray())); // Grasscutter.getLogger().info(invoke.getArgumentType() + " (" + invoke.getArgumentTypeValue() + "): " + Utils.bytesToHex(invoke.toByteArray()));
switch (invoke.getArgumentType()) { switch (invoke.getArgumentType()) {
case ABILITY_META_OVERRIDE_PARAM: case ABILITY_INVOKE_ARGUMENT_META_OVERRIDE_PARAM:
handleOverrideParam(invoke); handleOverrideParam(invoke);
break; break;
case ABILITY_META_REINIT_OVERRIDEMAP: case ABILITY_INVOKE_ARGUMENT_META_REINIT_OVERRIDEMAP:
handleReinitOverrideMap(invoke); handleReinitOverrideMap(invoke);
break; break;
case ABILITY_META_MODIFIER_CHANGE: case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_CHANGE:
handleModifierChange(invoke); handleModifierChange(invoke);
break; break;
case ABILITY_MIXIN_COST_STAMINA: case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA:
handleMixinCostStamina(invoke); handleMixinCostStamina(invoke);
break; break;
case ABILITY_ACTION_GENERATE_ELEM_BALL: case ABILITY_INVOKE_ARGUMENT_ACTION_GENERATE_ELEM_BALL:
handleGenerateElemBall(invoke); handleGenerateElemBall(invoke);
break; break;
default: default:

View File

@ -106,15 +106,15 @@ public class EntityAvatar extends GameEntity {
@Override @Override
public void onDeath(int killerId) { public void onDeath(int killerId) {
this.killedType = PlayerDieType.PLAYER_DIE_KILL_BY_MONSTER; this.killedType = PlayerDieType.PLAYER_DIE_TYPE_KILL_BY_MONSTER;
this.killedBy = killerId; this.killedBy = killerId;
clearEnergy(PropChangeReason.PROP_CHANGE_STATUE_RECOVER); clearEnergy(PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER);
} }
public void onDeath(PlayerDieType dieType, int killerId) { public void onDeath(PlayerDieType dieType, int killerId) {
this.killedType = dieType; this.killedType = dieType;
this.killedBy = killerId; this.killedBy = killerId;
clearEnergy(PropChangeReason.PROP_CHANGE_STATUE_RECOVER); clearEnergy(PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER);
} }
@Override @Override
@ -123,7 +123,7 @@ public class EntityAvatar extends GameEntity {
if (healed > 0f) { if (healed > 0f) {
getScene().broadcastPacket( getScene().broadcastPacket(
new PacketEntityFightPropChangeReasonNotify(this, FightProperty.FIGHT_PROP_CUR_HP, healed, PropChangeReason.PROP_CHANGE_ABILITY, ChangeHpReason.ChangeHpAddAbility) new PacketEntityFightPropChangeReasonNotify(this, FightProperty.FIGHT_PROP_CUR_HP, healed, PropChangeReason.PROP_CHANGE_REASON_ABILITY, ChangeHpReason.CHANGE_HP_REASON_CHANGE_HP_ADD_ABILITY)
); );
} }
@ -209,7 +209,7 @@ public class EntityAvatar extends GameEntity {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder() SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId()) .setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_AVATAR) .setEntityType(ProtEntityType.PROT_ENTITY_TYPE_AVATAR)
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder()) .addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder()) .setEntityClientData(EntityClientData.newBuilder())
.setEntityAuthorityInfo(authority) .setEntityAuthorityInfo(authority)

View File

@ -127,7 +127,7 @@ public class EntityClientGadget extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder() SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId()) .setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_GADGET) .setEntityType(ProtEntityType.PROT_ENTITY_TYPE_GADGET)
.setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder())) .setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder()) .addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder()) .setEntityClientData(EntityClientData.newBuilder())

View File

@ -122,7 +122,7 @@ public class EntityGadget extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder() SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId()) .setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_GADGET) .setEntityType(ProtEntityType.PROT_ENTITY_TYPE_GADGET)
.setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder())) .setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder()) .addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder()) .setEntityClientData(EntityClientData.newBuilder())

View File

@ -111,7 +111,7 @@ public class EntityItem extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder() SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId()) .setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_GADGET) .setEntityType(ProtEntityType.PROT_ENTITY_TYPE_GADGET)
.setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder())) .setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder()) .addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder()) .setEntityClientData(EntityClientData.newBuilder())
@ -127,7 +127,7 @@ public class EntityItem extends EntityBaseGadget {
SceneGadgetInfo.Builder gadgetInfo = SceneGadgetInfo.newBuilder() SceneGadgetInfo.Builder gadgetInfo = SceneGadgetInfo.newBuilder()
.setGadgetId(this.getItemData().getGadgetId()) .setGadgetId(this.getItemData().getGadgetId())
.setTrifleItem(this.getItem().toProto()) .setTrifleItem(this.getItem().toProto())
.setBornType(GadgetBornType.GADGET_BORN_IN_AIR) .setBornType(GadgetBornType.GADGET_BORN_TYPE_IN_AIR)
.setAuthorityPeerId(this.getWorld().getHostPeerId()) .setAuthorityPeerId(this.getWorld().getHostPeerId())
.setIsEnableInteract(true); .setIsEnableInteract(true);

View File

@ -211,7 +211,7 @@ public class EntityMonster extends GameEntity {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder() SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId()) .setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_MONSTER) .setEntityType(ProtEntityType.PROT_ENTITY_TYPE_MONSTER)
.setMotionInfo(this.getMotionInfo()) .setMotionInfo(this.getMotionInfo())
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder()) .addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder()) .setEntityClientData(EntityClientData.newBuilder())
@ -240,7 +240,7 @@ public class EntityMonster extends GameEntity {
.setAuthorityPeerId(getWorld().getHostPeerId()) .setAuthorityPeerId(getWorld().getHostPeerId())
.setPoseId(this.getPoseId()) .setPoseId(this.getPoseId())
.setBlockId(3001) .setBlockId(3001)
.setBornType(MonsterBornType.MONSTER_BORN_DEFAULT) .setBornType(MonsterBornType.MONSTER_BORN_TYPE_DEFAULT)
.setSpecialNameId(40); .setSpecialNameId(40);
if (getMonsterData().getDescribeData() != null) { if (getMonsterData().getDescribeData() != null) {

View File

@ -106,7 +106,7 @@ public class EntityVehicle extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder() SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId()) .setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_GADGET) .setEntityType(ProtEntityType.PROT_ENTITY_TYPE_GADGET)
.setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder())) .setMotionInfo(MotionInfo.newBuilder().setPos(getPosition().toProto()).setRot(getRotation().toProto()).setSpeed(Vector.newBuilder()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder()) .addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setGadget(gadgetInfo) .setGadget(gadgetInfo)

View File

@ -37,7 +37,7 @@ public abstract class GameEntity {
public GameEntity(Scene scene) { public GameEntity(Scene scene) {
this.scene = scene; this.scene = scene;
this.moveState = MotionState.MOTION_NONE; this.moveState = MotionState.MOTION_STATE_NONE;
} }
public int getId() { public int getId() {

View File

@ -104,7 +104,7 @@ public class FriendsList {
} }
// Handle // Handle
if (result == DealAddFriendResultType.DEAL_ADD_FRIEND_ACCEPT) { // Request accepted if (result == DealAddFriendResultType.DEAL_ADD_FRIEND_RESULT_TYPE_ACCEPT) { // Request accepted
myFriendship.setIsFriend(true); myFriendship.setIsFriend(true);
theirFriendship.setIsFriend(true); theirFriendship.setIsFriend(true);

View File

@ -95,13 +95,13 @@ public class Friendship {
.setProfilePicture(ProfilePicture.newBuilder().setAvatarId(getFriendProfile().getAvatarId())) .setProfilePicture(ProfilePicture.newBuilder().setAvatarId(getFriendProfile().getAvatarId()))
.setWorldLevel(getFriendProfile().getWorldLevel()) .setWorldLevel(getFriendProfile().getWorldLevel())
.setSignature(getFriendProfile().getSignature()) .setSignature(getFriendProfile().getSignature())
.setOnlineState(getFriendProfile().isOnline() ? FriendOnlineState.FRIEND_ONLINE : FriendOnlineState.FREIEND_DISCONNECT) .setOnlineState(getFriendProfile().isOnline() ? FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE : FriendOnlineState.FRIEND_ONLINE_STATE_FREIEND_DISCONNECT)
.setIsMpModeAvailable(true) .setIsMpModeAvailable(true)
.setLastActiveTime(getFriendProfile().getLastActiveTime()) .setLastActiveTime(getFriendProfile().getLastActiveTime())
.setNameCardId(getFriendProfile().getNameCard()) .setNameCardId(getFriendProfile().getNameCard())
.setParam(getFriendProfile().getDaysSinceLogin()) .setParam(getFriendProfile().getDaysSinceLogin())
.setIsGameSource(true) .setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PC) .setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.build(); .build();
return proto; return proto;

View File

@ -167,7 +167,7 @@ public class GachaBanner {
.setGachaTimesLimit(Integer.MAX_VALUE) .setGachaTimesLimit(Integer.MAX_VALUE)
.setGachaSortId(this.getSortId()); .setGachaSortId(this.getSortId());
if (this.getTitlePath() != null) { if (this.getTitlePath() != null) {
info.setGachaTitlePath(this.getTitlePath()); info.setTitleTextmap(this.getTitlePath());
} }
if (this.getRateUpItems5().length > 0) { if (this.getRateUpItems5().length > 0) {
@ -175,7 +175,7 @@ public class GachaBanner {
for (int id : getRateUpItems5()) { for (int id : getRateUpItems5()) {
upInfo.addItemIdList(id); upInfo.addItemIdList(id);
info.addMainNameId(id); info.addDisplayUp5ItemList(id);
} }
info.addGachaUpInfoList(upInfo); info.addGachaUpInfoList(upInfo);
@ -186,8 +186,8 @@ public class GachaBanner {
for (int id : getRateUpItems4()) { for (int id : getRateUpItems4()) {
upInfo.addItemIdList(id); upInfo.addItemIdList(id);
if (info.getSubNameIdCount() == 0) { if (info.getDisplayUp4ItemListCount() == 0) {
info.addSubNameId(id); info.addDisplayUp4ItemList(id);
} }
} }

View File

@ -253,7 +253,7 @@ public class EnergyManager {
float elementBonus = (ballElement == null) ? 2.0f : (avatarElement == ballElement) ? 3.0f : 1.0f; float elementBonus = (ballElement == null) ? 2.0f : (avatarElement == ballElement) ? 3.0f : 1.0f;
// Add the energy. // Add the energy.
entity.addEnergy(baseEnergy * elementBonus * offFieldPenalty * elemBall.getCount(), PropChangeReason.PROP_CHANGE_ENERGY_BALL); entity.addEnergy(baseEnergy * elementBonus * offFieldPenalty * elemBall.getCount(), PropChangeReason.PROP_CHANGE_REASON_ENERGY_BALL);
} }
} }
@ -268,7 +268,7 @@ public class EnergyManager {
// If the cast skill was a burst, consume energy. // If the cast skill was a burst, consume energy.
if (avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) { if (avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) {
avatar.getAsEntity().clearEnergy(PropChangeReason.PROP_CHANGE_ABILITY); avatar.getAsEntity().clearEnergy(PropChangeReason.PROP_CHANGE_REASON_ABILITY);
} }
} }

View File

@ -24,7 +24,7 @@ public class MapMarksManager {
public void handleMapMarkReq(MarkMapReq req) { public void handleMapMarkReq(MarkMapReq req) {
Operation op = req.getOp(); Operation op = req.getOp();
switch (op) { switch (op) {
case ADD -> { case OPERATION_ADD -> {
MapMark createMark = new MapMark(req.getMark()); MapMark createMark = new MapMark(req.getMark());
// keep teleporting functionality on fishhook mark. // keep teleporting functionality on fishhook mark.
if (createMark.getMapMarkPointType() == MapMarkPointType.MAP_MARK_POINT_TYPE_FISH_POOL) { if (createMark.getMapMarkPointType() == MapMarkPointType.MAP_MARK_POINT_TYPE_FISH_POOL) {
@ -33,18 +33,18 @@ public class MapMarksManager {
} }
addMapMark(createMark); addMapMark(createMark);
} }
case MOD -> { case OPERATION_MOD -> {
MapMark oldMark = new MapMark(req.getOld()); MapMark oldMark = new MapMark(req.getOld());
removeMapMark(oldMark.getPosition()); removeMapMark(oldMark.getPosition());
MapMark newMark = new MapMark(req.getMark()); MapMark newMark = new MapMark(req.getMark());
addMapMark(newMark); addMapMark(newMark);
} }
case DEL -> { case OPERATION_DEL -> {
MapMark deleteMark = new MapMark(req.getMark()); MapMark deleteMark = new MapMark(req.getMark());
removeMapMark(deleteMark.getPosition()); removeMapMark(deleteMark.getPosition());
} }
} }
if (op != Operation.GET) { if (op != Operation.OPERATION_GET) {
saveMapMarks(); saveMapMarks();
} }
player.getSession().send(new PacketMarkMapRsp(getMapMarks())); player.getSession().send(new PacketMarkMapRsp(getMapMarks()));

View File

@ -27,7 +27,7 @@ public class MultiplayerManager {
public void applyEnterMp(Player player, int targetUid) { public void applyEnterMp(Player player, int targetUid) {
Player target = getServer().getPlayerByUid(targetUid); Player target = getServer().getPlayerByUid(targetUid);
if (target == null) { if (target == null) {
player.sendPacket(new PacketPlayerApplyEnterMpResultNotify(targetUid, "", false, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.PLAYER_CANNOT_ENTER_MP)); player.sendPacket(new PacketPlayerApplyEnterMpResultNotify(targetUid, "", false, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.REASON_PLAYER_CANNOT_ENTER_MP));
return; return;
} }
@ -72,12 +72,12 @@ public class MultiplayerManager {
// Sanity checks - Dont let the requesting player join if they are already in multiplayer // Sanity checks - Dont let the requesting player join if they are already in multiplayer
if (requester.getWorld().isMultiplayer()) { if (requester.getWorld().isMultiplayer()) {
request.getRequester().sendPacket(new PacketPlayerApplyEnterMpResultNotify(hostPlayer, false, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.PLAYER_CANNOT_ENTER_MP)); request.getRequester().sendPacket(new PacketPlayerApplyEnterMpResultNotify(hostPlayer, false, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.REASON_PLAYER_CANNOT_ENTER_MP));
return; return;
} }
// Response packet // Response packet
request.getRequester().sendPacket(new PacketPlayerApplyEnterMpResultNotify(hostPlayer, isAgreed, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.PLAYER_JUDGE)); request.getRequester().sendPacket(new PacketPlayerApplyEnterMpResultNotify(hostPlayer, isAgreed, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.REASON_PLAYER_JUDGE));
// Declined // Declined
if (!isAgreed) { if (!isAgreed) {
@ -93,7 +93,7 @@ public class MultiplayerManager {
world.addPlayer(hostPlayer); world.addPlayer(hostPlayer);
// Rejoin packet // Rejoin packet
hostPlayer.sendPacket(new PacketPlayerEnterSceneNotify(hostPlayer, hostPlayer, EnterType.ENTER_SELF, EnterReason.HostFromSingleToMp, hostPlayer.getScene().getId(), hostPlayer.getPos())); hostPlayer.sendPacket(new PacketPlayerEnterSceneNotify(hostPlayer, hostPlayer, EnterType.ENTER_TYPE_SELF, EnterReason.HostFromSingleToMp, hostPlayer.getScene().getId(), hostPlayer.getPos()));
} }
// Set scene pos and id of requester to the host player's // Set scene pos and id of requester to the host player's
@ -105,7 +105,7 @@ public class MultiplayerManager {
hostPlayer.getWorld().addPlayer(requester); hostPlayer.getWorld().addPlayer(requester);
// Packet // Packet
requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, hostPlayer, EnterType.ENTER_OTHER, EnterReason.TeamJoin, hostPlayer.getScene().getId(), hostPlayer.getPos())); requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, hostPlayer, EnterType.ENTER_TYPE_OTHER, EnterReason.TeamJoin, hostPlayer.getScene().getId(), hostPlayer.getPos()));
} }
public boolean leaveCoop(Player player) { public boolean leaveCoop(Player player) {
@ -126,7 +126,7 @@ public class MultiplayerManager {
world.addPlayer(player); world.addPlayer(player);
// Packet // Packet
player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.ENTER_SELF, EnterReason.TeamBack, player.getScene().getId(), player.getPos())); player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterType.ENTER_TYPE_SELF, EnterReason.TeamBack, player.getScene().getId(), player.getPos()));
return true; return true;
} }
@ -153,7 +153,7 @@ public class MultiplayerManager {
World world = new World(victim); World world = new World(victim);
world.addPlayer(victim); world.addPlayer(victim);
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.ENTER_SELF, EnterReason.TeamKick, victim.getScene().getId(), victim.getPos())); victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.ENTER_TYPE_SELF, EnterReason.TeamKick, victim.getScene().getId(), victim.getPos()));
return true; return true;
} }
} }

View File

@ -158,8 +158,8 @@ public class SotSManager {
logger.trace("Healing avatar " + entity.getAvatar().getAvatarData().getName() + " +" + needHP); logger.trace("Healing avatar " + entity.getAvatar().getAvatarData().getName() + " +" + needHP);
player.getTeamManager().healAvatar(entity.getAvatar(), 0, needHP); player.getTeamManager().healAvatar(entity.getAvatar(), 0, needHP);
player.getSession().send(new PacketEntityFightPropChangeReasonNotify(entity, FightProperty.FIGHT_PROP_CUR_HP, player.getSession().send(new PacketEntityFightPropChangeReasonNotify(entity, FightProperty.FIGHT_PROP_CUR_HP,
((float) needHP / 100), List.of(3), PropChangeReason.PROP_CHANGE_STATUE_RECOVER, ((float) needHP / 100), List.of(3), PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER,
ChangeHpReason.ChangeHpAddStatue)); ChangeHpReason.CHANGE_HP_REASON_CHANGE_HP_ADD_STATUE));
player.getSession().send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); player.getSession().send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
} }

View File

@ -31,81 +31,81 @@ public class StaminaManager {
private final Player player; private final Player player;
private static final HashMap<String, HashSet<MotionState>> MotionStatesCategorized = new HashMap<>() {{ private static final HashMap<String, HashSet<MotionState>> MotionStatesCategorized = new HashMap<>() {{
put("CLIMB", new HashSet<>(List.of( put("CLIMB", new HashSet<>(List.of(
MotionState.MOTION_CLIMB, // sustained, when not moving no cost no recover MotionState.MOTION_STATE_CLIMB, // sustained, when not moving no cost no recover
MotionState.MOTION_STANDBY_TO_CLIMB // NOT OBSERVED, see MOTION_JUMP_UP_WALL_FOR_STANDBY MotionState.MOTION_STATE_STANDBY_TO_CLIMB // NOT OBSERVED, see MOTION_JUMP_UP_WALL_FOR_STANDBY
))); )));
put("DASH", new HashSet<>(List.of( put("DASH", new HashSet<>(List.of(
MotionState.MOTION_DANGER_DASH, // sustained MotionState.MOTION_STATE_DANGER_DASH, // sustained
MotionState.MOTION_DASH // sustained MotionState.MOTION_STATE_DASH // sustained
))); )));
put("FLY", new HashSet<>(List.of( put("FLY", new HashSet<>(List.of(
MotionState.MOTION_FLY, // sustained MotionState.MOTION_STATE_FLY, // sustained
MotionState.MOTION_FLY_FAST, // sustained MotionState.MOTION_STATE_FLY_FAST, // sustained
MotionState.MOTION_FLY_SLOW, // sustained MotionState.MOTION_STATE_FLY_SLOW, // sustained
MotionState.MOTION_POWERED_FLY // sustained, recover MotionState.MOTION_STATE_POWERED_FLY // sustained, recover
))); )));
put("RUN", new HashSet<>(List.of( put("RUN", new HashSet<>(List.of(
MotionState.MOTION_DANGER_RUN, // sustained, recover MotionState.MOTION_STATE_DANGER_RUN, // sustained, recover
MotionState.MOTION_RUN // sustained, recover MotionState.MOTION_STATE_RUN // sustained, recover
))); )));
put("SKIFF", new HashSet<>(List.of( put("SKIFF", new HashSet<>(List.of(
MotionState.MOTION_SKIFF_BOARDING, // NOT OBSERVED even when boarding MotionState.MOTION_STATE_SKIFF_BOARDING, // NOT OBSERVED even when boarding
MotionState.MOTION_SKIFF_DASH, // sustained, observed with waverider entity ID. MotionState.MOTION_STATE_SKIFF_DASH, // sustained, observed with waverider entity ID.
MotionState.MOTION_SKIFF_NORMAL, // sustained, OBSERVED when both normal and dashing MotionState.MOTION_STATE_SKIFF_NORMAL, // sustained, OBSERVED when both normal and dashing
MotionState.MOTION_SKIFF_POWERED_DASH // sustained, recover MotionState.MOTION_STATE_SKIFF_POWERED_DASH // sustained, recover
))); )));
put("STANDBY", new HashSet<>(List.of( put("STANDBY", new HashSet<>(List.of(
MotionState.MOTION_DANGER_STANDBY_MOVE, // sustained, recover MotionState.MOTION_STATE_DANGER_STANDBY_MOVE, // sustained, recover
MotionState.MOTION_DANGER_STANDBY, // sustained, recover MotionState.MOTION_STATE_DANGER_STANDBY, // sustained, recover
MotionState.MOTION_LADDER_TO_STANDBY, // NOT OBSERVED MotionState.MOTION_STATE_LADDER_TO_STANDBY, // NOT OBSERVED
MotionState.MOTION_STANDBY_MOVE, // sustained, recover MotionState.MOTION_STATE_STANDBY_MOVE, // sustained, recover
MotionState.MOTION_STANDBY // sustained, recover MotionState.MOTION_STATE_STANDBY // sustained, recover
))); )));
put("SWIM", new HashSet<>(List.of( put("SWIM", new HashSet<>(List.of(
MotionState.MOTION_SWIM_IDLE, // sustained MotionState.MOTION_STATE_SWIM_IDLE, // sustained
MotionState.MOTION_SWIM_DASH, // immediate and sustained MotionState.MOTION_STATE_SWIM_DASH, // immediate and sustained
MotionState.MOTION_SWIM_JUMP, // NOT OBSERVED MotionState.MOTION_STATE_SWIM_JUMP, // NOT OBSERVED
MotionState.MOTION_SWIM_MOVE // sustained MotionState.MOTION_STATE_SWIM_MOVE // sustained
))); )));
put("WALK", new HashSet<>(List.of( put("WALK", new HashSet<>(List.of(
MotionState.MOTION_DANGER_WALK, // sustained, recover MotionState.MOTION_STATE_DANGER_WALK, // sustained, recover
MotionState.MOTION_WALK // sustained, recover MotionState.MOTION_STATE_WALK // sustained, recover
))); )));
put("OTHER", new HashSet<>(List.of( put("OTHER", new HashSet<>(List.of(
MotionState.MOTION_CLIMB_JUMP, // cost only once if repeated without switching state MotionState.MOTION_STATE_CLIMB_JUMP, // cost only once if repeated without switching state
MotionState.MOTION_DASH_BEFORE_SHAKE, // immediate one time sprint charge. MotionState.MOTION_STATE_DASH_BEFORE_SHAKE, // immediate one time sprint charge.
MotionState.MOTION_FIGHT, // immediate, if sustained then subsequent will be MOTION_NOTIFY MotionState.MOTION_STATE_FIGHT, // immediate, if sustained then subsequent will be MOTION_NOTIFY
MotionState.MOTION_JUMP_UP_WALL_FOR_STANDBY, // immediate, observed when RUN/WALK->CLIMB MotionState.MOTION_STATE_JUMP_UP_WALL_FOR_STANDBY, // immediate, observed when RUN/WALK->CLIMB
MotionState.MOTION_NOTIFY, // can be either cost or recover - check previous state and check skill casting MotionState.MOTION_STATE_NOTIFY, // can be either cost or recover - check previous state and check skill casting
MotionState.MOTION_SIT_IDLE, // sustained, recover MotionState.MOTION_STATE_SIT_IDLE, // sustained, recover
MotionState.MOTION_JUMP // recover MotionState.MOTION_STATE_JUMP // recover
))); )));
put("NOCOST_NORECOVER", new HashSet<>(List.of( put("NOCOST_NORECOVER", new HashSet<>(List.of(
MotionState.MOTION_LADDER_SLIP, // NOT OBSERVED MotionState.MOTION_STATE_LADDER_SLIP, // NOT OBSERVED
MotionState.MOTION_SLIP, // sustained, no cost no recover MotionState.MOTION_STATE_SLIP, // sustained, no cost no recover
MotionState.MOTION_FLY_IDLE // NOT OBSERVED MotionState.MOTION_STATE_FLY_IDLE // NOT OBSERVED
))); )));
put("IGNORE", new HashSet<>(List.of( put("IGNORE", new HashSet<>(List.of(
// these states have no impact on stamina // these states have no impact on stamina
MotionState.MOTION_CROUCH_IDLE, MotionState.MOTION_STATE_CROUCH_IDLE,
MotionState.MOTION_CROUCH_MOVE, MotionState.MOTION_STATE_CROUCH_MOVE,
MotionState.MOTION_CROUCH_ROLL, MotionState.MOTION_STATE_CROUCH_ROLL,
MotionState.MOTION_DESTROY_VEHICLE, MotionState.MOTION_STATE_DESTROY_VEHICLE,
MotionState.MOTION_FALL_ON_GROUND, MotionState.MOTION_STATE_FALL_ON_GROUND,
MotionState.MOTION_FOLLOW_ROUTE, MotionState.MOTION_STATE_FOLLOW_ROUTE,
MotionState.MOTION_FORCE_SET_POS, MotionState.MOTION_STATE_FORCE_SET_POS,
MotionState.MOTION_GO_UPSTAIRS, MotionState.MOTION_STATE_GO_UPSTAIRS,
MotionState.MOTION_JUMP_OFF_WALL, MotionState.MOTION_STATE_JUMP_OFF_WALL,
MotionState.MOTION_LADDER_IDLE, MotionState.MOTION_STATE_LADDER_IDLE,
MotionState.MOTION_LADDER_MOVE, MotionState.MOTION_STATE_LADDER_MOVE,
MotionState.MOTION_LAND_SPEED, MotionState.MOTION_STATE_LAND_SPEED,
MotionState.MOTION_MOVE_FAIL_ACK, MotionState.MOTION_STATE_MOVE_FAIL_ACK,
MotionState.MOTION_NONE, MotionState.MOTION_STATE_NONE,
MotionState.MOTION_NUM, MotionState.MOTION_STATE_NUM,
MotionState.MOTION_QUEST_FORCE_DRAG, MotionState.MOTION_STATE_QUEST_FORCE_DRAG,
MotionState.MOTION_RESET, MotionState.MOTION_STATE_RESET,
MotionState.MOTION_STANDBY_TO_LADDER, MotionState.MOTION_STATE_STANDBY_TO_LADDER,
MotionState.MOTION_WATERFALL MotionState.MOTION_STATE_WATERFALL
))); )));
}}; }};
@ -114,8 +114,8 @@ public class StaminaManager {
public final static int GlobalVehicleMaxStamina = 24000; public final static int GlobalVehicleMaxStamina = 24000;
private Position currentCoordinates = new Position(0, 0, 0); private Position currentCoordinates = new Position(0, 0, 0);
private Position previousCoordinates = new Position(0, 0, 0); private Position previousCoordinates = new Position(0, 0, 0);
private MotionState currentState = MotionState.MOTION_STANDBY; private MotionState currentState = MotionState.MOTION_STATE_STANDBY;
private MotionState previousState = MotionState.MOTION_STANDBY; private MotionState previousState = MotionState.MOTION_STATE_STANDBY;
private Timer sustainedStaminaHandlerTimer; private Timer sustainedStaminaHandlerTimer;
private GameSession cachedSession = null; private GameSession cachedSession = null;
private GameEntity cachedEntity = null; private GameEntity cachedEntity = null;
@ -406,7 +406,7 @@ public class StaminaManager {
} }
public void handleVehicleInteractReq(GameSession session, int vehicleId, VehicleInteractType vehicleInteractType) { public void handleVehicleInteractReq(GameSession session, int vehicleId, VehicleInteractType vehicleInteractType) {
if (vehicleInteractType == VehicleInteractType.VEHICLE_INTERACT_IN) { if (vehicleInteractType == VehicleInteractType.VEHICLE_INTERACT_TYPE_IN) {
this.vehicleId = vehicleId; this.vehicleId = vehicleId;
// Reset character stamina here to prevent falling into water immediately on ejection if char stamina is // Reset character stamina here to prevent falling into water immediately on ejection if char stamina is
// close to empty when boarding. // close to empty when boarding.
@ -421,23 +421,23 @@ public class StaminaManager {
private void handleImmediateStamina(GameSession session, @NotNull MotionState motionState) { private void handleImmediateStamina(GameSession session, @NotNull MotionState motionState) {
switch (motionState) { switch (motionState) {
case MOTION_CLIMB: case MOTION_STATE_CLIMB:
if (currentState != MotionState.MOTION_CLIMB) { if (currentState != MotionState.MOTION_STATE_CLIMB) {
updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_START), true); updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_START), true);
} }
break; break;
case MOTION_DASH_BEFORE_SHAKE: case MOTION_STATE_DASH_BEFORE_SHAKE:
if (previousState != MotionState.MOTION_DASH_BEFORE_SHAKE) { if (previousState != MotionState.MOTION_STATE_DASH_BEFORE_SHAKE) {
updateStaminaRelative(session, new Consumption(ConsumptionType.SPRINT), true); updateStaminaRelative(session, new Consumption(ConsumptionType.SPRINT), true);
} }
break; break;
case MOTION_CLIMB_JUMP: case MOTION_STATE_CLIMB_JUMP:
if (previousState != MotionState.MOTION_CLIMB_JUMP) { if (previousState != MotionState.MOTION_STATE_CLIMB_JUMP) {
updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_JUMP), true); updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_JUMP), true);
} }
break; break;
case MOTION_SWIM_DASH: case MOTION_STATE_SWIM_DASH:
if (previousState != MotionState.MOTION_SWIM_DASH) { if (previousState != MotionState.MOTION_STATE_SWIM_DASH) {
updateStaminaRelative(session, new Consumption(ConsumptionType.SWIM_DASH_START), true); updateStaminaRelative(session, new Consumption(ConsumptionType.SWIM_DASH_START), true);
} }
break; break;
@ -526,8 +526,8 @@ public class StaminaManager {
if (stamina < 10) { if (stamina < 10) {
logger.trace(getCurrentCharacterStamina() + "/" + logger.trace(getCurrentCharacterStamina() + "/" +
getMaxCharacterStamina() + "\t" + currentState); getMaxCharacterStamina() + "\t" + currentState);
if (currentState != MotionState.MOTION_SWIM_IDLE) { if (currentState != MotionState.MOTION_STATE_SWIM_IDLE) {
killAvatar(cachedSession, cachedEntity, PlayerDieType.PLAYER_DIE_DRAWN); killAvatar(cachedSession, cachedEntity, PlayerDieType.PLAYER_DIE_TYPE_DRAWN);
} }
} }
} }
@ -568,7 +568,7 @@ public class StaminaManager {
private Consumption getClimbConsumption() { private Consumption getClimbConsumption() {
Consumption consumption = new Consumption(); Consumption consumption = new Consumption();
if (currentState == MotionState.MOTION_CLIMB && isPlayerMoving()) { if (currentState == MotionState.MOTION_STATE_CLIMB && isPlayerMoving()) {
consumption.type = ConsumptionType.CLIMBING; consumption.type = ConsumptionType.CLIMBING;
consumption.amount = ConsumptionType.CLIMBING.amount; consumption.amount = ConsumptionType.CLIMBING.amount;
} }
@ -581,11 +581,11 @@ public class StaminaManager {
private Consumption getSwimConsumptions() { private Consumption getSwimConsumptions() {
handleDrowning(); handleDrowning();
Consumption consumption = new Consumption(); Consumption consumption = new Consumption();
if (currentState == MotionState.MOTION_SWIM_MOVE) { if (currentState == MotionState.MOTION_STATE_SWIM_MOVE) {
consumption.type = ConsumptionType.SWIMMING; consumption.type = ConsumptionType.SWIMMING;
consumption.amount = ConsumptionType.SWIMMING.amount; consumption.amount = ConsumptionType.SWIMMING.amount;
} }
if (currentState == MotionState.MOTION_SWIM_DASH) { if (currentState == MotionState.MOTION_STATE_SWIM_DASH) {
consumption.type = ConsumptionType.SWIM_DASH; consumption.type = ConsumptionType.SWIM_DASH;
consumption.amount = ConsumptionType.SWIM_DASH.amount; consumption.amount = ConsumptionType.SWIM_DASH.amount;
} }
@ -597,7 +597,7 @@ public class StaminaManager {
private Consumption getDashConsumption() { private Consumption getDashConsumption() {
Consumption consumption = new Consumption(); Consumption consumption = new Consumption();
if (currentState == MotionState.MOTION_DASH) { if (currentState == MotionState.MOTION_STATE_DASH) {
consumption.type = ConsumptionType.DASH; consumption.type = ConsumptionType.DASH;
consumption.amount = ConsumptionType.DASH.amount; consumption.amount = ConsumptionType.DASH.amount;
// Dashing specific reductions // Dashing specific reductions
@ -608,7 +608,7 @@ public class StaminaManager {
private Consumption getFlyConsumption() { private Consumption getFlyConsumption() {
// POWERED_FLY, e.g. wind tunnel // POWERED_FLY, e.g. wind tunnel
if (currentState == MotionState.MOTION_POWERED_FLY) { if (currentState == MotionState.MOTION_STATE_POWERED_FLY) {
return new Consumption(ConsumptionType.POWERED_FLY); return new Consumption(ConsumptionType.POWERED_FLY);
} }
Consumption consumption = new Consumption(ConsumptionType.FLY); Consumption consumption = new Consumption(ConsumptionType.FLY);
@ -621,21 +621,21 @@ public class StaminaManager {
private Consumption getSkiffConsumption() { private Consumption getSkiffConsumption() {
// No known reduction for skiffing. // No known reduction for skiffing.
return switch (currentState) { return switch (currentState) {
case MOTION_SKIFF_DASH -> new Consumption(ConsumptionType.SKIFF_DASH); case MOTION_STATE_SKIFF_DASH -> new Consumption(ConsumptionType.SKIFF_DASH);
case MOTION_SKIFF_POWERED_DASH -> new Consumption(ConsumptionType.POWERED_SKIFF); case MOTION_STATE_SKIFF_POWERED_DASH -> new Consumption(ConsumptionType.POWERED_SKIFF);
case MOTION_SKIFF_NORMAL -> new Consumption(ConsumptionType.SKIFF); case MOTION_STATE_SKIFF_NORMAL -> new Consumption(ConsumptionType.SKIFF);
default -> new Consumption(); default -> new Consumption();
}; };
} }
private Consumption getOtherConsumptions() { private Consumption getOtherConsumptions() {
switch (currentState) { switch (currentState) {
case MOTION_NOTIFY: case MOTION_STATE_NOTIFY:
// if (BowSkills.contains(lastSkillId)) { // if (BowSkills.contains(lastSkillId)) {
// return new Consumption(ConsumptionType.FIGHT, 500); // return new Consumption(ConsumptionType.FIGHT, 500);
// } // }
break; break;
case MOTION_FIGHT: case MOTION_STATE_FIGHT:
// TODO: what if charged attack // TODO: what if charged attack
return new Consumption(ConsumptionType.FIGHT, 500); return new Consumption(ConsumptionType.FIGHT, 500);
} }

View File

@ -21,9 +21,9 @@ public class InvokeHandler<T> {
public synchronized void addEntry(ForwardType forward, T entry) { public synchronized void addEntry(ForwardType forward, T entry) {
switch (forward) { switch (forward) {
case FORWARD_TO_ALL -> entryListForwardAll.add(entry); case FORWARD_TYPE_TO_ALL -> entryListForwardAll.add(entry);
case FORWARD_TO_ALL_EXCEPT_CUR, FORWARD_TO_ALL_EXIST_EXCEPT_CUR -> entryListForwardAllExceptCur.add(entry); case FORWARD_TYPE_TO_ALL_EXCEPT_CUR, FORWARD_TYPE_TO_ALL_EXIST_EXCEPT_CUR -> entryListForwardAllExceptCur.add(entry);
case FORWARD_TO_HOST -> entryListForwardHost.add(entry); case FORWARD_TYPE_TO_HOST -> entryListForwardHost.add(entry);
default -> { default -> {
} }
} }

View File

@ -510,7 +510,7 @@ public class Player {
} }
public MpSettingType getMpSetting() { public MpSettingType getMpSetting() {
return MpSettingType.MP_SETTING_ENTER_AFTER_APPLY; // TEMP return MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; // TEMP
} }
public Queue<AttackResult> getAttackResults() { public Queue<AttackResult> getAttackResults() {
@ -928,9 +928,9 @@ public class Player {
boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop); boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop);
if (success) { if (success) {
if (!drop.isShare()) // not shared drop if (!drop.isShare()) // not shared drop
this.sendPacket(new PacketGadgetInteractRsp(drop, InteractType.INTERACT_PICK_ITEM)); this.sendPacket(new PacketGadgetInteractRsp(drop, InteractType.INTERACT_TYPE_PICK_ITEM));
else else
this.getScene().broadcastPacket(new PacketGadgetInteractRsp(drop, InteractType.INTERACT_PICK_ITEM)); this.getScene().broadcastPacket(new PacketGadgetInteractRsp(drop, InteractType.INTERACT_TYPE_PICK_ITEM));
} }
} else if (entity instanceof EntityGadget) { } else if (entity instanceof EntityGadget) {
EntityGadget gadget = (EntityGadget) entity; EntityGadget gadget = (EntityGadget) entity;
@ -940,7 +940,7 @@ public class Player {
scene.getChallenge().getStatueDrops(this); scene.getChallenge().getStatueDrops(this);
} }
this.sendPacket(new PacketGadgetInteractRsp(gadget, InteractType.INTERACT_OPEN_STATUE)); this.sendPacket(new PacketGadgetInteractRsp(gadget, InteractType.INTERACT_TYPE_OPEN_STATUE));
} }
} else { } else {
// Delete directly // Delete directly
@ -1131,7 +1131,10 @@ public class Player {
while (it.hasNext()) { while (it.hasNext()) {
CoopRequest req = it.next(); CoopRequest req = it.next();
if (req.isExpired()) { if (req.isExpired()) {
req.getRequester().sendPacket(new PacketPlayerApplyEnterMpResultNotify(this, false, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.SYSTEM_JUDGE)); req.getRequester().sendPacket(new PacketPlayerApplyEnterMpResultNotify(
this,
false,
PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason.REASON_SYSTEM_JUDGE));
it.remove(); it.remove();
} }
} }

View File

@ -554,7 +554,7 @@ public class TeamManager {
this.setCurrentCharacterIndex(index); this.setCurrentCharacterIndex(index);
// Old entity motion state // Old entity motion state
oldEntity.setMotionState(MotionState.MOTION_STANDBY); oldEntity.setMotionState(MotionState.MOTION_STATE_STANDBY);
// Remove and Add // Remove and Add
getPlayer().getScene().replaceEntity(oldEntity, newEntity); getPlayer().getScene().replaceEntity(oldEntity, newEntity);
@ -571,7 +571,7 @@ public class TeamManager {
PlayerDieType dieType = deadAvatar.getKilledType(); PlayerDieType dieType = deadAvatar.getKilledType();
int killedBy = deadAvatar.getKilledBy(); int killedBy = deadAvatar.getKilledBy();
if (dieType == PlayerDieType.PLAYER_DIE_DRAWN) { if (dieType == PlayerDieType.PLAYER_DIE_TYPE_DRAWN) {
// Died in water. Do not replace // Died in water. Do not replace
// The official server has skipped this notify and will just respawn the team immediately after the animation. // The official server has skipped this notify and will just respawn the team immediately after the animation.
// TODO: Perhaps find a way to get vanilla experience? // TODO: Perhaps find a way to get vanilla experience?
@ -669,7 +669,7 @@ public class TeamManager {
} }
// Teleport player // Teleport player
getPlayer().sendPacket(new PacketPlayerEnterSceneNotify(getPlayer(), EnterType.ENTER_SELF, EnterReason.Revival, 3, GameConstants.START_POSITION)); getPlayer().sendPacket(new PacketPlayerEnterSceneNotify(getPlayer(), EnterType.ENTER_TYPE_SELF, EnterReason.Revival, 3, GameConstants.START_POSITION));
// Set player position // Set player position
player.setSceneId(3); player.setSceneId(3);

View File

@ -284,7 +284,7 @@ public class Scene {
private void removePlayerAvatars(Player player) { private void removePlayerAvatars(Player player) {
Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator(); Iterator<EntityAvatar> it = player.getTeamManager().getActiveTeam().iterator();
while (it.hasNext()) { while (it.hasNext()) {
this.removeEntity(it.next(), VisionType.VISION_REMOVE); this.removeEntity(it.next(), VisionType.VISION_TYPE_REMOVE);
it.remove(); it.remove();
} }
} }
@ -327,7 +327,7 @@ public class Scene {
this.addEntityDirectly(entity); this.addEntityDirectly(entity);
} }
this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_BORN)); this.broadcastPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_TYPE_BORN));
} }
private GameEntity removeEntityDirectly(GameEntity entity) { private GameEntity removeEntityDirectly(GameEntity entity) {
@ -335,7 +335,7 @@ public class Scene {
} }
public void removeEntity(GameEntity entity) { public void removeEntity(GameEntity entity) {
this.removeEntity(entity, VisionType.VISION_DIE); this.removeEntity(entity, VisionType.VISION_TYPE_DIE);
} }
public synchronized void removeEntity(GameEntity entity, VisionType visionType) { public synchronized void removeEntity(GameEntity entity, VisionType visionType) {
@ -348,8 +348,8 @@ public class Scene {
public synchronized void replaceEntity(EntityAvatar oldEntity, EntityAvatar newEntity) { public synchronized void replaceEntity(EntityAvatar oldEntity, EntityAvatar newEntity) {
this.removeEntityDirectly(oldEntity); this.removeEntityDirectly(oldEntity);
this.addEntityDirectly(newEntity); this.addEntityDirectly(newEntity);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(oldEntity, VisionType.VISION_REPLACE)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(oldEntity, VisionType.VISION_TYPE_REPLACE));
this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_REPLACE, oldEntity.getId())); this.broadcastPacket(new PacketSceneEntityAppearNotify(newEntity, VisionType.VISION_TYPE_REPLACE, oldEntity.getId()));
} }
public void showOtherEntities(Player player) { public void showOtherEntities(Player player) {
@ -363,7 +363,7 @@ public class Scene {
entities.add(entity); entities.add(entity);
} }
player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_MEET)); player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_TYPE_MEET));
} }
public void handleAttack(AttackResult result) { public void handleAttack(AttackResult result) {
@ -487,11 +487,11 @@ public class Scene {
if (toAdd.size() > 0) { if (toAdd.size() > 0) {
toAdd.stream().forEach(this::addEntityDirectly); toAdd.stream().forEach(this::addEntityDirectly);
this.broadcastPacket(new PacketSceneEntityAppearNotify(toAdd, VisionType.VISION_BORN)); this.broadcastPacket(new PacketSceneEntityAppearNotify(toAdd, VisionType.VISION_TYPE_BORN));
} }
if (toRemove.size() > 0) { if (toRemove.size() > 0) {
toRemove.stream().forEach(this::removeEntityDirectly); toRemove.stream().forEach(this::removeEntityDirectly);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_REMOVE)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_TYPE_REMOVE));
} }
} }
@ -564,7 +564,7 @@ public class Scene {
if (toRemove.size() > 0) { if (toRemove.size() > 0) {
toRemove.stream().forEach(this::removeEntityDirectly); toRemove.stream().forEach(this::removeEntityDirectly);
this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_REMOVE)); this.broadcastPacket(new PacketSceneEntityDisappearNotify(toRemove, VisionType.VISION_TYPE_REMOVE));
} }
for (SceneGroup group : block.groups) { for (SceneGroup group : block.groups) {
@ -609,7 +609,7 @@ public class Scene {
return; return;
} }
this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityDisappearNotify(gadget, VisionType.VISION_DIE)); this.broadcastPacketToOthers(gadget.getOwner(), new PacketSceneEntityDisappearNotify(gadget, VisionType.VISION_TYPE_DIE));
} }
// Broadcasting // Broadcasting

View File

@ -193,7 +193,7 @@ public class World implements Iterable<Player> {
World world = new World(victim); World world = new World(victim);
world.addPlayer(victim); world.addPlayer(victim);
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.ENTER_SELF, EnterReason.TeamKick, victim.getSceneId(), victim.getPos())); victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterType.ENTER_TYPE_SELF, EnterReason.TeamKick, victim.getSceneId(), victim.getPos()));
} }
} }
} }
@ -260,17 +260,17 @@ public class World implements Iterable<Player> {
} }
// Get enter types // Get enter types
EnterType enterType = EnterType.ENTER_JUMP; EnterType enterType = EnterType.ENTER_TYPE_JUMP;
EnterReason enterReason = EnterReason.TransPoint; EnterReason enterReason = EnterReason.TransPoint;
if (dungeonData != null) { if (dungeonData != null) {
enterType = EnterType.ENTER_DUNGEON; enterType = EnterType.ENTER_TYPE_DUNGEON;
enterReason = EnterReason.DungeonEnter; enterReason = EnterReason.DungeonEnter;
} else if (oldScene == newScene) { } else if (oldScene == newScene) {
enterType = EnterType.ENTER_GOTO; enterType = EnterType.ENTER_TYPE_GOTO;
} else if (newScene.getSceneType() == SceneType.SCENE_HOME_WORLD) { } else if (newScene.getSceneType() == SceneType.SCENE_HOME_WORLD) {
// Home // Home
enterType = EnterType.ENTER_SELF_HOME; enterType = EnterType.ENTER_TYPE_SELF_HOME;
} }
// Teleport packet // Teleport packet

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,7 @@ public final class PlayerHook {
public void teleport(Position position) { public void teleport(Position position) {
this.player.getPos().set(position); this.player.getPos().set(position);
this.player.sendPacket(new PacketPlayerEnterSceneNotify(this.player, this.player.sendPacket(new PacketPlayerEnterSceneNotify(this.player,
EnterType.ENTER_JUMP, EnterReason.TransPoint, EnterType.ENTER_TYPE_JUMP, EnterReason.TransPoint,
this.player.getSceneId(), position this.player.getSceneId(), position
)); ));
} }

View File

@ -71,7 +71,7 @@ public class LuaSerializer implements Serializer {
try { try {
//noinspection ConfusingArgumentToVarargsMethod //noinspection ConfusingArgumentToVarargsMethod
object = type.getDeclaredConstructor().newInstance(null); object = type.getDeclaredConstructor().newInstance();
LuaValue[] keys = table.keys(); LuaValue[] keys = table.keys();
for (LuaValue k : keys) { for (LuaValue k : keys) {

View File

@ -21,6 +21,7 @@ import emu.grasscutter.utils.Utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Stream;
@Opcodes(PacketOpcodes.BuyGoodsReq) @Opcodes(PacketOpcodes.BuyGoodsReq)
public class HandlerBuyGoodsReq extends PacketHandler { public class HandlerBuyGoodsReq extends PacketHandler {
@ -33,7 +34,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
return; return;
// Don't trust your users' input // Don't trust your users' input
List<Integer> targetShopGoodsId = buyGoodsReq.getGoodsListList().stream().map(ShopGoodsOuterClass.ShopGoods::getGoodsId).toList(); List<Integer> targetShopGoodsId = List.of(buyGoodsReq.getGoods().getGoodsId());
for (int goodsId : targetShopGoodsId) { for (int goodsId : targetShopGoodsId) {
Optional<ShopInfo> sg2 = configShop.stream().filter(x -> x.getGoodsId() == goodsId).findFirst(); Optional<ShopInfo> sg2 = configShop.stream().filter(x -> x.getGoodsId() == goodsId).findFirst();
if (sg2.isEmpty()) if (sg2.isEmpty())
@ -52,7 +53,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
session.getPlayer().save(); session.getPlayer().save();
} }
if ((bought + buyGoodsReq.getBoughtNum() > sg.getBuyLimit()) && sg.getBuyLimit() != 0) { if ((bought + buyGoodsReq.getBuyCount() > sg.getBuyLimit()) && sg.getBuyLimit() != 0) {
return; return;
} }
@ -60,15 +61,15 @@ public class HandlerBuyGoodsReq extends PacketHandler {
costs.add(new ItemParamData(202, sg.getScoin())); costs.add(new ItemParamData(202, sg.getScoin()));
costs.add(new ItemParamData(201, sg.getHcoin())); costs.add(new ItemParamData(201, sg.getHcoin()));
costs.add(new ItemParamData(203, sg.getMcoin())); costs.add(new ItemParamData(203, sg.getMcoin()));
if (!session.getPlayer().getInventory().payItems(costs.toArray(new ItemParamData[0]), buyGoodsReq.getBoughtNum())) { if (!session.getPlayer().getInventory().payItems(costs.toArray(new ItemParamData[0]), buyGoodsReq.getBuyCount())) {
return; return;
} }
session.getPlayer().addShopLimit(sg.getGoodsId(), buyGoodsReq.getBoughtNum(), ShopManager.getShopNextRefreshTime(sg)); session.getPlayer().addShopLimit(sg.getGoodsId(), buyGoodsReq.getBuyCount(), ShopManager.getShopNextRefreshTime(sg));
GameItem item = new GameItem(GameData.getItemDataMap().get(sg.getGoodsItem().getId())); GameItem item = new GameItem(GameData.getItemDataMap().get(sg.getGoodsItem().getId()));
item.setCount(buyGoodsReq.getBoughtNum() * sg.getGoodsItem().getCount()); item.setCount(buyGoodsReq.getBuyCount() * sg.getGoodsItem().getCount());
session.getPlayer().getInventory().addItem(item, ActionReason.Shop, true); // fix: not notify when got virtual item from shop session.getPlayer().getInventory().addItem(item, ActionReason.Shop, true); // fix: not notify when got virtual item from shop
session.send(new PacketBuyGoodsRsp(buyGoodsReq.getShopType(), session.getPlayer().getGoodsLimit(sg.getGoodsId()).getHasBoughtInPeriod(), buyGoodsReq.getGoodsListList().stream().filter(x -> x.getGoodsId() == goodsId).findFirst().get())); session.send(new PacketBuyGoodsRsp(buyGoodsReq.getShopType(), session.getPlayer().getGoodsLimit(sg.getGoodsId()).getHasBoughtInPeriod(), Stream.of(buyGoodsReq.getGoods()).filter(x -> x.getGoodsId() == goodsId).findFirst().get()));
} }
session.getPlayer().save(); session.getPlayer().save();

View File

@ -28,12 +28,12 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
CombatInvocationsNotify notif = CombatInvocationsNotify.parseFrom(payload); CombatInvocationsNotify notif = CombatInvocationsNotify.parseFrom(payload);
for (CombatInvokeEntry entry : notif.getInvokeListList()) { for (CombatInvokeEntry entry : notif.getInvokeListList()) {
switch (entry.getArgumentType()) { switch (entry.getArgumentType()) {
case COMBAT_EVT_BEING_HIT: case COMBAT_TYPE_ARGUMENT_EVT_BEING_HIT:
// Handle damage // Handle damage
EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData()); EvtBeingHitInfo hitInfo = EvtBeingHitInfo.parseFrom(entry.getCombatData());
session.getPlayer().getAttackResults().add(hitInfo.getAttackResult()); session.getPlayer().getAttackResults().add(hitInfo.getAttackResult());
break; break;
case ENTITY_MOVE: case COMBAT_TYPE_ARGUMENT_ENTITY_MOVE:
// Handle movement // Handle movement
EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData()); EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData());
GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId()); GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId());
@ -55,13 +55,13 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
// MOTION_LAND_SPEED and MOTION_FALL_ON_GROUND arrive in different packets. // MOTION_LAND_SPEED and MOTION_FALL_ON_GROUND arrive in different packets.
// Cache land speed for later use. // Cache land speed for later use.
if (motionState == MotionState.MOTION_LAND_SPEED) { if (motionState == MotionState.MOTION_STATE_LAND_SPEED) {
cachedLandingSpeed = motionInfo.getSpeed().getY(); cachedLandingSpeed = motionInfo.getSpeed().getY();
cachedLandingTimeMillisecond = System.currentTimeMillis(); cachedLandingTimeMillisecond = System.currentTimeMillis();
monitorLandingEvent = true; monitorLandingEvent = true;
} }
if (monitorLandingEvent) { if (monitorLandingEvent) {
if (motionState == MotionState.MOTION_FALL_ON_GROUND) { if (motionState == MotionState.MOTION_STATE_FALL_ON_GROUND) {
monitorLandingEvent = false; monitorLandingEvent = false;
handleFallOnGround(session, entity, motionState); handleFallOnGround(session, entity, motionState);
} }
@ -119,7 +119,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP); entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, newHP);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
if (newHP == 0) { if (newHP == 0) {
session.getPlayer().getStaminaManager().killAvatar(session, entity, PlayerDieTypeOuterClass.PlayerDieType.PLAYER_DIE_FALL); session.getPlayer().getStaminaManager().killAvatar(session, entity, PlayerDieTypeOuterClass.PlayerDieType.PLAYER_DIE_TYPE_FALL);
} }
cachedLandingSpeed = 0; cachedLandingSpeed = 0;
} }

View File

@ -16,6 +16,6 @@ public class HandlerCreateVehicleReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
CreateVehicleReqOuterClass.CreateVehicleReq req = CreateVehicleReqOuterClass.CreateVehicleReq.parseFrom(payload); CreateVehicleReqOuterClass.CreateVehicleReq req = CreateVehicleReqOuterClass.CreateVehicleReq.parseFrom(payload);
session.send(new PacketCreateVehicleRsp(session.getPlayer(), req.getVehicleId(), req.getPointId(), new Position(req.getPos()), new Position(req.getRot()))); session.send(new PacketCreateVehicleRsp(session.getPlayer(), req.getVehicleId(), req.getScenePointId(), new Position(req.getPos()), new Position(req.getRot())));
} }
} }

View File

@ -16,6 +16,6 @@ public class HandlerGetAllMailReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
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.getANKKGPJCINB()));
} }
} }

View File

@ -15,13 +15,13 @@ public class HandlerMcoinExchangeHcoinReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq exchangeReq = McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq.parseFrom(payload); McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq exchangeReq = McoinExchangeHcoinReqOuterClass.McoinExchangeHcoinReq.parseFrom(payload);
if (session.getPlayer().getCrystals() < exchangeReq.getMCoinNum() && exchangeReq.getMCoinNum() == exchangeReq.getHCoinNum()) { if (session.getPlayer().getCrystals() < exchangeReq.getMcoinCost() && exchangeReq.getMcoinCost() == exchangeReq.getHcoin()) {
session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_UNKNOWN_ERROR_VALUE)); session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_UNKNOWN_ERROR_VALUE));
return; return;
} }
session.getPlayer().setCrystals(session.getPlayer().getCrystals() - exchangeReq.getMCoinNum()); session.getPlayer().setCrystals(session.getPlayer().getCrystals() - exchangeReq.getMcoinCost());
session.getPlayer().setPrimogems(session.getPlayer().getPrimogems() + exchangeReq.getHCoinNum()); session.getPlayer().setPrimogems(session.getPlayer().getPrimogems() + exchangeReq.getHcoin());
session.getPlayer().save(); session.getPlayer().save();
session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_SUCC_VALUE)); session.send(new PacketMcoinExchangeHcoinRsp(RetcodeOuterClass.Retcode.RET_SUCC_VALUE));
} }

View File

@ -21,7 +21,7 @@ public class HandlerSetWidgetSlotReq extends PacketHandler {
player.setWidgetId(req.getMaterialId()); player.setWidgetId(req.getMaterialId());
// WidgetSlotChangeNotify op & slot key // WidgetSlotChangeNotify op & slot key
session.send(new PacketWidgetSlotChangeNotify(WidgetSlotOpOuterClass.WidgetSlotOp.DETACH)); session.send(new PacketWidgetSlotChangeNotify(WidgetSlotOpOuterClass.WidgetSlotOp.WIDGET_SLOT_OP_DETACH));
// WidgetSlotChangeNotify slot // WidgetSlotChangeNotify slot
session.send(new PacketWidgetSlotChangeNotify(req.getMaterialId())); session.send(new PacketWidgetSlotChangeNotify(req.getMaterialId()));

View File

@ -46,7 +46,7 @@ public class PacketAllWidgetDataNotify extends BasePacket {
proto.addSlotList( proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder() WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_ATTACH_AVATAR) .setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_TAG_ATTACH_AVATAR)
.build() .build()
); );
} }

View File

@ -11,7 +11,7 @@ public class PacketBuyGoodsRsp extends BasePacket {
BuyGoodsRspOuterClass.BuyGoodsRsp buyGoodsRsp = BuyGoodsRspOuterClass.BuyGoodsRsp.newBuilder() BuyGoodsRspOuterClass.BuyGoodsRsp buyGoodsRsp = BuyGoodsRspOuterClass.BuyGoodsRsp.newBuilder()
.setShopType(shopType) .setShopType(shopType)
.setBoughtNum(boughtNum) .setBuyCount(boughtNum)
.addGoodsList(ShopGoodsOuterClass.ShopGoods.newBuilder() .addGoodsList(ShopGoodsOuterClass.ShopGoods.newBuilder()
.mergeFrom(sg) .mergeFrom(sg)
.setBoughtNum(boughtNum) .setBoughtNum(boughtNum)

View File

@ -1,6 +1,5 @@
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.entity.EntityVehicle; import emu.grasscutter.game.entity.EntityVehicle;
import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.FightProperty;
@ -9,6 +8,7 @@ import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.VehicleInteractTypeOuterClass;
import emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember; import emu.grasscutter.net.proto.VehicleMemberOuterClass.VehicleMember;
import emu.grasscutter.net.proto.CreateVehicleRspOuterClass.CreateVehicleRsp; import emu.grasscutter.net.proto.CreateVehicleRspOuterClass.CreateVehicleRsp;
@ -16,9 +16,6 @@ import emu.grasscutter.utils.Position;
import java.util.List; import java.util.List;
import static emu.grasscutter.net.proto.VehicleInteractTypeOuterClass.VehicleInteractType.VEHICLE_INTERACT_OUT;
public class PacketCreateVehicleRsp extends BasePacket { public class PacketCreateVehicleRsp extends BasePacket {
public PacketCreateVehicleRsp(Player player, int vehicleId, int pointId, Position pos, Position rot) { public PacketCreateVehicleRsp(Player player, int vehicleId, int pointId, Position pos, Position rot) {
@ -36,7 +33,7 @@ public class PacketCreateVehicleRsp extends BasePacket {
List<VehicleMember> vehicleMembers = ((EntityVehicle) entity).getVehicleMembers().stream().toList(); List<VehicleMember> vehicleMembers = ((EntityVehicle) entity).getVehicleMembers().stream().toList();
vehicleMembers.stream().forEach(vehicleMember -> { vehicleMembers.stream().forEach(vehicleMember -> {
player.getScene().broadcastPacket(new PacketVehicleInteractRsp(((EntityVehicle) entity), vehicleMember, VEHICLE_INTERACT_OUT)); player.getScene().broadcastPacket(new PacketVehicleInteractRsp(((EntityVehicle) entity), vehicleMember, VehicleInteractTypeOuterClass.VehicleInteractType.VEHICLE_INTERACT_TYPE_OUT));
}); });
player.getScene().killEntity(entity, 0); player.getScene().killEntity(entity, 0);

View File

@ -13,7 +13,7 @@ public class PacketDungeonChallengeFinishNotify extends BasePacket {
DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder() DungeonChallengeFinishNotify proto = DungeonChallengeFinishNotify.newBuilder()
.setChallengeIndex(challenge.getChallengeIndex()) .setChallengeIndex(challenge.getChallengeIndex())
.setIsSuccess(challenge.isSuccess()) .setIsSuccess(challenge.isSuccess())
.setUnk1(2) .setChallengeRecordType(2)
.build(); .build();
this.setData(proto); this.setData(proto);

View File

@ -29,10 +29,10 @@ public class PacketDungeonSettleNotify extends BasePacket {
) { ) {
super(PacketOpcodes.DungeonSettleNotify); super(PacketOpcodes.DungeonSettleNotify);
var continueStatus = TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_CAN_NOT_CONTINUE_VALUE; var continueStatus = TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_NOT_CONTINUE_VALUE;
if(challenge.isSuccess() && canJump){ if(challenge.isSuccess() && canJump){
continueStatus = hasNextLevel ? TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_CAN_ENTER_NEXT_LEVEL_VALUE continueStatus = hasNextLevel ? TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_ENTER_NEXT_LEVEL_VALUE
: TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_CAN_ENTER_NEXT_FLOOR_VALUE; : TowerLevelEndNotify.ContinueStateType.CONTINUE_STATE_TYPE_CAN_ENTER_NEXT_FLOOR_VALUE;
} }
var towerLevelEndNotify = TowerLevelEndNotify.newBuilder() var towerLevelEndNotify = TowerLevelEndNotify.newBuilder()

View File

@ -12,7 +12,7 @@ public class PacketEvtAvatarStandUpNotify extends BasePacket {
EvtAvatarStandUpNotify proto = EvtAvatarStandUpNotify.newBuilder() EvtAvatarStandUpNotify proto = EvtAvatarStandUpNotify.newBuilder()
.setEntityId(notify.getEntityId()) .setEntityId(notify.getEntityId())
.setDirection(notify.getDirection()) .setDirection(notify.getDirection())
.setPerformID(notify.getPerformID()) .setPerformId(notify.getPerformId())
.setChairId(notify.getChairId()) .setChairId(notify.getChairId())
.build(); .build();

View File

@ -5,6 +5,7 @@ import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EquipParamOuterClass;
import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp; import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp;
import emu.grasscutter.net.proto.ItemParamOuterClass; import emu.grasscutter.net.proto.ItemParamOuterClass;
import emu.grasscutter.net.proto.MailDataOuterClass; import emu.grasscutter.net.proto.MailDataOuterClass;
@ -23,9 +24,9 @@ public class PacketGetAllMailRsp extends BasePacket {
GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder(); GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder();
if (isGiftMail) { if (isGiftMail) {
proto.setIsGiftMail(true); proto.setANKKGPJCINB(true);
} else { } else {
proto.setIsGiftMail(false); proto.setANKKGPJCINB(false);
if (player.getAllMail().size() != 0) { // Make sure the player has mail if (player.getAllMail().size() != 0) { // Make sure the player has mail
List<MailData> mailDataList = new ArrayList<MailData>(); List<MailData> mailDataList = new ArrayList<MailData>();
@ -43,10 +44,10 @@ public class PacketGetAllMailRsp extends BasePacket {
for (Mail.MailItem item : message.itemList) { for (Mail.MailItem item : message.itemList) {
MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder(); MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder();
ItemParamOuterClass.ItemParam.Builder itemParam = ItemParamOuterClass.ItemParam.newBuilder(); EquipParamOuterClass.EquipParam.Builder itemParam = EquipParamOuterClass.EquipParam.newBuilder();
itemParam.setItemId(item.itemId); itemParam.setItemId(item.itemId);
itemParam.setCount(item.itemCount); itemParam.setItemNum(item.itemCount);
mailItem.setItemParam(itemParam.build()); mailItem.setEquipParam(itemParam.build());
mailItems.add(mailItem.build()); mailItems.add(mailItem.build());
} }
@ -60,7 +61,7 @@ public class PacketGetAllMailRsp extends BasePacket {
mailData.setImportance(message.importance); mailData.setImportance(message.importance);
mailData.setIsRead(message.isRead); mailData.setIsRead(message.isRead);
mailData.setIsAttachmentGot(message.isAttachmentGot); mailData.setIsAttachmentGot(message.isAttachmentGot);
mailData.setStateValue(1); mailData.setBHCAHLJIKFFValue(1);
mailDataList.add(mailData.build()); mailDataList.add(mailData.build());
} }

View File

@ -28,10 +28,10 @@ public class PacketGetPlayerFriendListRsp extends BasePacket {
.setSignature(serverAccount.signature) .setSignature(serverAccount.signature)
.setLastActiveTime((int) (System.currentTimeMillis() / 1000f)) .setLastActiveTime((int) (System.currentTimeMillis() / 1000f))
.setNameCardId(serverAccount.nameCardId) .setNameCardId(serverAccount.nameCardId)
.setOnlineState(FriendOnlineState.FRIEND_ONLINE) .setOnlineState(FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE)
.setParam(1) .setParam(1)
.setIsGameSource(true) .setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PC) .setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.build(); .build();
GetPlayerFriendListRsp.Builder proto = GetPlayerFriendListRsp.newBuilder().addFriendList(serverFriend); GetPlayerFriendListRsp.Builder proto = GetPlayerFriendListRsp.newBuilder().addFriendList(serverFriend);

View File

@ -29,7 +29,7 @@ public class PacketGetWidgetSlotRsp extends BasePacket {
proto.addSlotList( proto.addSlotList(
WidgetSlotDataOuterClass.WidgetSlotData.newBuilder() WidgetSlotDataOuterClass.WidgetSlotData.newBuilder()
.setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_ATTACH_AVATAR) .setTag(WidgetSlotTagOuterClass.WidgetSlotTag.WIDGET_SLOT_TAG_ATTACH_AVATAR)
.build() .build()
); );
} }

View File

@ -37,10 +37,10 @@ public class PacketMailChangeNotify extends BasePacket {
for (Mail.MailItem item : message.itemList) { for (Mail.MailItem item : message.itemList) {
MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder(); MailItemOuterClass.MailItem.Builder mailItem = MailItemOuterClass.MailItem.newBuilder();
ItemParamOuterClass.ItemParam.Builder itemParam = ItemParamOuterClass.ItemParam.newBuilder(); EquipParamOuterClass.EquipParam.Builder itemParam = EquipParamOuterClass.EquipParam.newBuilder();
itemParam.setItemId(item.itemId); itemParam.setItemId(item.itemId);
itemParam.setCount(item.itemCount); itemParam.setItemNum(item.itemCount);
mailItem.setItemParam(itemParam.build()); mailItem.setEquipParam(itemParam.build());
mailItems.add(mailItem.build()); mailItems.add(mailItem.build());
} }
@ -54,7 +54,7 @@ public class PacketMailChangeNotify extends BasePacket {
mailData.setImportance(message.importance); mailData.setImportance(message.importance);
mailData.setIsRead(message.isRead); mailData.setIsRead(message.isRead);
mailData.setIsAttachmentGot(message.isAttachmentGot); mailData.setIsAttachmentGot(message.isAttachmentGot);
mailData.setStateValue(message.stateValue); mailData.setBHCAHLJIKFFValue(message.stateValue);
proto.addMailList(mailData.build()); proto.addMailList(mailData.build());
} }

View File

@ -23,7 +23,7 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
.setSceneId(player.getSceneId()) .setSceneId(player.getSceneId())
.setPos(player.getPos().toProto()) .setPos(player.getPos().toProto())
.setSceneBeginTime(System.currentTimeMillis()) .setSceneBeginTime(System.currentTimeMillis())
.setType(EnterType.ENTER_SELF) .setType(EnterType.ENTER_TYPE_SELF)
.setTargetUid(player.getUid()) .setTargetUid(player.getUid())
.setEnterSceneToken(player.getEnterSceneToken()) .setEnterSceneToken(player.getEnterSceneToken())
.setWorldLevel(player.getWorldLevel()) .setWorldLevel(player.getWorldLevel())

View File

@ -18,7 +18,7 @@ public class PacketPlayerStoreNotify extends BasePacket {
this.buildHeader(2); this.buildHeader(2);
PlayerStoreNotify.Builder p = PlayerStoreNotify.newBuilder() PlayerStoreNotify.Builder p = PlayerStoreNotify.newBuilder()
.setStoreType(StoreType.STORE_PACK) .setStoreType(StoreType.STORE_TYPE_PACK)
.setWeightLimit(GAME_OPTIONS.inventoryLimits.all); .setWeightLimit(GAME_OPTIONS.inventoryLimits.all);
for (GameItem item : player.getInventory()) { for (GameItem item : player.getInventory()) {

View File

@ -3,20 +3,59 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerWorldSceneInfoListNotifyOuterClass.PlayerWorldSceneInfoListNotify; import emu.grasscutter.net.proto.PlayerWorldSceneInfoListNotifyOuterClass.PlayerWorldSceneInfoListNotify;
import emu.grasscutter.net.proto.PlayerWorldSceneInfoOuterClass;
import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo; import emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo;
import static emu.grasscutter.net.proto.PlayerWorldSceneInfoOuterClass.*;
public class PacketPlayerWorldSceneInfoListNotify extends BasePacket { public class PacketPlayerWorldSceneInfoListNotify extends BasePacket {
public PacketPlayerWorldSceneInfoListNotify() { public PacketPlayerWorldSceneInfoListNotify() {
super(PacketOpcodes.PlayerWorldSceneInfoListNotify); // Rename opcode later super(PacketOpcodes.PlayerWorldSceneInfoListNotify); // Rename opcode later
PlayerWorldSceneInfoListNotify proto = PlayerWorldSceneInfoListNotify.newBuilder() PlayerWorldSceneInfoListNotify proto = PlayerWorldSceneInfoListNotify.newBuilder()
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(1)) .addInfoList(
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(3).addSceneTagIdList(102).addSceneTagIdList(113).addSceneTagIdList(117)) PlayerWorldSceneInfo.newBuilder()
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(4).addSceneTagIdList(106).addSceneTagIdList(109)) .setSceneId(1)
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(5)) .setIsLocked(false)
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(6)) .build()
.addUnlockInfos(SceneUnlockInfo.newBuilder().setSceneId(7)) )
.addInfoList(
PlayerWorldSceneInfo.newBuilder()
.setSceneId(3)
.setIsLocked(false)
.addSceneTagIdList(102)
.addSceneTagIdList(113)
.addSceneTagIdList(117)
.build()
)
.addInfoList(
PlayerWorldSceneInfo.newBuilder()
.setSceneId(4)
.setIsLocked(false)
.addSceneTagIdList(106)
.addSceneTagIdList(109)
.addSceneTagIdList(117)
.build()
)
.addInfoList(
PlayerWorldSceneInfo.newBuilder()
.setSceneId(5)
.setIsLocked(false)
.build()
)
.addInfoList(
PlayerWorldSceneInfo.newBuilder()
.setSceneId(6)
.setIsLocked(false)
.build()
)
.addInfoList(
PlayerWorldSceneInfo.newBuilder()
.setSceneId(7)
.setIsLocked(false)
.build()
)
.build(); .build();
this.setData(proto); this.setData(proto);

View File

@ -17,7 +17,7 @@ public class PacketQueryCodexMonsterBeKilledNumRsp extends BasePacket {
if(player.getCodex().getUnlockedAnimal().containsKey(animal)){ if(player.getCodex().getUnlockedAnimal().containsKey(animal)){
proto.addCodexIdList(animal) proto.addCodexIdList(animal)
.addBeKilledNumList(player.getCodex().getUnlockedAnimal().get(animal)) .addBeKilledNumList(player.getCodex().getUnlockedAnimal().get(animal))
.addBeKilledNumEmptyList(0); .addCHPBKCLKPCJ(0);
} }
}); });

View File

@ -15,7 +15,7 @@ public class PacketSceneEntityAppearNotify extends BasePacket {
super(PacketOpcodes.SceneEntityAppearNotify, true); super(PacketOpcodes.SceneEntityAppearNotify, true);
SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder() SceneEntityAppearNotify.Builder proto = SceneEntityAppearNotify.newBuilder()
.setAppearType(VisionType.VISION_BORN) .setAppearType(VisionType.VISION_TYPE_BORN)
.addEntityList(entity.toProto()); .addEntityList(entity.toProto());
this.setData(proto.build()); this.setData(proto.build());

View File

@ -18,7 +18,7 @@ public class PacketStoreItemChangeNotify extends BasePacket {
this(); this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder() StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.STORE_PACK) .setStoreType(StoreType.STORE_TYPE_PACK)
.addItemList(item.toProto()); .addItemList(item.toProto());
this.setData(proto); this.setData(proto);
@ -28,7 +28,7 @@ public class PacketStoreItemChangeNotify extends BasePacket {
this(); this();
StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder() StoreItemChangeNotify.Builder proto = StoreItemChangeNotify.newBuilder()
.setStoreType(StoreType.STORE_PACK); .setStoreType(StoreType.STORE_TYPE_PACK);
items.forEach(item -> proto.addItemList(item.toProto())); items.forEach(item -> proto.addItemList(item.toProto()));

View File

@ -18,7 +18,7 @@ public class PacketStoreItemDelNotify extends BasePacket {
this(); this();
StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder() StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder()
.setStoreType(StoreType.STORE_PACK) .setStoreType(StoreType.STORE_TYPE_PACK)
.addGuidList(item.getGuid()); .addGuidList(item.getGuid());
this.setData(proto); this.setData(proto);
@ -28,7 +28,7 @@ public class PacketStoreItemDelNotify extends BasePacket {
this(); this();
StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder() StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder()
.setStoreType(StoreType.STORE_PACK); .setStoreType(StoreType.STORE_TYPE_PACK);
items.stream().forEach(item -> proto.addGuidList(item.getGuid())); items.stream().forEach(item -> proto.addGuidList(item.getGuid()));

View File

@ -13,7 +13,7 @@ public class PacketStoreWeightLimitNotify extends BasePacket {
super(PacketOpcodes.StoreWeightLimitNotify); super(PacketOpcodes.StoreWeightLimitNotify);
StoreWeightLimitNotify p = StoreWeightLimitNotify.newBuilder() StoreWeightLimitNotify p = StoreWeightLimitNotify.newBuilder()
.setStoreType(StoreType.STORE_PACK) .setStoreType(StoreType.STORE_TYPE_PACK)
.setWeightLimit(INVENTORY_LIMITS.all) .setWeightLimit(INVENTORY_LIMITS.all)
.setWeaponCountLimit(INVENTORY_LIMITS.weapons) .setWeaponCountLimit(INVENTORY_LIMITS.weapons)
.setReliquaryCountLimit(INVENTORY_LIMITS.relics) .setReliquaryCountLimit(INVENTORY_LIMITS.relics)

View File

@ -31,10 +31,10 @@ public class PacketVehicleInteractRsp extends BasePacket {
proto.setMember(vehicleMember); proto.setMember(vehicleMember);
switch(interactType){ switch(interactType){
case VEHICLE_INTERACT_IN -> { case VEHICLE_INTERACT_TYPE_IN -> {
((EntityVehicle) vehicle).getVehicleMembers().add(vehicleMember); ((EntityVehicle) vehicle).getVehicleMembers().add(vehicleMember);
} }
case VEHICLE_INTERACT_OUT -> { case VEHICLE_INTERACT_TYPE_OUT -> {
((EntityVehicle) vehicle).getVehicleMembers().remove(vehicleMember); ((EntityVehicle) vehicle).getVehicleMembers().remove(vehicleMember);
} }
default -> {} default -> {}
@ -53,10 +53,10 @@ public class PacketVehicleInteractRsp extends BasePacket {
proto.setMember(vehicleMember); proto.setMember(vehicleMember);
switch(interactType){ switch(interactType){
case VEHICLE_INTERACT_IN -> { case VEHICLE_INTERACT_TYPE_IN -> {
vehicle.getVehicleMembers().add(vehicleMember); vehicle.getVehicleMembers().add(vehicleMember);
} }
case VEHICLE_INTERACT_OUT -> { case VEHICLE_INTERACT_TYPE_OUT -> {
vehicle.getVehicleMembers().remove(vehicleMember); vehicle.getVehicleMembers().remove(vehicleMember);
} }
default -> {} default -> {}