fix: build errors

This commit is contained in:
HongchengQ 2024-10-03 00:12:33 +08:00
parent 487c56c4ac
commit 16847e99d1
5 changed files with 25 additions and 38 deletions

View File

@ -222,20 +222,20 @@ public final class AbilityManager extends BasePlayerManager {
} }
switch (invoke.getArgumentType()) { switch (invoke.getArgumentType()) {
case ABILITY_INVOKE_ARGUMENT_META_OVERRIDE_PARAM -> this.handleOverrideParam(invoke); case ABILITY_META_OVERRIDE_PARAM -> this.handleOverrideParam(invoke);
case ABILITY_INVOKE_ARGUMENT_META_REINIT_OVERRIDEMAP -> this.handleReinitOverrideMap(invoke); case ABILITY_META_REINIT_OVERRIDEMAP -> this.handleReinitOverrideMap(invoke);
case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_CHANGE -> this.handleModifierChange(invoke); case ABILITY_META_MODIFIER_CHANGE -> this.handleModifierChange(invoke);
case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA -> this.handleMixinCostStamina(invoke); case ABILITY_MIXIN_COST_STAMINA -> this.handleMixinCostStamina(invoke);
case ABILITY_INVOKE_ARGUMENT_ACTION_GENERATE_ELEM_BALL -> this.handleGenerateElemBall(invoke); case ABILITY_ACTION_GENERATE_ELEM_BALL -> this.handleGenerateElemBall(invoke);
case ABILITY_INVOKE_ARGUMENT_META_GLOBAL_FLOAT_VALUE -> this.handleGlobalFloatValue(invoke); case ABILITY_META_GLOBAL_FLOAT_VALUE -> this.handleGlobalFloatValue(invoke);
case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_DURABILITY_CHANGE -> this case ABILITY_META_MODIFIER_DURABILITY_CHANGE -> this
.handleModifierDurabilityChange(invoke); .handleModifierDurabilityChange(invoke);
case ABILITY_INVOKE_ARGUMENT_META_ADD_NEW_ABILITY -> this.handleAddNewAbility(invoke); case ABILITY_META_ADD_NEW_ABILITY -> this.handleAddNewAbility(invoke);
case ABILITY_INVOKE_ARGUMENT_META_SET_KILLED_SETATE -> this.handleKillState(invoke); case ABILITY_META_SET_KILLED_SETATE -> this.handleKillState(invoke);
default -> { default -> {
if (DebugConstants.LOG_MISSING_ABILITIES) { if (DebugConstants.LOG_MISSING_ABILITIES) {
Grasscutter.getLogger() 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) { 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()) { if (!valueChange.getKey().hasStr()) {
Grasscutter.getLogger().trace("TODO: Calculate all the ability value hashes"); Grasscutter.getLogger().trace("TODO: Calculate all the ability value hashes");
@ -542,12 +536,12 @@ public final class AbilityManager extends BasePlayerManager {
throws InvalidProtocolBufferException {} throws InvalidProtocolBufferException {}
private void handleGlobalFloatValue(AbilityInvokeEntry invoke) private void handleGlobalFloatValue(AbilityInvokeEntry invoke)
throws InvalidProtocolBufferException { throws InvalidProtocolBufferException {
var entity = this.player.getScene().getEntityById(invoke.getEntityId()); var entity = this.player.getScene().getEntityById(invoke.getEntityId());
if (entity == null) return; if (entity == null) return;
var entry = AbilityScalarValueEntry.parseFrom(invoke.getAbilityData()); var entry = AbilityScalarValueEntry.parseFrom(invoke.getAbilityData());
if (entry == null || !entry.hasFloatValue()) return; if (entry == null) return;
String key = null; String key = null;
if (entry.getKey().hasStr()) key = entry.getKey().getStr(); if (entry.getKey().hasStr()) key = entry.getKey().getStr();
@ -557,17 +551,10 @@ public final class AbilityManager extends BasePlayerManager {
if (key == null) return; if (key == null) return;
if (key.startsWith("SGV_")) return; // Server does not allow to change this variables I think if (key.startsWith("SGV_")) return; // Server does not allow to change this variables I think
switch (entry.getValueType().getNumber()) { if (!Float.isNaN(entry.getFloatValue())) {
case AbilityScalarType.ABILITY_SCALAR_TYPE_FLOAT_VALUE -> { entity.getGlobalAbilityValues().put(key, entry.getFloatValue());
if (!Float.isNaN(entry.getFloatValue())) } else {
entity.getGlobalAbilityValues().put(key, entry.getFloatValue()); return;
}
case AbilityScalarType.ABILITY_SCALAR_TYPE_UINT_VALUE -> entity
.getGlobalAbilityValues()
.put(key, (float) entry.getUintValue());
default -> {
return;
}
} }
entity.onAbilityValueUpdate(); entity.onAbilityValueUpdate();

View File

@ -160,7 +160,7 @@ public class EntityAvatar extends GameEntity {
mute mute
? PropChangeReason.PROP_CHANGE_REASON_NONE ? PropChangeReason.PROP_CHANGE_REASON_NONE
: PropChangeReason.PROP_CHANGE_REASON_ABILITY, : PropChangeReason.PROP_CHANGE_REASON_ABILITY,
ChangeHpReason.CHANGE_HP_REASON_ADD_ABILITY)); ChangeHpReason.CHANGE_HP_ADD_ABILITY));
} }
return healed; return healed;

View File

@ -142,7 +142,7 @@ public class SotSManager extends BasePlayerManager {
((float) needHP / 100), ((float) needHP / 100),
List.of(3), List.of(3),
PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER, PropChangeReason.PROP_CHANGE_REASON_STATUE_RECOVER,
ChangeHpReason.CHANGE_HP_REASON_ADD_STATUE)); ChangeHpReason.CHANGE_HP_ADD_STATUE));
player player
.getSession() .getSession()
.send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); .send(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP));

View File

@ -14,8 +14,8 @@ public class PacketGachaWishRsp extends BasePacket {
.setGachaType(gachaType) .setGachaType(gachaType)
.setGachaScheduleId(scheduleId) .setGachaScheduleId(scheduleId)
.setWishItemId(itemId) .setWishItemId(itemId)
.setWishProgress(progress) .setTenCostItemId(progress)
.setWishMaxProgress(maxProgress) .setGachaSortId(maxProgress)
.build(); .build();
this.setData(proto); this.setData(proto);

View File

@ -17,10 +17,10 @@ public class PacketTowerLevelStarCondNotify extends BasePacket {
// If these are still obfuscated in the next client version, // If these are still obfuscated in the next client version,
// just set all int fields to the star (1 <= star <= 3) // just set all int fields to the star (1 <= star <= 3)
// that failed and set all boolean fields to true. // that failed and set all boolean fields to true.
.setNGHNFHCLFBH(lostStar) .setCondValue(lostStar)
.setIBGHBFANCBK(true) .setIsFail(true)
.setOILLLBMMABH(true) .setIsPause(true)
.setOMOECEGOALC(lostStar) .setStarCondIndex(lostStar)
.build()); .build());
} else { } else {
proto proto