mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-21 11:24:47 +01:00
[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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user