mirror of
https://github.com/Anime-Game-Servers/AnimeGamesLua.git
synced 2024-11-23 12:29:44 +00:00
[Fix/refactoring] Added helpers to get SceneReplacement and SharedQuest scripts and fixed a the path for Shared quest scripts
This commit is contained in:
parent
a7048c7023
commit
2c1646396c
@ -39,10 +39,11 @@ public interface GIScriptLoader extends BaseScriptLoader {
|
|||||||
default Path getScriptPath(ScriptSource type, int typeId, String scriptName){
|
default Path getScriptPath(ScriptSource type, int typeId, String scriptName){
|
||||||
val basePath = switch (type) {
|
val basePath = switch (type) {
|
||||||
case SCENE -> "Scene/" + typeId + "/" + scriptName;
|
case SCENE -> "Scene/" + typeId + "/" + scriptName;
|
||||||
|
case SCENE_REPLACEMENT -> "Scene/" + scriptName;
|
||||||
case ACTIVITY-> "Activity/" + typeId + "/" + scriptName;
|
case ACTIVITY-> "Activity/" + typeId + "/" + scriptName;
|
||||||
case COMMON -> "Common/" + scriptName;
|
case COMMON -> "Common/" + scriptName;
|
||||||
case GADGET -> "Gadget/" + scriptName;
|
case GADGET -> "Gadget/" + scriptName;
|
||||||
case SHARED_QUESTS -> "Common/" + scriptName;
|
case SHARED_QUESTS -> "Quest/Share/" + scriptName;
|
||||||
};
|
};
|
||||||
return getScriptPath(basePath);
|
return getScriptPath(basePath);
|
||||||
}
|
}
|
||||||
@ -90,6 +91,14 @@ public interface GIScriptLoader extends BaseScriptLoader {
|
|||||||
luaEngine.addGlobalStaticClass("ScriptLib", ScriptLib.class);
|
luaEngine.addGlobalStaticClass("ScriptLib", ScriptLib.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default boolean loadSceneReplacementScript(ScriptParser parser){
|
||||||
|
return loadData(ScriptSource.SCENE_REPLACEMENT, 0, "groups_replacement.lua", ScriptType.DATA_STORAGE, parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
default boolean loadSharedQuestScript(ScriptParser parser, int questId){
|
||||||
|
return loadData(ScriptSource.SHARED_QUESTS, questId, "Q"+questId+"ShareConfig.lua", ScriptType.DATA_STORAGE, parser);
|
||||||
|
}
|
||||||
|
|
||||||
default boolean loadSceneMetaScript(int sceneId, ScriptParser parser){
|
default boolean loadSceneMetaScript(int sceneId, ScriptParser parser){
|
||||||
return loadData(ScriptSource.SCENE, sceneId, "scene"+sceneId+".lua", ScriptType.DATA_STORAGE, parser);
|
return loadData(ScriptSource.SCENE, sceneId, "scene"+sceneId+".lua", ScriptType.DATA_STORAGE, parser);
|
||||||
}
|
}
|
||||||
@ -98,9 +107,9 @@ public interface GIScriptLoader extends BaseScriptLoader {
|
|||||||
}
|
}
|
||||||
default boolean loadSceneGroupScript(ScriptSource scriptSource, int targetId, int groupId, ScriptParser parser){
|
default boolean loadSceneGroupScript(ScriptSource scriptSource, int targetId, int groupId, ScriptParser parser){
|
||||||
if(scriptSource == ScriptSource.SCENE)
|
if(scriptSource == ScriptSource.SCENE)
|
||||||
return loadData(scriptSource, targetId, "scene"+targetId+"_group"+groupId+".lua", ScriptType.DATA_STORAGE, parser);
|
return loadData(scriptSource, targetId, "scene"+targetId+"_group"+groupId+".lua", ScriptType.EXECUTABLE, parser);
|
||||||
else
|
else
|
||||||
return loadData(scriptSource, targetId, "activity"+targetId+"_group"+groupId+".lua", ScriptType.DATA_STORAGE, parser);
|
return loadData(scriptSource, targetId, "activity"+targetId+"_group"+groupId+".lua", ScriptType.EXECUTABLE, parser);
|
||||||
}
|
}
|
||||||
default boolean loadSceneDummyPoints(int sceneId, ScriptParser parser){
|
default boolean loadSceneDummyPoints(int sceneId, ScriptParser parser){
|
||||||
return loadData(ScriptSource.SCENE, sceneId, "scene"+sceneId+"_dummy_points.lua", ScriptType.DATA_STORAGE, parser);
|
return loadData(ScriptSource.SCENE, sceneId, "scene"+sceneId+"_dummy_points.lua", ScriptType.DATA_STORAGE, parser);
|
||||||
|
@ -5,8 +5,9 @@ enum class ScriptSource(
|
|||||||
val needsId: Boolean
|
val needsId: Boolean
|
||||||
) {
|
) {
|
||||||
SCENE("Scene", true),
|
SCENE("Scene", true),
|
||||||
|
SCENE_REPLACEMENT("Scene", false),
|
||||||
ACTIVITY("Activity", true),
|
ACTIVITY("Activity", true),
|
||||||
COMMON("Common", false),
|
COMMON("Common", false),
|
||||||
GADGET("Gadget", false),
|
GADGET("Gadget", false),
|
||||||
SHARED_QUESTS("Quests/Shared", false),;
|
SHARED_QUESTS("Quest/Share", false),;
|
||||||
}
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package org.anime_game_servers.gi_lua.models;
|
package org.anime_game_servers.gi_lua.models.scene;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
||||||
|
|
||||||
@Getter @EqualsAndHashCode @ToString
|
@Getter @EqualsAndHashCode @ToString
|
||||||
public class DummyPoint {
|
public class DummyPoint {
|
@ -1,7 +1,8 @@
|
|||||||
package org.anime_game_servers.gi_lua.models;
|
package org.anime_game_servers.gi_lua.models.scene;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
||||||
|
|
||||||
@ToString
|
@ToString
|
||||||
@Getter
|
@Getter
|
@ -1,4 +1,4 @@
|
|||||||
package org.anime_game_servers.gi_lua.models;
|
package org.anime_game_servers.gi_lua.models.scene;
|
||||||
|
|
||||||
import io.github.oshai.kotlinlogging.KLogger;
|
import io.github.oshai.kotlinlogging.KLogger;
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging;
|
import io.github.oshai.kotlinlogging.KotlinLogging;
|
||||||
@ -34,7 +34,8 @@ public class SceneMeta {
|
|||||||
//private RTree<SceneBlock, Geometry> sceneBlockIndex;
|
//private RTree<SceneBlock, Geometry> sceneBlockIndex;
|
||||||
|
|
||||||
public static SceneMeta of(int sceneId, GIScriptLoader scriptLoader) {
|
public static SceneMeta of(int sceneId, GIScriptLoader scriptLoader) {
|
||||||
return new SceneMeta(sceneId).load(scriptLoader);
|
return new SceneMeta(sceneId)
|
||||||
|
.load(scriptLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SceneMeta(int sceneId) {
|
private SceneMeta(int sceneId) {
|
@ -5,7 +5,7 @@ import io.github.oshai.kotlinlogging.KLogger;
|
|||||||
import io.github.oshai.kotlinlogging.KotlinLogging;
|
import io.github.oshai.kotlinlogging.KotlinLogging;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
||||||
import org.anime_game_servers.gi_lua.models.SceneMeta;
|
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
|
||||||
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
|
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -2,7 +2,7 @@ package org.anime_game_servers.gi_lua.models.scene.block;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
||||||
import org.anime_game_servers.gi_lua.models.SceneMeta;
|
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -5,7 +5,7 @@ import io.github.oshai.kotlinlogging.KotlinLogging;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.anime_game_servers.gi_lua.models.SceneMeta;
|
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
|
||||||
import org.anime_game_servers.gi_lua.models.loader.ScriptSource;
|
import org.anime_game_servers.gi_lua.models.loader.ScriptSource;
|
||||||
import org.anime_game_servers.gi_lua.models.scene.block.SceneGroupInfo;
|
import org.anime_game_servers.gi_lua.models.scene.block.SceneGroupInfo;
|
||||||
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
|
import org.anime_game_servers.gi_lua.models.loader.GIScriptLoader;
|
||||||
|
@ -3,7 +3,7 @@ package org.anime_game_servers.gi_lua.models.scene.group;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
import org.anime_game_servers.gi_lua.models.PositionImpl;
|
||||||
import org.anime_game_servers.gi_lua.models.SceneMeta;
|
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
|
||||||
import org.anime_game_servers.gi_lua.models.constants.EntityType;
|
import org.anime_game_servers.gi_lua.models.constants.EntityType;
|
||||||
|
|
||||||
@ToString
|
@ToString
|
||||||
|
@ -2,8 +2,7 @@ package org.anime_game_servers.gi_lua.models.scene.group;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.anime_game_servers.gi_lua.models.SceneMeta;
|
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
|
||||||
import org.anime_game_servers.gi_lua.models.scene.group.SceneGroup;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
Loading…
Reference in New Issue
Block a user