diff --git a/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java b/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java index 84a50afa6..8f80cef44 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityBaseGadget.java @@ -70,7 +70,7 @@ public abstract class EntityBaseGadget extends GameEntity { getGadgetId()) .setSourceEntityId(getId()) .setParam3((int) this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP)) - .setEventSource(Integer.toString(getConfigId()))); + .setEventSource(getConfigId())); } protected void fillFightProps(ConfigEntityGadget configGadget) { diff --git a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java index 19772574d..6b9307cd3 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityMonster.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityMonster.java @@ -235,7 +235,7 @@ public class EntityMonster extends GameEntity { getScene().getScriptManager().callEvent(new ScriptArgs(this.getGroupId(), EVENT_SPECIFIC_MONSTER_HP_CHANGE, getConfigId(), monsterData.getId()) .setSourceEntityId(getId()) .setParam3((int) this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP)) - .setEventSource(Integer.toString(getConfigId()))); + .setEventSource(getConfigId())); } @Override diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java index 32708ed69..ef20673c9 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java @@ -13,9 +13,11 @@ public class ContentQuestStateEqual extends BaseContent { public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(condition.getParam()[0]); + if (checkQuest == null) { return false; } - return checkQuest.getState().getValue() == params[1]; + + return checkQuest.getState().getValue() == condition.getParam()[1]; } } diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java index 475c3414b..47647b6e3 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java @@ -12,12 +12,12 @@ public class ContentQuestStateNotEqual extends BaseContent { @Override public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { - GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(params[0]); + GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(condition.getParam()[0]); - if (checkQuest != null) { - return checkQuest.getState().getValue() != params[1]; + if (checkQuest == null) { + return false; } - return false; + return checkQuest.getState().getValue() != condition.getParam()[1]; } } diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java index 6c86f080c..d1afc3c5b 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java @@ -13,8 +13,8 @@ public class ContentQuestVarEqual extends BaseContent { @Override public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { - int questVarValue = quest.getMainQuest().getQuestVars()[params[0]]; - Grasscutter.getLogger().debug("questVar {} : {}", params[0], questVarValue); - return questVarValue == params[1]; + int questVarValue = quest.getMainQuest().getQuestVars()[condition.getParam()[0]]; + Grasscutter.getLogger().debug("questVar {} : {}", condition.getParam()[0], questVarValue); + return questVarValue == condition.getParam()[1]; } } diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java index b604fc625..c6247ad80 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java @@ -13,8 +13,8 @@ public class ContentQuestVarGreater extends BaseContent { @Override public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { - int questVarValue = quest.getMainQuest().getQuestVars()[params[0]]; - Grasscutter.getLogger().debug("questVar {} : {}", params[0], questVarValue); - return questVarValue > params[1]; + int questVarValue = quest.getMainQuest().getQuestVars()[condition.getParam()[0]]; + Grasscutter.getLogger().debug("questVar {} : {}", condition.getParam()[0], questVarValue); + return questVarValue > condition.getParam()[1]; } } diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java index e839a42dd..6560305ee 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java @@ -13,8 +13,8 @@ public class ContentQuestVarLess extends BaseContent { @Override public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { - int questVarValue = quest.getMainQuest().getQuestVars()[params[0]]; - Grasscutter.getLogger().debug("questVar {} : {}", params[0], questVarValue); - return questVarValue < params[1]; + int questVarValue = quest.getMainQuest().getQuestVars()[condition.getParam()[0]]; + Grasscutter.getLogger().debug("questVar {} : {}", condition.getParam()[0], questVarValue); + return questVarValue < condition.getParam()[1]; } } diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 8d897306f..0cea8d4df 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -215,7 +215,13 @@ public class SceneScriptManager { var suiteData = group.getSuiteByIndex(suiteIndex); if (suiteData == null) { Grasscutter.getLogger().warn("Group {} suite {} not found", group.id, suiteIndex); - return 0; + group.setLoaded(false); + group.load(this.scene.getId()); + suiteData = group.getSuiteByIndex(suiteIndex); + if (suiteData == null) { + return 0; + } + Grasscutter.getLogger().error("Group {} suite {} nvm, I found it. This is BAD", group.id, suiteIndex); } int prevSuiteIndex = groupInstance.getActiveSuiteId(); diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLib.java b/src/main/java/emu/grasscutter/scripts/ScriptLib.java index cea13b4e4..ba185b86a 100644 --- a/src/main/java/emu/grasscutter/scripts/ScriptLib.java +++ b/src/main/java/emu/grasscutter/scripts/ScriptLib.java @@ -380,7 +380,7 @@ public class ScriptLib { logger.debug("[LUA] Call SetGroupVariableValue with {},{}", var, value); - val groupId= currentGroup.get().id; + val groupId = currentGroup.get().id; val variables = getSceneScriptManager().getVariables(groupId); val old = variables.getOrDefault(var, value); @@ -393,7 +393,7 @@ public class ScriptLib { logger.debug("[LUA] Call ChangeGroupVariableValue with {},{}", var, value); - val groupId= currentGroup.get().id; + val groupId = currentGroup.get().id; val variables = getSceneScriptManager().getVariables(groupId); val old = variables.getOrDefault(var, 0); @@ -962,7 +962,7 @@ public class ScriptLib { return 0; } public int EndTimeAxis(String var1){ - logger.warn("[LUA] Call unimplemented EndTimeAxis with {} {} {}", var1); + logger.warn("[LUA] Call unimplemented EndTimeAxis with {}", var1); //TODO implement var1 == name? return 0; } @@ -1078,6 +1078,12 @@ public class ScriptLib { return 0; } + public int ClearPlayerEyePoint(int var1){ + logger.warn("[LUA] Call unimplemented ClearPlayerEyePoint with {}", var1); + //TODO implement + return 0; + } + public int MoveAvatarByPointArray(int uid, int targetId, LuaTable var3, String var4){ logger.warn("[LUA] Call unimplemented MoveAvatarByPointArray with {} {} {} {}", uid, targetId, printTable(var3), var4); //TODO implement var3 contains int speed, var4 is a json string @@ -1136,7 +1142,7 @@ public class ScriptLib { } public int PlayCutSceneWithParam(int cutsceneId, int var2, LuaTable var3){ - logger.warn("[LUA] Call unimplemented PlayCutScene with {} {}", cutsceneId, var2, var3); + logger.warn("[LUA] Call unimplemented PlayCutScene with {} {} {}", cutsceneId, var2, var3); //TODO implement return 0; } diff --git a/src/main/java/emu/grasscutter/scripts/data/ScriptArgs.java b/src/main/java/emu/grasscutter/scripts/data/ScriptArgs.java index c675a8162..788512b50 100644 --- a/src/main/java/emu/grasscutter/scripts/data/ScriptArgs.java +++ b/src/main/java/emu/grasscutter/scripts/data/ScriptArgs.java @@ -19,10 +19,10 @@ public class ScriptArgs { } public ScriptArgs(int groupId, int eventType, int param1, int param2) { + this.group_id = groupId; this.type = eventType; this.param1 = param1; this.param2 = param2; - this.group_id = groupId; } public int getParam1() {