Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HongchengQ committed Oct 2, 2024
1 parent 487c56c commit 16847e9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 38 deletions.
47 changes: 17 additions & 30 deletions src/main/java/emu/grasscutter/game/ability/AbilityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,20 @@ public void onAbilityInvoke(AbilityInvokeEntry invoke) throws Exception {
}

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());
}
}
}
Expand Down Expand Up @@ -361,12 +361,6 @@ public void onSkillEnd(Player player) {
}

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");

Expand Down Expand Up @@ -542,12 +536,12 @@ private void handleGenerateElemBall(AbilityInvokeEntry invoke)
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();
Expand All @@ -557,17 +551,10 @@ else if (entry.getKey().hasHash())
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public float heal(float amount, boolean mute) {
mute
? PropChangeReason.PROP_CHANGE_REASON_NONE
: PropChangeReason.PROP_CHANGE_REASON_ABILITY,
ChangeHpReason.CHANGE_HP_REASON_ADD_ABILITY));
ChangeHpReason.CHANGE_HP_ADD_ABILITY));
}

return healed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void checkAndHealAvatar(EntityAvatar entity) {
((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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public PacketGachaWishRsp(
.setGachaType(gachaType)
.setGachaScheduleId(scheduleId)
.setWishItemId(itemId)
.setWishProgress(progress)
.setWishMaxProgress(maxProgress)
.setTenCostItemId(progress)
.setGachaSortId(maxProgress)
.build();

this.setData(proto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public PacketTowerLevelStarCondNotify(int floorId, int levelIndex, int lostStar)
// 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
Expand Down

0 comments on commit 16847e9

Please sign in to comment.