Added localid missing actions (needs testing)

This commit is contained in:
StartForKiller 2023-05-31 22:40:18 -04:00 committed by KingRainbow44
parent d18a8c31a6
commit 9dae3cbcc7
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
2 changed files with 27 additions and 12 deletions

View File

@ -3,9 +3,10 @@ package emu.grasscutter.data.binout;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.common.DynamicFloat; import emu.grasscutter.data.common.DynamicFloat;
import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.props.ElementType;
import java.io.Serializable;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable;
public class AbilityModifier implements Serializable { public class AbilityModifier implements Serializable {
private static final long serialVersionUID = -2001232313615923575L; private static final long serialVersionUID = -2001232313615923575L;
@ -323,6 +324,10 @@ public class AbilityModifier implements Serializable {
public int skillID; public int skillID;
public AbilityModifierAction[] actions;
public AbilityModifierAction[] successActions;
public AbilityModifierAction[] failActions;
public int param1; public int param1;
public int param2; public int param2;
public int param3; public int param3;

View File

@ -3,9 +3,10 @@ package emu.grasscutter.game.ability;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.binout.AbilityMixinData; import emu.grasscutter.data.binout.AbilityMixinData;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import java.util.Map;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import java.util.Map;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
public class AbilityLocalIdGenerator { public class AbilityLocalIdGenerator {
@AllArgsConstructor @AllArgsConstructor
@ -32,11 +33,20 @@ public class AbilityLocalIdGenerator {
public void initializeActionLocalIds( public void initializeActionLocalIds(
AbilityModifierAction[] actions, Map<Integer, AbilityModifierAction> localIdToAction) { AbilityModifierAction[] actions, Map<Integer, AbilityModifierAction> localIdToAction) {
if (actions == null) return; if (actions == null) return;
actionIndex = 0; this.actionIndex = 0;
for (AbilityModifierAction action : actions) { for (int i = 0; i < actions.length; i++) {
actionIndex++; this.actionIndex++;
long id = GetLocalId();
localIdToAction.put((int) id, action); 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; actionIndex = 0;
@ -45,15 +55,15 @@ public class AbilityLocalIdGenerator {
public void initializeMixinsLocalIds( public void initializeMixinsLocalIds(
AbilityMixinData[] mixins, Map<Integer, AbilityMixinData> localIdToAction) { AbilityMixinData[] mixins, Map<Integer, AbilityMixinData> localIdToAction) {
if (mixins == null) return; if (mixins == null) return;
mixinIndex = 0; this.mixinIndex = 0;
for (AbilityMixinData mixin : mixins) { for (var mixin : mixins) {
long id = GetLocalId(); var id = GetLocalId();
localIdToAction.put((int) id, mixin); localIdToAction.put((int) id, mixin);
mixinIndex++; this.mixinIndex++;
} }
mixinIndex = 0; this.mixinIndex = 0;
} }
public long GetLocalId() { public long GetLocalId() {