Commit f1398182 authored by Yazawazi's avatar Yazawazi Committed by Melledy
Browse files

[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
parent a95002fd
......@@ -6,7 +6,7 @@ import emu.grasscutter.utils.Position;
import emu.grasscutter.utils.Utils;
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 MAIN_CHARACTER_MALE = 10000005;
......
......@@ -43,19 +43,19 @@ public class AbilityManager {
public void onAbilityInvoke(AbilityInvokeEntry invoke) throws Exception {
// Grasscutter.getLogger().info(invoke.getArgumentType() + " (" + invoke.getArgumentTypeValue() + "): " + Utils.bytesToHex(invoke.toByteArray()));
switch (invoke.getArgumentType()) {
case ABILITY_META_OVERRIDE_PARAM:
case ABILITY_INVOKE_ARGUMENT_META_OVERRIDE_PARAM:
handleOverrideParam(invoke);
break;
case ABILITY_META_REINIT_OVERRIDEMAP:
case ABILITY_INVOKE_ARGUMENT_META_REINIT_OVERRIDEMAP:
handleReinitOverrideMap(invoke);
break;
case ABILITY_META_MODIFIER_CHANGE:
case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_CHANGE:
handleModifierChange(invoke);
break;
case ABILITY_MIXIN_COST_STAMINA:
case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA:
handleMixinCostStamina(invoke);
break;
case ABILITY_ACTION_GENERATE_ELEM_BALL:
case ABILITY_INVOKE_ARGUMENT_ACTION_GENERATE_ELEM_BALL:
handleGenerateElemBall(invoke);
break;
default:
......
......@@ -106,15 +106,15 @@ public class EntityAvatar extends GameEntity {
@Override
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;
clearEnergy(PropChangeReason.PROP_CHANGE_STATUE_RECOVER);
clearEnergy(PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER);
}
public void onDeath(PlayerDieType dieType, int killerId) {
this.killedType = dieType;
this.killedBy = killerId;
clearEnergy(PropChangeReason.PROP_CHANGE_STATUE_RECOVER);
clearEnergy(PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER);
}
@Override
......@@ -123,7 +123,7 @@ public class EntityAvatar extends GameEntity {
if (healed > 0f) {
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()
.setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_AVATAR)
.setEntityType(ProtEntityType.PROT_ENTITY_TYPE_AVATAR)
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder())
.setEntityAuthorityInfo(authority)
......
......@@ -127,7 +127,7 @@ public class EntityClientGadget extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.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()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder())
......
......@@ -122,7 +122,7 @@ public class EntityGadget extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.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()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder())
......
......@@ -111,7 +111,7 @@ public class EntityItem extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.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()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder())
......@@ -127,7 +127,7 @@ public class EntityItem extends EntityBaseGadget {
SceneGadgetInfo.Builder gadgetInfo = SceneGadgetInfo.newBuilder()
.setGadgetId(this.getItemData().getGadgetId())
.setTrifleItem(this.getItem().toProto())
.setBornType(GadgetBornType.GADGET_BORN_IN_AIR)
.setBornType(GadgetBornType.GADGET_BORN_TYPE_IN_AIR)
.setAuthorityPeerId(this.getWorld().getHostPeerId())
.setIsEnableInteract(true);
......
......@@ -211,7 +211,7 @@ public class EntityMonster extends GameEntity {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.setEntityId(getId())
.setEntityType(ProtEntityType.PROT_ENTITY_MONSTER)
.setEntityType(ProtEntityType.PROT_ENTITY_TYPE_MONSTER)
.setMotionInfo(this.getMotionInfo())
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setEntityClientData(EntityClientData.newBuilder())
......@@ -240,7 +240,7 @@ public class EntityMonster extends GameEntity {
.setAuthorityPeerId(getWorld().getHostPeerId())
.setPoseId(this.getPoseId())
.setBlockId(3001)
.setBornType(MonsterBornType.MONSTER_BORN_DEFAULT)
.setBornType(MonsterBornType.MONSTER_BORN_TYPE_DEFAULT)
.setSpecialNameId(40);
if (getMonsterData().getDescribeData() != null) {
......
......@@ -106,7 +106,7 @@ public class EntityVehicle extends EntityBaseGadget {
SceneEntityInfo.Builder entityInfo = SceneEntityInfo.newBuilder()
.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()))
.addAnimatorParaList(AnimatorParameterValueInfoPair.newBuilder())
.setGadget(gadgetInfo)
......
......@@ -37,7 +37,7 @@ public abstract class GameEntity {
public GameEntity(Scene scene) {
this.scene = scene;
this.moveState = MotionState.MOTION_NONE;
this.moveState = MotionState.MOTION_STATE_NONE;
}
public int getId() {
......
......@@ -104,7 +104,7 @@ public class FriendsList {
}
// Handle
if (result == DealAddFriendResultType.DEAL_ADD_FRIEND_ACCEPT) { // Request accepted
if (result == DealAddFriendResultType.DEAL_ADD_FRIEND_RESULT_TYPE_ACCEPT) { // Request accepted
myFriendship.setIsFriend(true);
theirFriendship.setIsFriend(true);
......
......@@ -95,13 +95,13 @@ public class Friendship {
.setProfilePicture(ProfilePicture.newBuilder().setAvatarId(getFriendProfile().getAvatarId()))
.setWorldLevel(getFriendProfile().getWorldLevel())
.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)
.setLastActiveTime(getFriendProfile().getLastActiveTime())
.setNameCardId(getFriendProfile().getNameCard())
.setParam(getFriendProfile().getDaysSinceLogin())
.setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PC)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.build();
return proto;
......
......@@ -167,7 +167,7 @@ public class GachaBanner {
.setGachaTimesLimit(Integer.MAX_VALUE)
.setGachaSortId(this.getSortId());
if (this.getTitlePath() != null) {
info.setGachaTitlePath(this.getTitlePath());
info.setTitleTextmap(this.getTitlePath());
}
if (this.getRateUpItems5().length > 0) {
......@@ -175,7 +175,7 @@ public class GachaBanner {
for (int id : getRateUpItems5()) {
upInfo.addItemIdList(id);
info.addMainNameId(id);
info.addDisplayUp5ItemList(id);
}
info.addGachaUpInfoList(upInfo);
......@@ -186,8 +186,8 @@ public class GachaBanner {
for (int id : getRateUpItems4()) {
upInfo.addItemIdList(id);
if (info.getSubNameIdCount() == 0) {
info.addSubNameId(id);
if (info.getDisplayUp4ItemListCount() == 0) {
info.addDisplayUp4ItemList(id);
}
}
......
......@@ -253,7 +253,7 @@ public class EnergyManager {
float elementBonus = (ballElement == null) ? 2.0f : (avatarElement == ballElement) ? 3.0f : 1.0f;
// 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 (avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) {
avatar.getAsEntity().clearEnergy(PropChangeReason.PROP_CHANGE_ABILITY);
avatar.getAsEntity().clearEnergy(PropChangeReason.PROP_CHANGE_REASON_ABILITY);
}
}
......
......@@ -24,7 +24,7 @@ public class MapMarksManager {
public void handleMapMarkReq(MarkMapReq req) {
Operation op = req.getOp();
switch (op) {
case ADD -> {
case OPERATION_ADD -> {
MapMark createMark = new MapMark(req.getMark());
// keep teleporting functionality on fishhook mark.
if (createMark.getMapMarkPointType() == MapMarkPointType.MAP_MARK_POINT_TYPE_FISH_POOL) {
......@@ -33,18 +33,18 @@ public class MapMarksManager {
}
addMapMark(createMark);
}
case MOD -> {
case OPERATION_MOD -> {
MapMark oldMark = new MapMark(req.getOld());
removeMapMark(oldMark.getPosition());
MapMark newMark = new MapMark(req.getMark());
addMapMark(newMark);
}
case DEL -> {
case OPERATION_DEL -> {
MapMark deleteMark = new MapMark(req.getMark());
removeMapMark(deleteMark.getPosition());
}
}
if (op != Operation.GET) {
if (op != Operation.OPERATION_GET) {
saveMapMarks();
}
player.getSession().send(new PacketMarkMapRsp(getMapMarks()));
......
......@@ -27,7 +27,7 @@ public class MultiplayerManager {
public void applyEnterMp(Player player, int targetUid) {
Player target = getServer().getPlayerByUid(targetUid);
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;
}
......@@ -72,12 +72,12 @@ public class MultiplayerManager {
// Sanity checks - Dont let the requesting player join if they are already in multiplayer
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;
}
// 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
if (!isAgreed) {
......@@ -93,7 +93,7 @@ public class MultiplayerManager {
world.addPlayer(hostPlayer);
// 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
......@@ -105,7 +105,7 @@ public class MultiplayerManager {
hostPlayer.getWorld().addPlayer(requester);
// 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) {
......@@ -126,7 +126,7 @@ public class MultiplayerManager {
world.addPlayer(player);
// 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;
}
......@@ -153,7 +153,7 @@ public class MultiplayerManager {
World world = new World(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;
}
}
......@@ -158,8 +158,8 @@ public class SotSManager {
logger.trace("Healing avatar " + entity.getAvatar().getAvatarData().getName() + " +" + needHP);
player.getTeamManager().healAvatar(entity.getAvatar(), 0, needHP);
player.getSession().send(new PacketEntityFightPropChangeReasonNotify(entity, FightProperty.FIGHT_PROP_CUR_HP,
((float) needHP / 100), List.of(3), PropChangeReason.PROP_CHANGE_STATUE_RECOVER,
ChangeHpReason.ChangeHpAddStatue));
((float) needHP / 100), List.of(3), PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER,
ChangeHpReason.CHANGE_HP_REASON_CHANGE_HP_ADD_STATUE));
player.getSession().send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));
}
......
......@@ -31,81 +31,81 @@ public class StaminaManager {
private final Player player;
private static final HashMap<String, HashSet<MotionState>> MotionStatesCategorized = new HashMap<>() {{
put("CLIMB", new HashSet<>(List.of(
MotionState.MOTION_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_CLIMB, // sustained, when not moving no cost no recover
MotionState.MOTION_STATE_STANDBY_TO_CLIMB // NOT OBSERVED, see MOTION_JUMP_UP_WALL_FOR_STANDBY
)));
put("DASH", new HashSet<>(List.of(
MotionState.MOTION_DANGER_DASH, // sustained
MotionState.MOTION_DASH // sustained
MotionState.MOTION_STATE_DANGER_DASH, // sustained
MotionState.MOTION_STATE_DASH // sustained
)));
put("FLY", new HashSet<>(List.of(
MotionState.MOTION_FLY, // sustained
MotionState.MOTION_FLY_FAST, // sustained
MotionState.MOTION_FLY_SLOW, // sustained
MotionState.MOTION_POWERED_FLY // sustained, recover
MotionState.MOTION_STATE_FLY, // sustained
MotionState.MOTION_STATE_FLY_FAST, // sustained
MotionState.MOTION_STATE_FLY_SLOW, // sustained
MotionState.MOTION_STATE_POWERED_FLY // sustained, recover
)));
put("RUN", new HashSet<>(List.of(
MotionState.MOTION_DANGER_RUN, // sustained, recover
MotionState.MOTION_RUN // sustained, recover
MotionState.MOTION_STATE_DANGER_RUN, // sustained, recover
MotionState.MOTION_STATE_RUN // sustained, recover
)));
put("SKIFF", new HashSet<>(List.of(
MotionState.MOTION_SKIFF_BOARDING, // NOT OBSERVED even when boarding
MotionState.MOTION_SKIFF_DASH, // sustained, observed with waverider entity ID.
MotionState.MOTION_SKIFF_NORMAL, // sustained, OBSERVED when both normal and dashing
MotionState.MOTION_SKIFF_POWERED_DASH // sustained, recover
MotionState.MOTION_STATE_SKIFF_BOARDING, // NOT OBSERVED even when boarding
MotionState.MOTION_STATE_SKIFF_DASH, // sustained, observed with waverider entity ID.
MotionState.MOTION_STATE_SKIFF_NORMAL, // sustained, OBSERVED when both normal and dashing
MotionState.MOTION_STATE_SKIFF_POWERED_DASH // sustained, recover
)));
put("STANDBY", new HashSet<>(List.of(
MotionState.MOTION_DANGER_STANDBY_MOVE, // sustained, recover
MotionState.MOTION_DANGER_STANDBY, // sustained, recover
MotionState.MOTION_LADDER_TO_STANDBY, // NOT OBSERVED
MotionState.MOTION_STANDBY_MOVE, // sustained, recover
MotionState.MOTION_STANDBY // sustained, recover
MotionState.MOTION_STATE_DANGER_STANDBY_MOVE, // sustained, recover
MotionState.MOTION_STATE_DANGER_STANDBY, // sustained, recover
MotionState.MOTION_STATE_LADDER_TO_STANDBY, // NOT OBSERVED
MotionState.MOTION_STATE_STANDBY_MOVE, // sustained, recover
MotionState.MOTION_STATE_STANDBY // sustained, recover
)));
put("SWIM", new HashSet<>(List.of(
MotionState.MOTION_SWIM_IDLE, // sustained
MotionState.MOTION_SWIM_DASH, // immediate and sustained
MotionState.MOTION_SWIM_JUMP, // NOT OBSERVED
MotionState.MOTION_SWIM_MOVE // sustained
MotionState.MOTION_STATE_SWIM_IDLE, // sustained
MotionState.MOTION_STATE_SWIM_DASH, // immediate and sustained
MotionState.MOTION_STATE_SWIM_JUMP, // NOT OBSERVED
MotionState.MOTION_STATE_SWIM_MOVE // sustained
)));
put("WALK", new HashSet<>(List.of(
MotionState.MOTION_DANGER_WALK, // sustained, recover
MotionState.MOTION_WALK // sustained, recover
MotionState.MOTION_STATE_DANGER_WALK, // sustained, recover
MotionState.MOTION_STATE_WALK // sustained, recover
)));
put("OTHER", new HashSet<>(List.of(
MotionState.MOTION_CLIMB_JUMP, // cost only once if repeated without switching state
MotionState.MOTION_DASH_BEFORE_SHAKE, // immediate one time sprint charge.
MotionState.MOTION_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_NOTIFY, // can be either cost or recover - check previous state and check skill casting
MotionState.MOTION_SIT_IDLE, // sustained, recover
MotionState.MOTION_JUMP // recover
MotionState.MOTION_STATE_CLIMB_JUMP, // cost only once if repeated without switching state
MotionState.MOTION_STATE_DASH_BEFORE_SHAKE, // immediate one time sprint charge.
MotionState.MOTION_STATE_FIGHT, // immediate, if sustained then subsequent will be MOTION_NOTIFY
MotionState.MOTION_STATE_JUMP_UP_WALL_FOR_STANDBY, // immediate, observed when RUN/WALK->CLIMB
MotionState.MOTION_STATE_NOTIFY, // can be either cost or recover - check previous state and check skill casting
MotionState.MOTION_STATE_SIT_IDLE, // sustained, recover
MotionState.MOTION_STATE_JUMP // recover
)));
put("NOCOST_NORECOVER", new HashSet<>(List.of(
MotionState.MOTION_LADDER_SLIP, // NOT OBSERVED
MotionState.MOTION_SLIP, // sustained, no cost no recover
MotionState.MOTION_FLY_IDLE // NOT OBSERVED
MotionState.MOTION_STATE_LADDER_SLIP, // NOT OBSERVED
MotionState.MOTION_STATE_SLIP, // sustained, no cost no recover
MotionState.MOTION_STATE_FLY_IDLE // NOT OBSERVED
)));
put("IGNORE", new HashSet<>(List.of(
// these states have no impact on stamina
MotionState.MOTION_CROUCH_IDLE,
MotionState.MOTION_CROUCH_MOVE,
MotionState.MOTION_CROUCH_ROLL,
MotionState.MOTION_DESTROY_VEHICLE,
MotionState.MOTION_FALL_ON_GROUND,
MotionState.MOTION_FOLLOW_ROUTE,
MotionState.MOTION_FORCE_SET_POS,
MotionState.MOTION_GO_UPSTAIRS,
MotionState.MOTION_JUMP_OFF_WALL,
MotionState.MOTION_LADDER_IDLE,
MotionState.MOTION_LADDER_MOVE,
MotionState.MOTION_LAND_SPEED,
MotionState.MOTION_MOVE_FAIL_ACK,
MotionState.MOTION_NONE,
MotionState.MOTION_NUM,
MotionState.MOTION_QUEST_FORCE_DRAG,
MotionState.MOTION_RESET,
MotionState.MOTION_STANDBY_TO_LADDER,
MotionState.MOTION_WATERFALL
MotionState.MOTION_STATE_CROUCH_IDLE,
MotionState.MOTION_STATE_CROUCH_MOVE,
MotionState.MOTION_STATE_CROUCH_ROLL,
MotionState.MOTION_STATE_DESTROY_VEHICLE,
MotionState.MOTION_STATE_FALL_ON_GROUND,
MotionState.MOTION_STATE_FOLLOW_ROUTE,
MotionState.MOTION_STATE_FORCE_SET_POS,
MotionState.MOTION_STATE_GO_UPSTAIRS,
MotionState.MOTION_STATE_JUMP_OFF_WALL,
MotionState.MOTION_STATE_LADDER_IDLE,
MotionState.MOTION_STATE_LADDER_MOVE,
MotionState.MOTION_STATE_LAND_SPEED,
MotionState.MOTION_STATE_MOVE_FAIL_ACK,
MotionState.MOTION_STATE_NONE,
MotionState.MOTION_STATE_NUM,
MotionState.MOTION_STATE_QUEST_FORCE_DRAG,
MotionState.MOTION_STATE_RESET,
MotionState.MOTION_STATE_STANDBY_TO_LADDER,
MotionState.MOTION_STATE_WATERFALL
)));
}};
......@@ -114,8 +114,8 @@ public class StaminaManager {
public final static int GlobalVehicleMaxStamina = 24000;
private Position currentCoordinates = new Position(0, 0, 0);
private Position previousCoordinates = new Position(0, 0, 0);
private MotionState currentState = MotionState.MOTION_STANDBY;
private MotionState previousState = MotionState.MOTION_STANDBY;
private MotionState currentState = MotionState.MOTION_STATE_STANDBY;
private MotionState previousState = MotionState.MOTION_STATE_STANDBY;
private Timer sustainedStaminaHandlerTimer;
private GameSession cachedSession = null;
private GameEntity cachedEntity = null;
......@@ -406,7 +406,7 @@ public class StaminaManager {
}
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;
// Reset character stamina here to prevent falling into water immediately on ejection if char stamina is
// close to empty when boarding.
......@@ -421,23 +421,23 @@ public class StaminaManager {
private void handleImmediateStamina(GameSession session, @NotNull MotionState motionState) {
switch (motionState) {
case MOTION_CLIMB:
if (currentState != MotionState.MOTION_CLIMB) {
case MOTION_STATE_CLIMB:
if (currentState != MotionState.MOTION_STATE_CLIMB) {
updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_START), true);
}
break;
case MOTION_DASH_BEFORE_SHAKE:
if (previousState != MotionState.MOTION_DASH_BEFORE_SHAKE) {
case MOTION_STATE_DASH_BEFORE_SHAKE:
if (previousState != MotionState.MOTION_STATE_DASH_BEFORE_SHAKE) {
updateStaminaRelative(session, new Consumption(ConsumptionType.SPRINT), true);
}
break;
case MOTION_CLIMB_JUMP:
if (previousState != MotionState.MOTION_CLIMB_JUMP) {
case MOTION_STATE_CLIMB_JUMP:
if (previousState != MotionState.MOTION_STATE_CLIMB_JUMP) {
updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_JUMP), true);
}
break;
case MOTION_SWIM_DASH:
if (previousState != MotionState.MOTION_SWIM_DASH) {
case MOTION_STATE_SWIM_DASH:
if (previousState != MotionState.MOTION_STATE_SWIM_DASH) {
updateStaminaRelative(session, new Consumption(ConsumptionType.SWIM_DASH_START), true);
}
break;
......@@ -526,8 +526,8 @@ public class StaminaManager {
if (stamina < 10) {
logger.trace(getCurrentCharacterStamina() + "/" +
getMaxCharacterStamina() + "\t" + currentState);
if (currentState != MotionState.MOTION_SWIM_IDLE) {
killAvatar(cachedSession, cachedEntity, PlayerDieType.PLAYER_DIE_DRAWN);
if (currentState != MotionState.MOTION_STATE_SWIM_IDLE) {
killAvatar(cachedSession, cachedEntity, PlayerDieType.PLAYER_DIE_TYPE_DRAWN);
}
}
}
......@@ -568,7 +568,7 @@ public class StaminaManager {
private Consumption getClimbConsumption() {
Consumption consumption = new Consumption();
if (currentState == MotionState.MOTION_CLIMB && isPlayerMoving()) {
if (currentState == MotionState.MOTION_STATE_CLIMB && isPlayerMoving()) {
consumption.type = ConsumptionType.CLIMBING;
consumption.amount = ConsumptionType.CLIMBING.amount;
}
......@@ -581,11 +581,11 @@ public class StaminaManager {
private Consumption getSwimConsumptions() {
handleDrowning();
Consumption consumption = new Consumption();
if (currentState == MotionState.MOTION_SWIM_MOVE) {
if (currentState == MotionState.MOTION_STATE_SWIM_MOVE) {
consumption.type = ConsumptionType.SWIMMING;
consumption.amount = ConsumptionType.SWIMMING.amount;
}
if (currentState == MotionState.MOTION_SWIM_DASH) {
if (currentState == MotionState.MOTION_STATE_SWIM_DASH) {
consumption.type = ConsumptionType.SWIM_DASH;
consumption.amount = ConsumptionType.SWIM_DASH.amount;
}
......@@ -597,7 +597,7 @@ public class StaminaManager {
private Consumption getDashConsumption() {
Consumption consumption = new Consumption();
if (currentState == MotionState.MOTION_DASH) {
if (currentState == MotionState.MOTION_STATE_DASH) {
consumption.type = ConsumptionType.DASH;
consumption.amount = ConsumptionType.DASH.amount;
// Dashing specific reductions
......@@ -608,7 +608,7 @@ public class StaminaManager {
private Consumption getFlyConsumption() {
// 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);
}
Consumption consumption = new Consumption(ConsumptionType.FLY);
......@@ -621,21 +621,21 @@ public class StaminaManager {
private Consumption getSkiffConsumption() {
// No known reduction for skiffing.
return switch (currentState) {
case MOTION_SKIFF_DASH -> new Consumption(ConsumptionType.SKIFF_DASH);
case MOTION_SKIFF_POWERED_DASH -> new Consumption(ConsumptionType.POWERED_SKIFF);
case MOTION_SKIFF_NORMAL -> new Consumption(ConsumptionType.SKIFF);
case MOTION_STATE_SKIFF_DASH -> new Consumption(ConsumptionType.SKIFF_DASH);
case MOTION_STATE_SKIFF_POWERED_DASH -> new Consumption(ConsumptionType.POWERED_SKIFF);
case MOTION_STATE_SKIFF_NORMAL -> new Consumption(ConsumptionType.SKIFF);
default -> new Consumption();
};
}
private Consumption getOtherConsumptions() {
switch (currentState) {
case MOTION_NOTIFY:
case MOTION_STATE_NOTIFY:
// if (BowSkills.contains(lastSkillId)) {
// return new Consumption(ConsumptionType.FIGHT, 500);
// }
break;
case MOTION_FIGHT:
case MOTION_STATE_FIGHT:
// TODO: what if charged attack
return new Consumption(ConsumptionType.FIGHT, 500);
}
......
......@@ -21,9 +21,9 @@ public class InvokeHandler<T> {
public synchronized void addEntry(ForwardType forward, T entry) {
switch (forward) {
case FORWARD_TO_ALL -> entryListForwardAll.add(entry);
case FORWARD_TO_ALL_EXCEPT_CUR, FORWARD_TO_ALL_EXIST_EXCEPT_CUR -> entryListForwardAllExceptCur.add(entry);
case FORWARD_TO_HOST -> entryListForwardHost.add(entry);
case FORWARD_TYPE_TO_ALL -> entryListForwardAll.add(entry);
case FORWARD_TYPE_TO_ALL_EXCEPT_CUR, FORWARD_TYPE_TO_ALL_EXIST_EXCEPT_CUR -> entryListForwardAllExceptCur.add(entry);
case FORWARD_TYPE_TO_HOST -> entryListForwardHost.add(entry);
default -> {
}
}
......
......@@ -510,7 +510,7 @@ public class Player {
}
public MpSettingType getMpSetting() {
return MpSettingType.MP_SETTING_ENTER_AFTER_APPLY; // TEMP
return MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; // TEMP
}
public Queue<AttackResult> getAttackResults() {
......@@ -928,9 +928,9 @@ public class Player {
boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop);
if (success) {
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
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) {
EntityGadget gadget = (EntityGadget) entity;
......@@ -940,7 +940,7 @@ public class Player {
scene.getChallenge().getStatueDrops(this);
}
this.sendPacket(new PacketGadgetInteractRsp(gadget, InteractType.INTERACT_OPEN_STATUE));
this.sendPacket(new PacketGadgetInteractRsp(gadget, InteractType.INTERACT_TYPE_OPEN_STATUE));
}
} else {
// Delete directly
......@@ -1131,7 +1131,10 @@ public class Player {
while (it.hasNext()) {
CoopRequest req = it.next();
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();
}
}
......
......@@ -554,7 +554,7 @@ public class TeamManager {
this.setCurrentCharacterIndex(index);
// Old entity motion state
oldEntity.setMotionState(MotionState.MOTION_STANDBY);
oldEntity.setMotionState(MotionState.MOTION_STATE_STANDBY);
// Remove and Add
getPlayer().getScene().replaceEntity(oldEntity, newEntity);
......@@ -571,7 +571,7 @@ public class TeamManager {
PlayerDieType dieType = deadAvatar.getKilledType();
int killedBy = deadAvatar.getKilledBy();
if (dieType == PlayerDieType.PLAYER_DIE_DRAWN) {
if (dieType == PlayerDieType.PLAYER_DIE_TYPE_DRAWN) {
// Died in water. Do not replace
// 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?
......@@ -669,7 +669,7 @@ public class TeamManager {
}
// 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
player.setSceneId(3);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment