mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-17 20:12:34 +08:00
b9a2694ea7
* Fix Lua exec call ## Description fix 352 should not have any slime spawns, its 353 and 351 has a single slime spawn Please carefully read the [Contributing note](https://github.com/Grasscutters/Grasscutter/blob/stable/CONTRIBUTING.md) and [Code of conduct](https://github.com/Grasscutters/Grasscutter/blob/development/CODE_OF_CONDUCT.md) before making any pull requests. ## Issues fixed by this PR <!--- Put the links of issues that may be fixed by this PR here (if any). --> ## Type of changes <!--- Put an `x` in all the boxes that apply your changes. --> - [x] Bug fix - [ ] New feature - [ ] Enhancement - [ ] Documentation ## Checklist: - [x] My code follows the style guidelines of this project - [x] My pull request is unique and no other pull requests have been opened for these changes - [x] I have read the [Contributing note](https://github.com/Grasscutters/Grasscutter/blob/stable/CONTRIBUTING.md) and [Code of conduct](https://github.com/Grasscutters/Grasscutter/blob/development/CODE_OF_CONDUCT.md) - [x] I am responsible for any copyright issues with my code if it occurs in the future. * Update ExecNotifyGroupLua.java * Update ExecNotifyGroupLua.java * Update ExecNotifyGroupLua.java * new ScriptArgs(groupId, eventType, quest.getSubQuestId()) .setEventSource(String.valueOf(quest.getSubQuestId()));
61 lines
2.6 KiB
Java
61 lines
2.6 KiB
Java
package emu.grasscutter.game.quest.exec;
|
|
|
|
import emu.grasscutter.Grasscutter;
|
|
import emu.grasscutter.data.excels.QuestData;
|
|
import emu.grasscutter.game.quest.GameQuest;
|
|
import emu.grasscutter.game.quest.QuestValueExec;
|
|
import emu.grasscutter.game.quest.enums.QuestExec;
|
|
import emu.grasscutter.game.quest.enums.QuestState;
|
|
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
|
|
import emu.grasscutter.scripts.constants.EventType;
|
|
import emu.grasscutter.scripts.data.ScriptArgs;
|
|
import lombok.val;
|
|
|
|
@QuestValueExec(QuestExec.QUEST_EXEC_NOTIFY_GROUP_LUA)
|
|
public class ExecNotifyGroupLua extends QuestExecHandler {
|
|
|
|
@Override
|
|
public boolean execute(GameQuest quest, QuestData.QuestExecParam condition, String... paramStr) {
|
|
val sceneId = Integer.parseInt(paramStr[0]);
|
|
val groupId = Integer.parseInt(paramStr[1]);
|
|
|
|
val scene = quest.getOwner().getScene();
|
|
val scriptManager = scene.getScriptManager();
|
|
|
|
if (scene.getId() != sceneId) {
|
|
return false;
|
|
}
|
|
scene.runWhenFinished(
|
|
() -> {
|
|
val groupInstance = scriptManager.getGroupInstanceById(groupId);
|
|
|
|
if (groupInstance != null) {
|
|
// workaround to make sure the triggers are still there todo find better way of trigger
|
|
// handling
|
|
scriptManager.refreshGroup(groupInstance);
|
|
Grasscutter.getLogger()
|
|
.debug(
|
|
"group: {} \ncondition: {} \nparamStr {}",
|
|
groupInstance.getLuaGroup(),
|
|
condition,
|
|
paramStr);
|
|
} else {
|
|
Grasscutter.getLogger()
|
|
.warn(
|
|
"notify, no group instance for:\n group: {} \ncondition: {} \nparamStr {}",
|
|
groupId,
|
|
condition,
|
|
paramStr);
|
|
}
|
|
|
|
val eventType =
|
|
quest.getState() == QuestState.QUEST_STATE_FINISHED
|
|
? EventType.EVENT_QUEST_FINISH
|
|
: EventType.EVENT_QUEST_START;
|
|
scriptManager.callEvent(new ScriptArgs(groupId, eventType, quest.getSubQuestId()).setEventSource(String.valueOf(quest.getSubQuestId())));
|
|
});
|
|
|
|
return true;
|
|
}
|
|
}
|