[Refactoring] Directly use Enum Type for some gi_lua properties and add visionTypeList field to SceneRegion

This commit is contained in:
hartie95 2024-02-06 20:32:09 +01:00
parent 0a9cdd9bc9
commit 1fe2854411
8 changed files with 46 additions and 21 deletions

View File

@ -1,15 +0,0 @@
package org.anime_game_servers.gi_lua.models.constants;
import org.anime_game_servers.core.base.annotations.lua.LuaStatic;
@LuaStatic
public enum VisionLevelType {
VISION_LEVEL_NORMAL,
VISION_LEVEL_LITTLE_REMOTE,
VISION_LEVEL_REMOTE,
VISION_LEVEL_SUPER,
VISION_LEVEL_NEARBY,
VISION_LEVEL_SUPER_NEARBY,
VISION_LEVEL_SUPER_NUM,
}

View File

@ -0,0 +1,21 @@
package org.anime_game_servers.gi_lua.models.constants
import org.anime_game_servers.core.base.annotations.lua.LuaStatic
import org.anime_game_servers.core.base.interfaces.IntValueEnum
@LuaStatic
enum class VisionLevelType(private val value: Int) : IntValueEnum {
VISION_LEVEL_NORMAL(0),
VISION_LEVEL_LITTLE_REMOTE(1),
VISION_LEVEL_REMOTE(2),
VISION_LEVEL_SUPER(3),
VISION_LEVEL_NEARBY(4),
VISION_LEVEL_SUPER_NEARBY(5),
VISION_LEVEL_SUPER_NUM(6);
override fun getValue() = value
companion object {
@JvmStatic
fun getDefault() = VISION_LEVEL_NORMAL
}
}

View File

@ -3,6 +3,7 @@ package org.anime_game_servers.gi_lua.models.scene.block;
import lombok.Getter;
import org.anime_game_servers.core.base.annotations.lua.LuaNames;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.gi_lua.models.constants.GroupLoadStrategy;
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
import javax.annotation.Nullable;
@ -29,6 +30,9 @@ public class SceneGroupInfo {
private int activityReviseLevelGrowId;
@LuaNames("rely_start_world_level_limit_activity_id")
private int relyStartWorldLevelLimitActivityId; // SceneScriptConfig LuaConfigMgr
/**
* seems to be linked to SceneRegion.visionTypeList
*/
@LuaNames("vision_type")
private int visionType;
@LuaNames("across_block")
@ -44,7 +48,7 @@ public class SceneGroupInfo {
@LuaNames("is_load_by_vision_type")
private boolean isLoadByVisionType = false;
@LuaNames("load_strategy")
private int loadStrategy;
private GroupLoadStrategy loadStrategy;
@LuaNames("forbid_monster_die")
private Set<String> forbidMonsterDie; //todo find enum values
@LuaNames("related_level_tag_series_list")

View File

@ -6,6 +6,7 @@ import lombok.Getter;
import lombok.ToString;
import lombok.val;
import org.anime_game_servers.core.base.annotations.lua.LuaNames;
import org.anime_game_servers.gi_lua.models.constants.IOType;
import org.anime_game_servers.gi_lua.models.loader.SceneGroupScriptLoadParams;
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
import org.anime_game_servers.gi_lua.models.loader.ScriptSource;
@ -168,7 +169,7 @@ public class SceneGroup {
public int findInitSuiteIndex(int exclude_index) { //TODO: Investigate end index
if (initConfig == null) return 1;
if (initConfig.getIoType() == 1) return initConfig.getSuite(); //IO TYPE FLOW
if (initConfig.getIoType() == IOType.GROUP_IO_TYPE_FLOW) return initConfig.getSuite();
if (initConfig.isRandSuite()) {
if (suites.size() == 1) {
return initConfig.getSuite();

View File

@ -3,6 +3,8 @@ package org.anime_game_servers.gi_lua.models.scene.group;
import lombok.Getter;
import lombok.ToString;
import org.anime_game_servers.core.base.annotations.lua.LuaNames;
import org.anime_game_servers.gi_lua.models.constants.FlowGroupSubType;
import org.anime_game_servers.gi_lua.models.constants.IOType;
@ToString
@Getter
@ -11,9 +13,9 @@ public class SceneInitConfig {
@LuaNames("end_suite")
private int endSuite;
@LuaNames("io_type")
private int ioType ;
private IOType ioType = IOType.GROUP_IO_TYPE_DEFAULT;
@LuaNames("sub_flow_type")
private int subFlowType;
private FlowGroupSubType subFlowType = FlowGroupSubType.GROUP_SUB_FLOW_TYPE_DEFAULT;
@LuaNames("secure_suite_index")
private int secureSuiteIndex;
@LuaNames("rand_suite")

View File

@ -4,6 +4,7 @@ import lombok.Getter;
import lombok.ToString;
import org.anime_game_servers.core.base.annotations.lua.LuaNames;
import org.anime_game_servers.gi_lua.models.PositionImpl;
import org.anime_game_servers.gi_lua.models.constants.VisionLevelType;
import org.anime_game_servers.gi_lua.models.scene.SceneMeta;
import org.anime_game_servers.gi_lua.models.constants.EntityType;
@ -16,7 +17,7 @@ public abstract class SceneObject {
@LuaNames("area_id")
protected int areaId;
@LuaNames("vision_level")
protected int visionLevel = 0;
protected VisionLevelType visionLevel = VisionLevelType.VISION_LEVEL_NORMAL;
@LuaNames("mark_flag")
protected int markFlag;
@LuaNames("drop_tag")

View File

@ -9,7 +9,6 @@ import org.anime_game_servers.gi_lua.models.constants.ScriptRegionShape;
import java.util.List;
@SuppressWarnings("FieldMayBeFinal")
@Getter
public class SceneRegion extends SceneObject{
@ -28,6 +27,11 @@ public class SceneRegion extends SceneObject{
private List<String> teamAbilityGroup;
@LuaNames("is_trigger_reload_group")
private boolean isTriggerReloadGroup = false;
/**
* seems to be linked to SceneGroupInfo.visionType
*/
@LuaNames("vision_type_list")
private List<Integer> visionTypeList;
public boolean contains(Vector position) {
switch (shape) {

View File

@ -37,6 +37,13 @@ public interface ScriptLibHandler<GroupEventContext extends GroupEventLuaContext
int AutoMonsterTide(GroupEventContext context, int challengeIndex, int groupId, Integer[] ordersConfigId, int tideCount, int sceneLimit, int param6);
int GoToGroupSuite(GroupEventContext context, int groupId, int suite);
/**
*
* @param context
* @param groupId either 0 for the current group, or a group id
* @param suite
* @return
*/
int AddExtraGroupSuite(GroupEventContext context, int groupId, int suite);
int RemoveExtraGroupSuite(GroupEventContext context, int groupId, int suite);
int KillExtraGroupSuite(GroupEventContext context, int groupId, int suite);