From 9dae3cbcc73278ccc26dcd4309c5b95a6a46739f Mon Sep 17 00:00:00 2001 From: StartForKiller Date: Wed, 31 May 2023 22:40:18 -0400 Subject: [PATCH] Added `localid` missing actions (needs testing) --- .../data/binout/AbilityModifier.java | 7 +++- .../game/ability/AbilityLocalIdGenerator.java | 32 ++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java index f74341df0..8f7b592fa 100644 --- a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java +++ b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java @@ -3,9 +3,10 @@ package emu.grasscutter.data.binout; import com.google.gson.annotations.SerializedName; import emu.grasscutter.data.common.DynamicFloat; import emu.grasscutter.game.props.ElementType; -import java.io.Serializable; import lombok.ToString; +import java.io.Serializable; + public class AbilityModifier implements Serializable { private static final long serialVersionUID = -2001232313615923575L; @@ -323,6 +324,10 @@ public class AbilityModifier implements Serializable { public int skillID; + public AbilityModifierAction[] actions; + public AbilityModifierAction[] successActions; + public AbilityModifierAction[] failActions; + public int param1; public int param2; public int param3; diff --git a/src/main/java/emu/grasscutter/game/ability/AbilityLocalIdGenerator.java b/src/main/java/emu/grasscutter/game/ability/AbilityLocalIdGenerator.java index 0b0cc84e7..216221a31 100644 --- a/src/main/java/emu/grasscutter/game/ability/AbilityLocalIdGenerator.java +++ b/src/main/java/emu/grasscutter/game/ability/AbilityLocalIdGenerator.java @@ -3,9 +3,10 @@ package emu.grasscutter.game.ability; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.binout.AbilityMixinData; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; -import java.util.Map; import lombok.AllArgsConstructor; +import java.util.Map; + @SuppressWarnings("ALL") public class AbilityLocalIdGenerator { @AllArgsConstructor @@ -32,11 +33,20 @@ public class AbilityLocalIdGenerator { public void initializeActionLocalIds( AbilityModifierAction[] actions, Map localIdToAction) { if (actions == null) return; - actionIndex = 0; - for (AbilityModifierAction action : actions) { - actionIndex++; - long id = GetLocalId(); - localIdToAction.put((int) id, action); + this.actionIndex = 0; + for (int i = 0; i < actions.length; i++) { + this.actionIndex++; + + var id = GetLocalId(); + localIdToAction.put((int)id, actions[i]); + + if(actions[i].actions != null) this.initializeActionLocalIds(actions[i].actions, localIdToAction); + else { + if (actions[i].successActions[i] != null) + this.initializeActionLocalIds(actions[i].successActions, localIdToAction); //Need to check this specific order + if (actions[i].failActions[i] != null) + this.initializeActionLocalIds(actions[i].failActions, localIdToAction); + } } actionIndex = 0; @@ -45,15 +55,15 @@ public class AbilityLocalIdGenerator { public void initializeMixinsLocalIds( AbilityMixinData[] mixins, Map localIdToAction) { if (mixins == null) return; - mixinIndex = 0; - for (AbilityMixinData mixin : mixins) { - long id = GetLocalId(); + this.mixinIndex = 0; + for (var mixin : mixins) { + var id = GetLocalId(); localIdToAction.put((int) id, mixin); - mixinIndex++; + this.mixinIndex++; } - mixinIndex = 0; + this.mixinIndex = 0; } public long GetLocalId() {