@@ -222,20 +222,20 @@ public void onAbilityInvoke(AbilityInvokeEntry invoke) throws Exception {
222
222
}
223
223
224
224
switch (invoke .getArgumentType ()) {
225
- case ABILITY_INVOKE_ARGUMENT_META_OVERRIDE_PARAM -> this .handleOverrideParam (invoke );
226
- case ABILITY_INVOKE_ARGUMENT_META_REINIT_OVERRIDEMAP -> this .handleReinitOverrideMap (invoke );
227
- case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_CHANGE -> this .handleModifierChange (invoke );
228
- case ABILITY_INVOKE_ARGUMENT_MIXIN_COST_STAMINA -> this .handleMixinCostStamina (invoke );
229
- case ABILITY_INVOKE_ARGUMENT_ACTION_GENERATE_ELEM_BALL -> this .handleGenerateElemBall (invoke );
230
- case ABILITY_INVOKE_ARGUMENT_META_GLOBAL_FLOAT_VALUE -> this .handleGlobalFloatValue (invoke );
231
- case ABILITY_INVOKE_ARGUMENT_META_MODIFIER_DURABILITY_CHANGE -> this
232
- .handleModifierDurabilityChange (invoke );
233
- case ABILITY_INVOKE_ARGUMENT_META_ADD_NEW_ABILITY -> this .handleAddNewAbility (invoke );
234
- case ABILITY_INVOKE_ARGUMENT_META_SET_KILLED_SETATE -> this .handleKillState (invoke );
225
+ case ABILITY_META_OVERRIDE_PARAM -> this .handleOverrideParam (invoke );
226
+ case ABILITY_META_REINIT_OVERRIDEMAP -> this .handleReinitOverrideMap (invoke );
227
+ case ABILITY_META_MODIFIER_CHANGE -> this .handleModifierChange (invoke );
228
+ case ABILITY_MIXIN_COST_STAMINA -> this .handleMixinCostStamina (invoke );
229
+ case ABILITY_ACTION_GENERATE_ELEM_BALL -> this .handleGenerateElemBall (invoke );
230
+ case ABILITY_META_GLOBAL_FLOAT_VALUE -> this .handleGlobalFloatValue (invoke );
231
+ case ABILITY_META_MODIFIER_DURABILITY_CHANGE -> this
232
+ .handleModifierDurabilityChange (invoke );
233
+ case ABILITY_META_ADD_NEW_ABILITY -> this .handleAddNewAbility (invoke );
234
+ case ABILITY_META_SET_KILLED_SETATE -> this .handleKillState (invoke );
235
235
default -> {
236
236
if (DebugConstants .LOG_MISSING_ABILITIES ) {
237
237
Grasscutter .getLogger ()
238
- .trace ("Missing invoke handler for ability {}." , invoke .getArgumentType ().name ());
238
+ .trace ("Missing invoke handler for ability {}." , invoke .getArgumentType ().name ());
239
239
}
240
240
}
241
241
}
@@ -361,12 +361,6 @@ public void onSkillEnd(Player player) {
361
361
}
362
362
363
363
private void setAbilityOverrideValue (Ability ability , AbilityScalarValueEntry valueChange ) {
364
- if (valueChange .getValueType () != AbilityScalarType .ABILITY_SCALAR_TYPE_FLOAT ) {
365
- Grasscutter .getLogger ().trace ("Scalar type not supported: {}" , valueChange .getValueType ());
366
-
367
- return ;
368
- }
369
-
370
364
if (!valueChange .getKey ().hasStr ()) {
371
365
Grasscutter .getLogger ().trace ("TODO: Calculate all the ability value hashes" );
372
366
@@ -542,12 +536,12 @@ private void handleGenerateElemBall(AbilityInvokeEntry invoke)
542
536
throws InvalidProtocolBufferException {}
543
537
544
538
private void handleGlobalFloatValue (AbilityInvokeEntry invoke )
545
- throws InvalidProtocolBufferException {
539
+ throws InvalidProtocolBufferException {
546
540
var entity = this .player .getScene ().getEntityById (invoke .getEntityId ());
547
541
if (entity == null ) return ;
548
542
549
543
var entry = AbilityScalarValueEntry .parseFrom (invoke .getAbilityData ());
550
- if (entry == null || ! entry . hasFloatValue () ) return ;
544
+ if (entry == null ) return ;
551
545
552
546
String key = null ;
553
547
if (entry .getKey ().hasStr ()) key = entry .getKey ().getStr ();
@@ -557,17 +551,10 @@ else if (entry.getKey().hasHash())
557
551
if (key == null ) return ;
558
552
559
553
if (key .startsWith ("SGV_" )) return ; // Server does not allow to change this variables I think
560
- switch (entry .getValueType ().getNumber ()) {
561
- case AbilityScalarType .ABILITY_SCALAR_TYPE_FLOAT_VALUE -> {
562
- if (!Float .isNaN (entry .getFloatValue ()))
563
- entity .getGlobalAbilityValues ().put (key , entry .getFloatValue ());
564
- }
565
- case AbilityScalarType .ABILITY_SCALAR_TYPE_UINT_VALUE -> entity
566
- .getGlobalAbilityValues ()
567
- .put (key , (float ) entry .getUintValue ());
568
- default -> {
569
- return ;
570
- }
554
+ if (!Float .isNaN (entry .getFloatValue ())) {
555
+ entity .getGlobalAbilityValues ().put (key , entry .getFloatValue ());
556
+ } else {
557
+ return ;
571
558
}
572
559
573
560
entity .onAbilityValueUpdate ();
0 commit comments