diff --git a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java index b5bef4276..3482876b5 100644 --- a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java +++ b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java @@ -222,20 +222,20 @@ public final class AbilityManager extends BasePlayerManager { } switch (invoke.getArgumentType()) { - case ABILITY_INVOKE_ARGUMENT_META_OVERRIDE_PARAM -> this.handleOverrideParam(invoke); - case ABILITY_INVOKE_ARGUMENT_META_REINIT_OVERRIDEMAP -> this.handleReinitOverrideMap(invoke); - case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_CHANGE -> this.handleModifierChange(invoke); - case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA -> this.handleMixinCostStamina(invoke); - case ABILITY_INVOKE_ARGUMENT_ACTION_GENERATE_ELEM_BALL -> this.handleGenerateElemBall(invoke); - case ABILITY_INVOKE_ARGUMENT_META_GLOBAL_FLOAT_VALUE -> this.handleGlobalFloatValue(invoke); - case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_DURABILITY_CHANGE -> this - .handleModifierDurabilityChange(invoke); - case ABILITY_INVOKE_ARGUMENT_META_ADD_NEW_ABILITY -> this.handleAddNewAbility(invoke); - case ABILITY_INVOKE_ARGUMENT_META_SET_KILLED_SETATE -> this.handleKillState(invoke); + case ABILITY_META_OVERRIDE_PARAM -> this.handleOverrideParam(invoke); + case ABILITY_META_REINIT_OVERRIDEMAP -> this.handleReinitOverrideMap(invoke); + case ABILITY_META_MODIFIER_CHANGE -> this.handleModifierChange(invoke); + case ABILITY_MIXIN_COST_STAMINA -> this.handleMixinCostStamina(invoke); + case ABILITY_ACTION_GENERATE_ELEM_BALL -> this.handleGenerateElemBall(invoke); + case ABILITY_META_GLOBAL_FLOAT_VALUE -> this.handleGlobalFloatValue(invoke); + case ABILITY_META_MODIFIER_DURABILITY_CHANGE -> this + .handleModifierDurabilityChange(invoke); + case ABILITY_META_ADD_NEW_ABILITY -> this.handleAddNewAbility(invoke); + case ABILITY_META_SET_KILLED_SETATE -> this.handleKillState(invoke); default -> { if (DebugConstants.LOG_MISSING_ABILITIES) { Grasscutter.getLogger() - .trace("Missing invoke handler for ability {}.", invoke.getArgumentType().name()); + .trace("Missing invoke handler for ability {}.", invoke.getArgumentType().name()); } } } @@ -361,12 +361,6 @@ public final class AbilityManager extends BasePlayerManager { } private void setAbilityOverrideValue(Ability ability, AbilityScalarValueEntry valueChange) { - if (valueChange.getValueType() != AbilityScalarType.ABILITY_SCALAR_TYPE_FLOAT) { - Grasscutter.getLogger().trace("Scalar type not supported: {}", valueChange.getValueType()); - - return; - } - if (!valueChange.getKey().hasStr()) { Grasscutter.getLogger().trace("TODO: Calculate all the ability value hashes"); @@ -542,12 +536,12 @@ public final class AbilityManager extends BasePlayerManager { throws InvalidProtocolBufferException {} private void handleGlobalFloatValue(AbilityInvokeEntry invoke) - throws InvalidProtocolBufferException { + throws InvalidProtocolBufferException { var entity = this.player.getScene().getEntityById(invoke.getEntityId()); if (entity == null) return; var entry = AbilityScalarValueEntry.parseFrom(invoke.getAbilityData()); - if (entry == null || !entry.hasFloatValue()) return; + if (entry == null) return; String key = null; if (entry.getKey().hasStr()) key = entry.getKey().getStr(); @@ -557,17 +551,10 @@ public final class AbilityManager extends BasePlayerManager { if (key == null) return; if (key.startsWith("SGV_")) return; // Server does not allow to change this variables I think - switch (entry.getValueType().getNumber()) { - case AbilityScalarType.ABILITY_SCALAR_TYPE_FLOAT_VALUE -> { - if (!Float.isNaN(entry.getFloatValue())) - entity.getGlobalAbilityValues().put(key, entry.getFloatValue()); - } - case AbilityScalarType.ABILITY_SCALAR_TYPE_UINT_VALUE -> entity - .getGlobalAbilityValues() - .put(key, (float) entry.getUintValue()); - default -> { - return; - } + if (!Float.isNaN(entry.getFloatValue())) { + entity.getGlobalAbilityValues().put(key, entry.getFloatValue()); + } else { + return; } entity.onAbilityValueUpdate(); diff --git a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java index 2bff768ba..af038a0d4 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java @@ -160,7 +160,7 @@ public class EntityAvatar extends GameEntity { mute ? PropChangeReason.PROP_CHANGE_REASON_NONE : PropChangeReason.PROP_CHANGE_REASON_ABILITY, - ChangeHpReason.CHANGE_HP_REASON_ADD_ABILITY)); + ChangeHpReason.CHANGE_HP_ADD_ABILITY)); } return healed; diff --git a/src/main/java/emu/grasscutter/game/managers/SotSManager.java b/src/main/java/emu/grasscutter/game/managers/SotSManager.java index 6427de185..0b005b9bb 100644 --- a/src/main/java/emu/grasscutter/game/managers/SotSManager.java +++ b/src/main/java/emu/grasscutter/game/managers/SotSManager.java @@ -142,7 +142,7 @@ public class SotSManager extends BasePlayerManager { ((float) needHP / 100), List.of(3), PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER, - ChangeHpReason.CHANGE_HP_REASON_ADD_STATUE)); + ChangeHpReason.CHANGE_HP_ADD_STATUE)); player .getSession() .send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGachaWishRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGachaWishRsp.java index c8a704937..f654d2f7e 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGachaWishRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGachaWishRsp.java @@ -14,8 +14,8 @@ public class PacketGachaWishRsp extends BasePacket { .setGachaType(gachaType) .setGachaScheduleId(scheduleId) .setWishItemId(itemId) - .setWishProgress(progress) - .setWishMaxProgress(maxProgress) + .setTenCostItemId(progress) + .setGachaSortId(maxProgress) .build(); this.setData(proto); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketTowerLevelStarCondNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketTowerLevelStarCondNotify.java index 3c5026744..168aaeb34 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketTowerLevelStarCondNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketTowerLevelStarCondNotify.java @@ -17,10 +17,10 @@ public class PacketTowerLevelStarCondNotify extends BasePacket { // If these are still obfuscated in the next client version, // just set all int fields to the star (1 <= star <= 3) // that failed and set all boolean fields to true. - .setNGHNFHCLFBH(lostStar) - .setIBGHBFANCBK(true) - .setOILLLBMMABH(true) - .setOMOECEGOALC(lostStar) + .setCondValue(lostStar) + .setIsFail(true) + .setIsPause(true) + .setStarCondIndex(lostStar) .build()); } else { proto