Added some missing fields (and their models/enums) to the gi group models

This commit is contained in:
hartie95 2023-10-07 23:00:27 +02:00
parent 4e4a00bf0a
commit fc6db58490
23 changed files with 207 additions and 21 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -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

View File

@ -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<Integer> 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<Integer> fishing_areas;
private CrucibleConfig crucible_config;
private OfferingConfig offering_config;
private WorktopConfig worktop_config;
private Map<String, Float> server_global_value_config;
@Override
public EntityType getType() {

View File

@ -8,5 +8,12 @@ import java.util.List;
@ToString
@Getter
public class SceneGarbage {
private List<SceneMonster> monsters;
private List<SceneGadget> gadgets;
private List<SceneRegion> regions;
private List<SceneTrigger> triggers;
public boolean isEmpty() {
return gadgets == null || gadgets.isEmpty();
}
}

View File

@ -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<String> forbid_monster_die; //todo find enum values
private List<Integer> related_level_tag_series_list;
private List<Integer> group_tag_list;
private List<Integer> weathers;
// from group script
@Nullable
private Map<Integer, SceneMonster> monsters; // <ConfigId, Monster>
@Nullable
@ -30,25 +58,27 @@ public class SceneGroup {
@Nullable
private Map<Integer, SceneGadget> gadgets; // <ConfigId, Gadgets>
@Nullable
private Map<String, SceneTrigger> triggers;
private Map<String, SceneTrigger> triggers; // <TriggerName, Trigger>
@Nullable
private Map<Integer, SceneRegion> regions;
private Map<Integer, SceneRegion> regions; // <ConfigId, Region>
@Nullable
private List<SceneSuite> suites;
private Map<Integer, ScenePoint> points; // <ConfigId, ScenePoint>
@Nullable
private List<SceneVar> variables;
@Nullable
private SceneBusiness business;
private SceneInitConfig init_config;
@Nullable
private List<SceneSuite> suites;
private List<SceneMonsterPool> monster_pools;
private List<List<Integer>> 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<SceneGadget> 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) {

View File

@ -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;
}

View File

@ -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<Integer> 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<String, Float> server_global_value_config;
@Override
public EntityType getType() {

View File

@ -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() {

View File

@ -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;

View File

@ -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<Position> point_array;
private List<String> ability_group_list;
private List<String> team_ability_group;
private boolean is_trigger_reload_group;
private boolean is_trigger_reload_group = false;
public boolean contains(Position position) {
switch (shape) {

View File

@ -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<Integer> gadgets = List.of();
private List<String> triggers = List.of();
private List<Integer> regions = List.of();
private List<Integer> npcs = List.of();
private int rand_weight;
private boolean ban_refresh = false;
@ -23,6 +25,7 @@ public class SceneSuite {
private transient List<SceneGadget> sceneGadgets = List.of();
private transient List<SceneTrigger> sceneTriggers = List.of();
private transient List<SceneRegion> sceneRegions = List.of();
private transient List<SceneNPC> 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()
);
}
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -0,0 +1,6 @@
package org.anime_game_servers.gi_lua.models.constants;
public enum IOType {
GROUP_IO_TYPE_DEFAULT,
GROUP_IO_TYPE_FLOW;
}

View File

@ -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;
}

View File

@ -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<Integer> mp_play_id_list;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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<Integer> init_options;
private boolean is_persistent = false;
}

View File

@ -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

View File

@ -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;