mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
Merge branch 'development' into more-events
This commit is contained in:
@@ -435,8 +435,8 @@ public class Player {
|
||||
this.updateWorldLevel();
|
||||
this.updateProfile();
|
||||
|
||||
// Handle OpenState unlocks from level-up.
|
||||
this.getOpenStateManager().unlockLevelDependentStates();
|
||||
// Handle open state unlocks from level-up.
|
||||
this.getOpenStateManager().tryUnlockOpenStates();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1342,9 +1342,6 @@ public class Player {
|
||||
this.forgingManager.sendForgeDataNotify();
|
||||
this.resinManager.onPlayerLogin();
|
||||
this.cookingManager.sendCookDataNofity();
|
||||
|
||||
// Unlock in case this is an existing user that reached a level before we implemented unlocking.
|
||||
this.getOpenStateManager().unlockLevelDependentStates();
|
||||
this.getOpenStateManager().onPlayerLogin();
|
||||
|
||||
getTodayMoonCard(); // The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward.
|
||||
|
||||
@@ -1,73 +1,157 @@
|
||||
package emu.grasscutter.game.player;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Transient;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.OpenState;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.OpenStateData;
|
||||
import emu.grasscutter.data.excels.OpenStateData.OpenStateCondType;
|
||||
import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
|
||||
import emu.grasscutter.server.packet.send.PacketOpenStateChangeNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketOpenStateUpdateNotify;
|
||||
import lombok.Getter;
|
||||
import emu.grasscutter.server.packet.send.PacketSetOpenStateRsp;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static emu.grasscutter.game.props.OpenState.*;
|
||||
|
||||
@Entity
|
||||
public class PlayerOpenStateManager extends BasePlayerDataManager {
|
||||
// Map of all open states that this player has. Do not put default values here.
|
||||
// Set of open states that are never unlocked, whether they fulfill the conditions or not.
|
||||
public static final Set<Integer> BLACKLIST_OPEN_STATES = Set.of(
|
||||
48 // blacklist OPEN_STATE_LIMIT_REGION_GLOBAL to make Meledy happy. =D Remove this as soon as quest unlocks are fully implemented.
|
||||
);
|
||||
|
||||
// Set of open states that are set per default for all accounts. Can be overwritten by an entry in `map`.
|
||||
public static final Set<Integer> DEFAULT_OPEN_STATES = GameData.getOpenStateList().stream()
|
||||
.filter(s ->
|
||||
s.isDefaultState() // Actual default-opened states.
|
||||
|| (s.getCond().stream().filter(c -> c.getCondType() == OpenStateCondType.OPEN_STATE_COND_PLAYER_LEVEL).count() == 0) // All states whose unlock we don't handle correctly yet.
|
||||
|| s.getId() == 1 // Always unlock OPEN_STATE_PAIMON, otherwise the player will not have a working chat.
|
||||
)
|
||||
.filter(s -> !BLACKLIST_OPEN_STATES.contains(s.getId())) // Filter out states in the blacklist.
|
||||
.map(s -> s.getId())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// Map of all open states that this player has.
|
||||
private Map<Integer, Integer> map;
|
||||
|
||||
/*
|
||||
//DO NOT MODIFY. Based on conversation of official server and client, game version 2.7
|
||||
private static Set<OpenState> newPlayerOpenStates = Set.of(OPEN_STATE_DERIVATIVE_MALL,OPEN_STATE_PHOTOGRAPH,OPEN_STATE_BATTLE_PASS,OPEN_STATE_SHOP_TYPE_GENESISCRYSTAL,OPEN_STATE_SHOP_TYPE_RECOMMANDED,
|
||||
OPEN_STATE_SHOP_TYPE_GIFTPACKAGE,OPEN_STATE_GUIDE_RELIC_PROM,OPEN_STATE_GUIDE_TALENT,OPEN_STATE_SHOP_TYPE_BLACKSMITH,OPEN_STATE_SHOP_TYPE_PAIMON,OPEN_STATE_WEAPON_AWAKEN,
|
||||
OPEN_STATE_WEAPON_PROMOTE,OPEN_STATE_AVATAR_PROMOTE,OPEN_STATE_AVATAR_TALENT,OPEN_STATE_WEAPON_UPGRADE,OPEN_STATE_RESIN,OPEN_STATE_RELIQUARY_UPGRADE,
|
||||
OPEN_STATE_SHOP_TYPE_VIRTUAL_SHOP,OPEN_STATE_RELIQUARY_PROMOTE);
|
||||
*/
|
||||
|
||||
// For development. Remove entry when properly implemented
|
||||
// TODO - Set as boolean in OpenState
|
||||
public static final Set<OpenState> DEV_OPEN_STATES = Stream.of(OpenState.values())
|
||||
.filter(s -> s != OpenState.OPEN_STATE_NONE && s.getUnlockLevel() <= 1)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
public PlayerOpenStateManager(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getOpenStateMap() {
|
||||
if (this.map == null) this.map = new HashMap<>();
|
||||
public synchronized Map<Integer, Integer> getOpenStateMap() {
|
||||
// If no map currently exists, we create one.
|
||||
if (this.map == null) {
|
||||
this.map = new HashMap<>();
|
||||
}
|
||||
|
||||
return this.map;
|
||||
}
|
||||
|
||||
public int getOpenState(OpenState openState) {
|
||||
return getOpenStateMap().getOrDefault(openState.getValue(), 0);
|
||||
/**********
|
||||
Direct getters and setters for open states.
|
||||
**********/
|
||||
public int getOpenState(int openState) {
|
||||
return getOpenStateMap().getOrDefault(openState, 0);
|
||||
}
|
||||
|
||||
public void setOpenState(OpenState openState, Integer value) {
|
||||
Integer previousValue = getOpenStateMap().getOrDefault(openState.getValue(),0);
|
||||
private void setOpenState(int openState, int value, boolean sendNotify) {
|
||||
int previousValue = this.getOpenStateMap().getOrDefault(openState, 0);
|
||||
|
||||
if (value != previousValue) {
|
||||
this.map.put(openState.getValue(), value);
|
||||
player.getSession().send(new PacketOpenStateChangeNotify(openState.getValue(),value));
|
||||
this.getOpenStateMap().put(openState, value);
|
||||
|
||||
if (sendNotify) {
|
||||
player.getSession().send(new PacketOpenStateChangeNotify(openState, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOpenStates(Map<OpenState,Integer> openStatesChanged) {
|
||||
for (Map.Entry<OpenState, Integer> entry : openStatesChanged.entrySet()) {
|
||||
setOpenState(entry.getKey(), entry.getValue());
|
||||
}
|
||||
private void setOpenState(int openState, int value) {
|
||||
this.setOpenState(openState, value, true);
|
||||
}
|
||||
|
||||
/**********
|
||||
Condition checking for setting open states.
|
||||
**********/
|
||||
private boolean areConditionsMet(OpenStateData openState) {
|
||||
// Check all conditions and test if at least one of them is violated.
|
||||
for (var condition : openState.getCond()) {
|
||||
// For level conditions, check if the player has reached the necessary level.
|
||||
if (condition.getCondType() == OpenStateCondType.OPEN_STATE_COND_PLAYER_LEVEL) {
|
||||
if (this.player.getLevel() < condition.getParam()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (condition.getCondType() == OpenStateCondType.OPEN_STATE_COND_QUEST) {
|
||||
// ToDo: Implement.
|
||||
}
|
||||
else if (condition.getCondType() == OpenStateCondType.OPEN_STATE_COND_PARENT_QUEST) {
|
||||
// ToDo: Implement.
|
||||
}
|
||||
else if (condition.getCondType() == OpenStateCondType.OPEN_STATE_OFFERING_LEVEL) {
|
||||
// ToDo: Implement.
|
||||
}
|
||||
else if (condition.getCondType() == OpenStateCondType.OPEN_STATE_CITY_REPUTATION_LEVEL) {
|
||||
// ToDo: Implement.
|
||||
}
|
||||
}
|
||||
|
||||
// Done. If we didn't find any violations, all conditions are met.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**********
|
||||
Setting open states from the client (via `SetOpenStateReq`).
|
||||
**********/
|
||||
public void setOpenStateFromClient(int openState, int value) {
|
||||
// Get the data for this open state.
|
||||
OpenStateData data = GameData.getOpenStateDataMap().get(openState);
|
||||
if (data == null) {
|
||||
this.player.sendPacket(new PacketSetOpenStateRsp(Retcode.RET_FAIL));
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure that this is an open state that the client is allowed to set,
|
||||
// and that it doesn't have any further conditions attached.
|
||||
if (!data.isAllowClientOpen() || !this.areConditionsMet(data)) {
|
||||
this.player.sendPacket(new PacketSetOpenStateRsp(Retcode.RET_FAIL));
|
||||
return;
|
||||
}
|
||||
|
||||
// Set.
|
||||
this.setOpenState(openState, value);
|
||||
this.player.sendPacket(new PacketSetOpenStateRsp(openState, value));
|
||||
}
|
||||
|
||||
/**********
|
||||
Handler for player login.
|
||||
**********/
|
||||
public void onPlayerLogin() {
|
||||
// Try unlocking open states on player login. This handles accounts where unlock conditions were
|
||||
// already met before certain open state unlocks were implemented.
|
||||
this.tryUnlockOpenStates(false);
|
||||
|
||||
// Send notify to the client.
|
||||
player.getSession().send(new PacketOpenStateUpdateNotify(this));
|
||||
}
|
||||
|
||||
public void unlockLevelDependentStates() {
|
||||
Stream.of(OpenState.values())
|
||||
.filter(s -> s.getUnlockLevel() > 1 && s.getUnlockLevel() <= this.player.getLevel())
|
||||
.forEach(s -> this.setOpenState(s, 1));
|
||||
/**********
|
||||
Triggered unlocking of open states (unlock states whose conditions have been met.)
|
||||
**********/
|
||||
public void tryUnlockOpenStates(boolean sendNotify) {
|
||||
// Get list of open states that are not yet unlocked.
|
||||
var lockedStates = GameData.getOpenStateList().stream().filter(s -> this.getOpenStateMap().getOrDefault(s, 0) == 0).toList();
|
||||
|
||||
// Try unlocking all of them.
|
||||
for (var state : lockedStates) {
|
||||
// To auto-unlock a state, it has to meet three conditions:
|
||||
// * it can not be a state that is unlocked by the client,
|
||||
// * it has to meet all its unlock conditions, and
|
||||
// * it can not be in the blacklist.
|
||||
if (!state.isAllowClientOpen() && this.areConditionsMet(state) && !BLACKLIST_OPEN_STATES.contains(state.getId())) {
|
||||
this.setOpenState(state.getId(), 1, sendNotify);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void tryUnlockOpenStates() {
|
||||
this.tryUnlockOpenStates(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
package emu.grasscutter.game.props;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public enum OpenState {
|
||||
OPEN_STATE_NONE (0),
|
||||
OPEN_STATE_PAIMON (1),
|
||||
OPEN_STATE_PAIMON_NAVIGATION (2),
|
||||
OPEN_STATE_AVATAR_PROMOTE (3),
|
||||
OPEN_STATE_AVATAR_TALENT (4),
|
||||
OPEN_STATE_WEAPON_PROMOTE (5),
|
||||
OPEN_STATE_WEAPON_AWAKEN (6),
|
||||
OPEN_STATE_QUEST_REMIND (7),
|
||||
OPEN_STATE_GAME_GUIDE (8),
|
||||
OPEN_STATE_COOK (9),
|
||||
OPEN_STATE_WEAPON_UPGRADE (10),
|
||||
OPEN_STATE_RELIQUARY_UPGRADE (11),
|
||||
OPEN_STATE_RELIQUARY_PROMOTE (12),
|
||||
OPEN_STATE_WEAPON_PROMOTE_GUIDE (13),
|
||||
OPEN_STATE_WEAPON_CHANGE_GUIDE (14),
|
||||
OPEN_STATE_PLAYER_LVUP_GUIDE (15),
|
||||
OPEN_STATE_FRESHMAN_GUIDE (16),
|
||||
OPEN_STATE_SKIP_FRESHMAN_GUIDE (17),
|
||||
OPEN_STATE_GUIDE_MOVE_CAMERA (18),
|
||||
OPEN_STATE_GUIDE_SCALE_CAMERA (19),
|
||||
OPEN_STATE_GUIDE_KEYBOARD (20),
|
||||
OPEN_STATE_GUIDE_MOVE (21),
|
||||
OPEN_STATE_GUIDE_JUMP (22),
|
||||
OPEN_STATE_GUIDE_SPRINT (23),
|
||||
OPEN_STATE_GUIDE_MAP (24),
|
||||
OPEN_STATE_GUIDE_ATTACK (25),
|
||||
OPEN_STATE_GUIDE_FLY (26),
|
||||
OPEN_STATE_GUIDE_TALENT (27),
|
||||
OPEN_STATE_GUIDE_RELIC (28),
|
||||
OPEN_STATE_GUIDE_RELIC_PROM (29),
|
||||
OPEN_STATE_COMBINE (30, 2),
|
||||
OPEN_STATE_GACHA (31),
|
||||
OPEN_STATE_GUIDE_GACHA (32),
|
||||
OPEN_STATE_GUIDE_TEAM (33),
|
||||
OPEN_STATE_GUIDE_PROUD (34),
|
||||
OPEN_STATE_GUIDE_AVATAR_PROMOTE (35),
|
||||
OPEN_STATE_GUIDE_ADVENTURE_CARD (36),
|
||||
OPEN_STATE_FORGE (37, 2),
|
||||
OPEN_STATE_GUIDE_BAG (38),
|
||||
OPEN_STATE_EXPEDITION (39, 14),
|
||||
OPEN_STATE_GUIDE_ADVENTURE_DAILYTASK (40),
|
||||
OPEN_STATE_GUIDE_ADVENTURE_DUNGEON (41),
|
||||
OPEN_STATE_TOWER (42),
|
||||
OPEN_STATE_WORLD_STAMINA (43),
|
||||
OPEN_STATE_TOWER_FIRST_ENTER (44),
|
||||
OPEN_STATE_RESIN (45),
|
||||
OPEN_STATE_LIMIT_REGION_FRESHMEAT (47),
|
||||
OPEN_STATE_LIMIT_REGION_GLOBAL (48),
|
||||
OPEN_STATE_MULTIPLAYER (49, 16),
|
||||
OPEN_STATE_GUIDE_MOUSEPC (50),
|
||||
OPEN_STATE_GUIDE_MULTIPLAYER (51),
|
||||
OPEN_STATE_GUIDE_DUNGEONREWARD (52),
|
||||
OPEN_STATE_GUIDE_BLOSSOM (53, 8),
|
||||
OPEN_STATE_AVATAR_FASHION (54),
|
||||
OPEN_STATE_PHOTOGRAPH (55),
|
||||
OPEN_STATE_GUIDE_KSLQUEST (56),
|
||||
OPEN_STATE_PERSONAL_LINE (57, 26),
|
||||
OPEN_STATE_GUIDE_PERSONAL_LINE (58),
|
||||
OPEN_STATE_GUIDE_APPEARANCE (59),
|
||||
OPEN_STATE_GUIDE_PROCESS (60),
|
||||
OPEN_STATE_GUIDE_PERSONAL_LINE_KEY (61),
|
||||
OPEN_STATE_GUIDE_WIDGET (62),
|
||||
OPEN_STATE_GUIDE_ACTIVITY_SKILL_ASTER (63),
|
||||
OPEN_STATE_GUIDE_COLDCLIMATE (64),
|
||||
OPEN_STATE_DERIVATIVE_MALL (65),
|
||||
OPEN_STATE_GUIDE_EXITMULTIPLAYER (66),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_BUILD (67),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_REBUILD (68),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_CARD (69),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_MONSTER (70),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_MISSION_CHECK (71),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_BUILD_SELECT (72),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_CHALLENGE_START (73),
|
||||
OPEN_STATE_GUIDE_CONVERT (74),
|
||||
OPEN_STATE_GUIDE_THEATREMACHANICUS_MULTIPLAYER (75),
|
||||
OPEN_STATE_GUIDE_COOP_TASK (76),
|
||||
OPEN_STATE_GUIDE_HOMEWORLD_ADEPTIABODE (77),
|
||||
OPEN_STATE_GUIDE_HOMEWORLD_DEPLOY (78),
|
||||
OPEN_STATE_GUIDE_CHANNELLERSLAB_EQUIP (79),
|
||||
OPEN_STATE_GUIDE_CHANNELLERSLAB_MP_SOLUTION (80),
|
||||
OPEN_STATE_GUIDE_CHANNELLERSLAB_POWER (81),
|
||||
OPEN_STATE_GUIDE_HIDEANDSEEK_SKILL (82),
|
||||
OPEN_STATE_GUIDE_HOMEWORLD_MAPLIST (83),
|
||||
OPEN_STATE_GUIDE_RELICRESOLVE (84),
|
||||
OPEN_STATE_GUIDE_GGUIDE (85),
|
||||
OPEN_STATE_GUIDE_GGUIDE_HINT (86),
|
||||
OPEN_STATE_GUIDE_CHANNELLERSLAB_EQUIP_V2 (87),
|
||||
OPEN_STATE_GUIDE_CHANNELLERSLAB_MP_SOLUTION_V2 (88),
|
||||
OPEN_STATE_GUIDE_CHANNELLERSLAB_POWER_V2 (89),
|
||||
OPEN_STATE_GUIDE_QUICK_TEAMMEMBERCHANGE (90), // Mobile only
|
||||
OPEN_STATE_GGUIDE_FIRSTSHOW (91),
|
||||
OPEN_STATE_GGUIDE_MAINPAGE_ENTRY_DISAPPEAR (92),
|
||||
OPEN_STATE_CITY_REPUATION_MENGDE (800),
|
||||
OPEN_STATE_CITY_REPUATION_LIYUE (801),
|
||||
OPEN_STATE_CITY_REPUATION_UI_HINT (802, 25),
|
||||
OPEN_STATE_CITY_REPUATION_INAZUMA (803),
|
||||
OPEN_STATE_SHOP_TYPE_MALL (900),
|
||||
OPEN_STATE_SHOP_TYPE_RECOMMANDED (901, 1),
|
||||
OPEN_STATE_SHOP_TYPE_GENESISCRYSTAL (902, 1),
|
||||
OPEN_STATE_SHOP_TYPE_GIFTPACKAGE (903, 1),
|
||||
OPEN_STATE_SHOP_TYPE_PAIMON (1001),
|
||||
OPEN_STATE_SHOP_TYPE_CITY (1002),
|
||||
OPEN_STATE_SHOP_TYPE_BLACKSMITH (1003),
|
||||
OPEN_STATE_SHOP_TYPE_GROCERY (1004, 5),
|
||||
OPEN_STATE_SHOP_TYPE_FOOD (1005, 5),
|
||||
OPEN_STATE_SHOP_TYPE_SEA_LAMP (1006, 13),
|
||||
OPEN_STATE_SHOP_TYPE_VIRTUAL_SHOP (1007),
|
||||
OPEN_STATE_SHOP_TYPE_LIYUE_GROCERY (1008, 5),
|
||||
OPEN_STATE_SHOP_TYPE_LIYUE_SOUVENIR (1009),
|
||||
OPEN_STATE_SHOP_TYPE_LIYUE_RESTAURANT (1010, 5),
|
||||
OPEN_STATE_SHOP_TYPE_INAZUMA_SOUVENIR (1011),
|
||||
OPEN_STATE_SHOP_TYPE_NPC_TOMOKI (1012),
|
||||
OPEN_STATE_SHOP_TYPE_INAZUMA_SOUVENIR_BLACK_BAR (1013),
|
||||
OPEN_ADVENTURE_MANUAL (1100),
|
||||
OPEN_ADVENTURE_MANUAL_CITY_MENGDE (1101),
|
||||
OPEN_ADVENTURE_MANUAL_CITY_LIYUE (1102),
|
||||
OPEN_ADVENTURE_MANUAL_MONSTER (1103, 8),
|
||||
OPEN_ADVENTURE_MANUAL_BOSS_DUNGEON (1104),
|
||||
OPEN_STATE_ACTIVITY_SEALAMP (1200),
|
||||
OPEN_STATE_ACTIVITY_SEALAMP_TAB2 (1201),
|
||||
OPEN_STATE_ACTIVITY_SEALAMP_TAB3 (1202),
|
||||
OPEN_STATE_BATTLE_PASS (1300, 1),
|
||||
OPEN_STATE_BATTLE_PASS_ENTRY (1301, 20),
|
||||
OPEN_STATE_ACTIVITY_CRUCIBLE (1400),
|
||||
OPEN_STATE_ACTIVITY_NEWBEEBOUNS_OPEN (1401),
|
||||
OPEN_STATE_ACTIVITY_NEWBEEBOUNS_CLOSE (1402),
|
||||
OPEN_STATE_ACTIVITY_ENTRY_OPEN (1403),
|
||||
OPEN_STATE_MENGDE_INFUSEDCRYSTAL (1404),
|
||||
OPEN_STATE_LIYUE_INFUSEDCRYSTAL (1405),
|
||||
OPEN_STATE_SNOW_MOUNTAIN_ELDER_TREE (1406),
|
||||
OPEN_STATE_MIRACLE_RING (1407),
|
||||
OPEN_STATE_COOP_LINE (1408, 26),
|
||||
OPEN_STATE_INAZUMA_INFUSEDCRYSTAL (1409),
|
||||
OPEN_STATE_FISH (1410),
|
||||
OPEN_STATE_GUIDE_SUMO_TEAM_SKILL (1411),
|
||||
OPEN_STATE_GUIDE_FISH_RECIPE (1412),
|
||||
OPEN_STATE_HOME (1500),
|
||||
OPEN_STATE_ACTIVITY_HOMEWORLD (1501, 28),
|
||||
OPEN_STATE_ADEPTIABODE (1502),
|
||||
OPEN_STATE_HOME_AVATAR (1503),
|
||||
OPEN_STATE_HOME_EDIT (1504),
|
||||
OPEN_STATE_HOME_EDIT_TIPS (1505),
|
||||
OPEN_STATE_RELIQUARY_DECOMPOSE (1600, 45),
|
||||
OPEN_STATE_ACTIVITY_H5 (1700, 10),
|
||||
OPEN_STATE_ORAIONOKAMI (2000),
|
||||
OPEN_STATE_GUIDE_CHESS_MISSION_CHECK (2001),
|
||||
OPEN_STATE_GUIDE_CHESS_BUILD (2002),
|
||||
OPEN_STATE_GUIDE_CHESS_WIND_TOWER_CIRCLE (2003),
|
||||
OPEN_STATE_GUIDE_CHESS_CARD_SELECT (2004),
|
||||
OPEN_STATE_INAZUMA_MAINQUEST_FINISHED (2005),
|
||||
OPEN_STATE_PAIMON_LVINFO (2100, 7),
|
||||
OPEN_STATE_TELEPORT_HUD (2101, 2),
|
||||
OPEN_STATE_GUIDE_MAP_UNLOCK (2102),
|
||||
OPEN_STATE_GUIDE_PAIMON_LVINFO (2103),
|
||||
OPEN_STATE_GUIDE_AMBORTRANSPORT (2104),
|
||||
OPEN_STATE_GUIDE_FLY_SECOND (2105),
|
||||
OPEN_STATE_GUIDE_KAEYA_CLUE (2106),
|
||||
OPEN_STATE_CAPTURE_CODEX (2107),
|
||||
OPEN_STATE_ACTIVITY_FISH_OPEN (2200),
|
||||
OPEN_STATE_ACTIVITY_FISH_CLOSE (2201),
|
||||
OPEN_STATE_GUIDE_ROGUE_MAP (2205),
|
||||
OPEN_STATE_GUIDE_ROGUE_RUNE (2206),
|
||||
OPEN_STATE_GUIDE_BARTENDER_FORMULA (2210),
|
||||
OPEN_STATE_GUIDE_BARTENDER_MIX (2211),
|
||||
OPEN_STATE_GUIDE_BARTENDER_CUP (2212),
|
||||
OPEN_STATE_GUIDE_MAIL_FAVORITES (2400),
|
||||
OPEN_STATE_GUIDE_POTION_CONFIGURE (2401),
|
||||
OPEN_STATE_GUIDE_LANV2_FIREWORK (2402),
|
||||
OPEN_STATE_LOADINGTIPS_ENKANOMIYA (2403),
|
||||
OPEN_STATE_MICHIAE_CASKET (2500, 30),
|
||||
OPEN_STATE_MAIL_COLLECT_UNLOCK_RED_POINT (2501),
|
||||
OPEN_STATE_LUMEN_STONE (2600),
|
||||
OPEN_STATE_GUIDE_CRYSTALLINK_BUFF (2601),
|
||||
OPEN_STATE_GUIDE_MUSIC_GAME_V3 (2700),
|
||||
OPEN_STATE_GUIDE_MUSIC_GAME_V3_REAL_TIME_EDIT (2701),
|
||||
OPEN_STATE_GUIDE_MUSIC_GAME_V3_TIMELINE_EDIT (2702),
|
||||
OPEN_STATE_GUIDE_MUSIC_GAME_V3_SETTING (2703),
|
||||
OPEN_STATE_GUIDE_ROBOTGACHA (2704),
|
||||
OPEN_STATE_GUIDE_FRAGILE_RESIN (2800),
|
||||
OPEN_ADVENTURE_MANUAL_EDUCATION (2801);
|
||||
|
||||
private final int value;
|
||||
private final int unlockLevel;
|
||||
private static final Int2ObjectMap<OpenState> map = new Int2ObjectOpenHashMap<>();
|
||||
private static final Map<String, OpenState> stringMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
Stream.of(values()).forEach(e -> {
|
||||
map.put(e.getValue(), e);
|
||||
stringMap.put(e.name(), e);
|
||||
});
|
||||
}
|
||||
|
||||
private OpenState(int value) {
|
||||
this.value = value;
|
||||
this.unlockLevel = -1;
|
||||
}
|
||||
private OpenState(int value, int unlockLevel) {
|
||||
this.value = value;
|
||||
this.unlockLevel = unlockLevel;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getUnlockLevel() {
|
||||
return this.unlockLevel;
|
||||
}
|
||||
|
||||
public static OpenState getTypeByValue(int value) {
|
||||
return map.getOrDefault(value, OPEN_STATE_NONE);
|
||||
}
|
||||
|
||||
public static OpenState getTypeByName(String name) {
|
||||
return stringMap.getOrDefault(name, OPEN_STATE_NONE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user