Fix chasing shadows (mostly)

This commit is contained in:
KingRainbow44 2023-06-01 19:59:36 -04:00
parent 8692405363
commit 20f0cda3e0
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
5 changed files with 46 additions and 52 deletions

View File

@ -111,7 +111,9 @@ public class QuestManager extends BasePlayerManager {
30700, // Quest which is responsible for unlocking Crash Course. 30700, // Quest which is responsible for unlocking Crash Course.
30800, // Quest which is responsible for unlocking Sparks Amongst the Pages. 30800, // Quest which is responsible for unlocking Sparks Amongst the Pages.
47001, 47002, 47003, 47004 47001, 47002, 47003, 47004,
2010103, 2010144 // Prologue Act 2: Chasing Shadows
)); ));
} }
} }

View File

@ -53,7 +53,8 @@ public class ExecNotifyGroupLua extends QuestExecHandler {
? EventType.EVENT_QUEST_FINISH ? EventType.EVENT_QUEST_FINISH
: EventType.EVENT_QUEST_START; : EventType.EVENT_QUEST_START;
scriptManager.callEvent( scriptManager.callEvent(
new ScriptArgs(groupId, eventType, quest.getSubQuestId()) new ScriptArgs(groupId, eventType, quest.getSubQuestId(),
quest.getState() == QuestState.QUEST_STATE_FINISHED ? 1 : 0)
.setEventSource(quest.getSubQuestId())); .setEventSource(quest.getSubQuestId()));
}); });

View File

@ -1,54 +1,44 @@
package emu.grasscutter.game.world; package emu.grasscutter.game.world;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.*;
import emu.grasscutter.data.GameDepot;
import emu.grasscutter.data.binout.SceneNpcBornEntry; import emu.grasscutter.data.binout.SceneNpcBornEntry;
import emu.grasscutter.data.binout.routes.Route; import emu.grasscutter.data.binout.routes.Route;
import emu.grasscutter.data.excels.ItemData; import emu.grasscutter.data.excels.*;
import emu.grasscutter.data.excels.SceneData;
import emu.grasscutter.data.excels.codex.CodexAnimalData; import emu.grasscutter.data.excels.codex.CodexAnimalData;
import emu.grasscutter.data.excels.monster.MonsterData; import emu.grasscutter.data.excels.monster.MonsterData;
import emu.grasscutter.data.excels.world.WorldLevelData; import emu.grasscutter.data.excels.world.WorldLevelData;
import emu.grasscutter.data.server.Grid; import emu.grasscutter.data.server.Grid;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.dungeons.DungeonManager; import emu.grasscutter.game.dungeons.*;
import emu.grasscutter.game.dungeons.DungeonSettleListener;
import emu.grasscutter.game.dungeons.challenge.WorldChallenge; import emu.grasscutter.game.dungeons.challenge.WorldChallenge;
import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType; import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
import emu.grasscutter.game.entity.*; import emu.grasscutter.game.entity.*;
import emu.grasscutter.game.entity.gadget.GadgetWorktop; import emu.grasscutter.game.entity.gadget.GadgetWorktop;
import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.managers.blossom.BlossomManager; import emu.grasscutter.game.managers.blossom.BlossomManager;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.*;
import emu.grasscutter.game.player.TeamInfo;
import emu.grasscutter.game.props.*; import emu.grasscutter.game.props.*;
import emu.grasscutter.game.quest.QuestGroupSuite; import emu.grasscutter.game.quest.QuestGroupSuite;
import emu.grasscutter.game.world.data.TeleportProperties; import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult; import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.EnterTypeOuterClass; import emu.grasscutter.net.proto.*;
import emu.grasscutter.net.proto.SelectWorktopOptionReqOuterClass;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import emu.grasscutter.scripts.SceneIndexManager; import emu.grasscutter.scripts.*;
import emu.grasscutter.scripts.SceneScriptManager;
import emu.grasscutter.scripts.constants.EventType; import emu.grasscutter.scripts.constants.EventType;
import emu.grasscutter.scripts.data.SceneBlock; import emu.grasscutter.scripts.data.*;
import emu.grasscutter.scripts.data.SceneGroup;
import emu.grasscutter.scripts.data.ScriptArgs;
import emu.grasscutter.server.event.entity.EntityCreationEvent; import emu.grasscutter.server.event.entity.EntityCreationEvent;
import emu.grasscutter.server.event.player.PlayerTeleportEvent; import emu.grasscutter.server.event.player.PlayerTeleportEvent;
import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.objects.KahnsSort; import emu.grasscutter.utils.objects.KahnsSort;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import java.util.*; import lombok.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import lombok.Getter; import java.util.*;
import lombok.Setter; import java.util.concurrent.*;
import lombok.val; import java.util.stream.Collectors;
public final class Scene { public final class Scene {
@Getter private final World world; @Getter private final World world;

View File

@ -1,7 +1,5 @@
package emu.grasscutter.scripts; package emu.grasscutter.scripts;
import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT;
import com.github.davidmoten.rtreemulti.RTree; import com.github.davidmoten.rtreemulti.RTree;
import com.github.davidmoten.rtreemulti.geometry.Geometry; import com.github.davidmoten.rtreemulti.geometry.Geometry;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
@ -21,17 +19,20 @@ import emu.grasscutter.server.packet.send.PacketGroupSuiteNotify;
import emu.grasscutter.utils.*; import emu.grasscutter.utils.*;
import io.netty.util.concurrent.FastThreadLocalThread; import io.netty.util.concurrent.FastThreadLocalThread;
import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.ints.*;
import kotlin.Pair;
import lombok.val;
import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
import javax.annotation.*;
import java.io.*; import java.io.*;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.*;
import kotlin.Pair; import static emu.grasscutter.scripts.constants.EventType.EVENT_TIMER_EVENT;
import lombok.val;
import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
public class SceneScriptManager { public class SceneScriptManager {
private final Scene scene; private final Scene scene;
@ -801,26 +802,26 @@ public class SceneScriptManager {
private void realCallEvent(@Nonnull ScriptArgs params) { private void realCallEvent(@Nonnull ScriptArgs params) {
try { try {
ScriptLoader.getScriptLib().setSceneScriptManager(this); ScriptLoader.getScriptLib().setSceneScriptManager(this);
int eventType = params.type;
Set<SceneTrigger> relevantTriggers = new HashSet<>(); var eventType = params.type;
if (eventType == EventType.EVENT_ENTER_REGION || eventType == EventType.EVENT_LEAVE_REGION) { var relevantTriggers = switch (eventType) {
relevantTriggers = case EventType.EVENT_ENTER_REGION, EventType.EVENT_LEAVE_REGION ->
this.getTriggersByEvent(eventType).stream() this.getTriggersByEvent(eventType).stream()
.filter( .filter(
t -> t ->
t.getCondition().contains(String.valueOf(params.param1)) t.getCondition().contains(String.valueOf(params.param1))
&& (t.getSource().isEmpty() && (t.getSource().isEmpty()
|| t.getSource().equals(params.getEventSource()))) || t.getSource().equals(params.getEventSource())))
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} else { default ->
relevantTriggers = this.getTriggersByEvent(eventType).stream()
this.getTriggersByEvent(eventType).stream() .filter(
.filter( t -> params.getGroupId() == 0 || t.getCurrentGroup().id == params.getGroupId())
t -> params.getGroupId() == 0 || t.getCurrentGroup().id == params.getGroupId()) .filter(
.filter( t -> (t.getSource().isEmpty() || t.getSource().equals(params.getEventSource())))
t -> (t.getSource().isEmpty() || t.getSource().equals(params.getEventSource()))) .collect(Collectors.toSet());
.collect(Collectors.toSet()); };
}
for (SceneTrigger trigger : relevantTriggers) { for (SceneTrigger trigger : relevantTriggers) {
handleEventForTrigger(params, trigger); handleEventForTrigger(params, trigger);
} }

View File

@ -129,7 +129,7 @@ public class ScriptLib {
public int SetWorktopOptionsByGroupId(int groupId, int configId, int[] options) { public int SetWorktopOptionsByGroupId(int groupId, int configId, int[] options) {
logger.debug("[LUA] Call SetWorktopOptionsByGroupId with {},{},{}", logger.debug("[LUA] Call SetWorktopOptionsByGroupId with {},{},{}",
groupId,configId,options); groupId, configId, options);
val entity = getSceneScriptManager().getScene().getEntityByConfigId(configId, groupId); val entity = getSceneScriptManager().getScene().getEntityByConfigId(configId, groupId);