diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneConfig.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneConfig.java index 825c916..a39295d 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneConfig.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneConfig.java @@ -2,6 +2,7 @@ package org.anime_game_servers.gi_lua.models; import lombok.Getter; import lombok.ToString; +import org.anime_game_servers.gi_lua.models.Position; @ToString @Getter diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGadget.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGadget.java index 06c45ec..2332f86 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGadget.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGadget.java @@ -3,9 +3,14 @@ package org.anime_game_servers.gi_lua.models; import lombok.Getter; import lombok.ToString; import org.anime_game_servers.gi_lua.models.constants.EntityType; +import org.anime_game_servers.gi_lua.models.scene.group.CrucibleConfig; +import org.anime_game_servers.gi_lua.models.scene.group.OfferingConfig; +import org.anime_game_servers.gi_lua.models.scene.group.WorktopConfig; import java.util.List; +import java.util.Map; +@SuppressWarnings("FieldMayBeFinal") @ToString @Getter public class SceneGadget extends SceneObject{ @@ -13,17 +18,31 @@ public class SceneGadget extends SceneObject{ private int state; private int point_type; private SceneBossChest boss_chest; + private int drop_id; private int chest_drop_id; private int interact_id; - private boolean isOneoff; + private boolean isOneoff = false; private int draft_id; private int route_id; private boolean start_route = true; private boolean is_use_point_array = false; private boolean persistent = false; - private boolean showcutscene; + private boolean showcutscene = false; + private int owner; // cfg id + private boolean autopick = false; private Explore explore; private List arguments; + private int oneoff_reset_version; + private boolean is_guest_can_operate = false; + private boolean is_blossom_chest = false; + private boolean is_enable_interact = true; + private int talk_state; + private int fishing_id; + private List fishing_areas; + private CrucibleConfig crucible_config; + private OfferingConfig offering_config; + private WorktopConfig worktop_config; + private Map server_global_value_config; @Override public EntityType getType() { diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGarbage.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGarbage.java index ef8c600..3b472ae 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGarbage.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGarbage.java @@ -8,5 +8,12 @@ import java.util.List; @ToString @Getter public class SceneGarbage { + private List monsters; private List gadgets; + private List regions; + private List triggers; + + public boolean isEmpty() { + return gadgets == null || gadgets.isEmpty(); + } } diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGroup.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGroup.java index 66eadec..7b464ac 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGroup.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneGroup.java @@ -4,6 +4,9 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; import lombok.val; +import org.anime_game_servers.gi_lua.models.scene.block.GroupLifecycle; +import org.anime_game_servers.gi_lua.models.scene.group.SceneMonsterPool; +import org.anime_game_servers.gi_lua.models.scene.group.ScenePoint; import org.anime_game_servers.gi_lua.utils.GIScriptLoader; import org.anime_game_servers.lua.engine.LuaScript; import org.anime_game_servers.lua.models.ScriptType; @@ -12,6 +15,7 @@ import javax.annotation.Nullable; import java.util.*; import java.util.stream.Collectors; +@SuppressWarnings("FieldMayBeFinal") @ToString @Getter public class SceneGroup { @@ -19,10 +23,34 @@ public class SceneGroup { @Setter private int id; + // from block private int refresh_id; + private int area; @Nullable private Position pos; + @Nullable + private SceneReplaceable is_replaceable; + private final boolean dynamic_load = false; + @Nullable + private SceneBusiness business; + @Nullable + private GroupLifecycle life_cycle = GroupLifecycle.FULL_TIME__CYCLE; + private int activity_revise_level_grow_id; + private int rely_start_world_level_limit_activity_id; + private int vision_type; + private boolean across_block = false; + private boolean unload_when_disconnect = false; + private boolean ignore_world_level_revise = false; + private boolean force_unload_nodelay = false; + private boolean force_clean_sub_entity = false; + private boolean is_load_by_vision_type = false; + private int load_strategy; + private Set forbid_monster_die; //todo find enum values + private List related_level_tag_series_list; + private List group_tag_list; + private List weathers; + // from group script @Nullable private Map monsters; // @Nullable @@ -30,25 +58,27 @@ public class SceneGroup { @Nullable private Map gadgets; // @Nullable - private Map triggers; + private Map triggers; // @Nullable - private Map regions; + private Map regions; // @Nullable - private List suites; + private Map points; // @Nullable private List variables; @Nullable - private SceneBusiness business; + private SceneInitConfig init_config; + @Nullable + private List suites; + + private List monster_pools; + private List> sight_groups; + @Nullable private SceneGarbage garbages; - @Nullable - private SceneInitConfig init_config; - private final boolean dynamic_load = false; - @Nullable - private SceneReplaceable is_replaceable; + // internal private transient boolean loaded; // Not an actual variable in the scripts either private transient LuaScript script; @@ -62,12 +92,17 @@ public class SceneGroup { return this.business == null ? 0 : this.business.getType(); } + public boolean hasGarbages() { + return this.garbages != null && !garbages.isEmpty(); + } + + @Nullable public List getGarbageGadgets() { return this.garbages == null ? null : this.garbages.getGadgets(); } public boolean isReplaceable() { - return this.is_replaceable != null ? this.is_replaceable.isValue() : false; + return this.is_replaceable != null && this.is_replaceable.isValue(); } public SceneSuite getSuiteByIndex(int index) { diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneInitConfig.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneInitConfig.java index 22f44b6..a53d994 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneInitConfig.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneInitConfig.java @@ -9,5 +9,7 @@ public class SceneInitConfig { private int suite; private int end_suite; private int io_type ; + private int sub_flow_type; + private int secure_suite_index; private boolean rand_suite; } diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneMonster.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneMonster.java index 0964089..51a599e 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneMonster.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneMonster.java @@ -5,6 +5,7 @@ import lombok.ToString; import org.anime_game_servers.gi_lua.models.constants.EntityType; import java.util.List; +import java.util.Map; @ToString @Getter @@ -12,18 +13,22 @@ public class SceneMonster extends SceneObject{ private int monster_id; private int pose_id; private String pose_logic_state; + private boolean isOneoff = false; private int drop_id; - private boolean disableWander; + private boolean disableWander = false; private int title_id; private int special_name_id; private List affix; - private boolean isElite; + private boolean isElite = false; private int climate_area_id; private int ai_config_id; private int kill_score; private int speed_level; private long tag; - private boolean is_light_config; + private boolean is_light_config = false; + private int oneoff_reset_version; + private int sight_group_index; + private Map server_global_value_config; @Override public EntityType getType() { diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneNPC.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneNPC.java index 52fc114..440246f 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneNPC.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneNPC.java @@ -8,6 +8,7 @@ import org.anime_game_servers.gi_lua.models.constants.EntityType; @Getter public class SceneNPC extends SceneObject{ private int npc_id; + int area_id; @Override public EntityType getType() { diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneObject.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneObject.java index 7988da8..7c62526 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneObject.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneObject.java @@ -7,8 +7,8 @@ import org.anime_game_servers.gi_lua.models.constants.EntityType; @ToString @Getter public abstract class SceneObject { - protected int level; protected int config_id; + protected int level; protected int area_id; protected int vision_level = 0; protected int mark_flag; diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneRegion.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneRegion.java index 25094bc..b4b7898 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneRegion.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneRegion.java @@ -7,6 +7,7 @@ import org.anime_game_servers.gi_lua.models.constants.ScriptRegionShape; import java.util.List; +@SuppressWarnings("FieldMayBeFinal") @Getter public class SceneRegion extends SceneObject{ private int shape; @@ -17,8 +18,9 @@ public class SceneRegion extends SceneObject{ // for CYLINDER and POLYGON private float height; private List point_array; + private List ability_group_list; private List team_ability_group; - private boolean is_trigger_reload_group; + private boolean is_trigger_reload_group = false; public boolean contains(Position position) { switch (shape) { diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneSuite.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneSuite.java index ef4ce55..eda8888 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneSuite.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneSuite.java @@ -7,6 +7,7 @@ import lombok.val; import java.util.ArrayList; import java.util.List; +@SuppressWarnings("FieldMayBeFinal") @ToString @Getter public class SceneSuite { @@ -15,6 +16,7 @@ public class SceneSuite { private List gadgets = List.of(); private List triggers = List.of(); private List regions = List.of(); + private List npcs = List.of(); private int rand_weight; private boolean ban_refresh = false; @@ -23,6 +25,7 @@ public class SceneSuite { private transient List sceneGadgets = List.of(); private transient List sceneTriggers = List.of(); private transient List sceneRegions = List.of(); + private transient List sceneNPCs = List.of(); public void init(SceneGroup sceneGroup) { val monsters = sceneGroup.getMonsters(); @@ -63,6 +66,15 @@ public class SceneSuite { .toList() ); } + val npcs = sceneGroup.getNpcs(); + if(npcs != null) { + this.sceneNPCs = new ArrayList<>( + this.npcs.stream() + .filter(npcs::containsKey) + .map(npcs::get) + .toList() + ); + } } } diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneTrigger.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneTrigger.java index 484e186..f456b56 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneTrigger.java +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/SceneTrigger.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; @Data @NoArgsConstructor -// todo find way to deserialize from lua with final fields, maybe with the help of Builder? public class SceneTrigger { /** * When the trigger count is set to this, it only gets unregistered on a return of != 0 from the trigger function. @@ -21,7 +20,7 @@ public class SceneTrigger { private String action; private String tag; private String tlog_tag; - private boolean forbid_guest; + private boolean forbid_guest = true; private transient SceneGroup currentGroup; } diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/FlowGroupSubType.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/FlowGroupSubType.java new file mode 100644 index 0000000..1e824b2 --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/FlowGroupSubType.java @@ -0,0 +1,6 @@ +package org.anime_game_servers.gi_lua.models.constants; + +public enum FlowGroupSubType { + GROUP_SUB_FLOW_TYPE_DEFAULT, + GROUP_SUB_FLOW_TYPE_WORLD_QUEST; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/GroupLoadStrategy.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/GroupLoadStrategy.java new file mode 100644 index 0000000..4a4d856 --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/GroupLoadStrategy.java @@ -0,0 +1,20 @@ +package org.anime_game_servers.gi_lua.models.constants; + +import org.anime_game_servers.lua.models.IntValueEnum; + +public enum GroupLoadStrategy implements IntValueEnum { + GROUP_LOAD_NONE(0), + GROUP_LOAD_SINGLE(1), + GROUP_LOAD_MULTI(2), + GROUP_LOAD_ALL(3); + private final int value; + + private GroupLoadStrategy(int value) { + this.value = value; + } + + @Override + public int getValue() { + return value; + } +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/IOType.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/IOType.java new file mode 100644 index 0000000..76c505a --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/constants/IOType.java @@ -0,0 +1,6 @@ +package org.anime_game_servers.gi_lua.models.constants; + +public enum IOType { + GROUP_IO_TYPE_DEFAULT, + GROUP_IO_TYPE_FLOW; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/block/GroupLifecycle.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/block/GroupLifecycle.java new file mode 100644 index 0000000..64a32be --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/block/GroupLifecycle.java @@ -0,0 +1,14 @@ +package org.anime_game_servers.gi_lua.models.scene.block; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public class GroupLifecycle { + public static final GroupLifecycle FULL_TIME__CYCLE = new GroupLifecycle(0, 24); + private int from; + private int to; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/CrucibleConfig.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/CrucibleConfig.java new file mode 100644 index 0000000..8737a52 --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/CrucibleConfig.java @@ -0,0 +1,13 @@ +package org.anime_game_servers.gi_lua.models.scene.group; + +import lombok.Getter; + +import java.util.List; + +@Getter +public class CrucibleConfig { + private int duration; + private int start_cd; + private int mp_play_id; + private List mp_play_id_list; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/OfferingConfig.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/OfferingConfig.java new file mode 100644 index 0000000..7755168 --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/OfferingConfig.java @@ -0,0 +1,8 @@ +package org.anime_game_servers.gi_lua.models.scene.group; + +import lombok.Getter; + +@Getter +public class OfferingConfig { + private int offering_id; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/SceneMonsterPool.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/SceneMonsterPool.java new file mode 100644 index 0000000..2425c5f --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/SceneMonsterPool.java @@ -0,0 +1,9 @@ +package org.anime_game_servers.gi_lua.models.scene.group; + +import lombok.Getter; + +@Getter +public class SceneMonsterPool { + private int poolId; + private int rand_weight; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/ScenePoint.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/ScenePoint.java new file mode 100644 index 0000000..34ed4f3 --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/ScenePoint.java @@ -0,0 +1,12 @@ +package org.anime_game_servers.gi_lua.models.scene.group; + +import org.anime_game_servers.gi_lua.models.constants.EntityType; +import org.anime_game_servers.gi_lua.models.SceneObject; + +public class ScenePoint extends SceneObject { + private long tag; + @Override + public EntityType getType() { + return EntityType.NONE; + } +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/WorktopConfig.java b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/WorktopConfig.java new file mode 100644 index 0000000..0306bdf --- /dev/null +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/models/scene/group/WorktopConfig.java @@ -0,0 +1,11 @@ +package org.anime_game_servers.gi_lua.models.scene.group; + +import lombok.Getter; + +import java.util.Set; + +@Getter +public class WorktopConfig { + private Set init_options; + private boolean is_persistent = false; +} diff --git a/GILua/src/main/java/org/anime_game_servers/gi_lua/script_lib/GroupEventLuaContext.kt b/GILua/src/main/java/org/anime_game_servers/gi_lua/script_lib/GroupEventLuaContext.kt index e7ae8b5..04ff53f 100644 --- a/GILua/src/main/java/org/anime_game_servers/gi_lua/script_lib/GroupEventLuaContext.kt +++ b/GILua/src/main/java/org/anime_game_servers/gi_lua/script_lib/GroupEventLuaContext.kt @@ -2,7 +2,6 @@ package org.anime_game_servers.gi_lua.script_lib import org.anime_game_servers.gi_lua.models.SceneGroup import org.anime_game_servers.gi_lua.models.ScriptArgs -import org.anime_game_servers.lua.engine.LuaEngine interface GroupEventLuaContext: LuaContext { fun getGroupInstance(): SceneGroup diff --git a/JNLuaEngine/src/main/java/org/anime_game_servers/jnlua_engine/JNLuaEngine.java b/JNLuaEngine/src/main/java/org/anime_game_servers/jnlua_engine/JNLuaEngine.java index f35f919..464fc59 100644 --- a/JNLuaEngine/src/main/java/org/anime_game_servers/jnlua_engine/JNLuaEngine.java +++ b/JNLuaEngine/src/main/java/org/anime_game_servers/jnlua_engine/JNLuaEngine.java @@ -6,7 +6,6 @@ import org.anime_game_servers.lua.engine.LuaScript; import org.anime_game_servers.lua.engine.LuaTable; import org.anime_game_servers.lua.models.IntValueEnum; import org.anime_game_servers.lua.models.ScriptType; -import org.anime_game_servers.lua.serialize.Serializer; import org.jetbrains.annotations.Nullable; import org.terasology.jnlua.JavaFunction;