Commit a2ff8c84 authored by KingRainbow44's avatar KingRainbow44
Browse files

Merge `development` into `plugin-auth`

parents 3adf0d44 a751e71d
package emu.grasscutter.game.quest.handlers;
import emu.grasscutter.data.def.QuestData.QuestCondition;
import emu.grasscutter.game.quest.GameQuest;
public abstract class QuestBaseHandler {
public abstract boolean execute(GameQuest quest, QuestCondition condition, int... params);
}
...@@ -39,7 +39,8 @@ public class TowerScheduleManager { ...@@ -39,7 +39,8 @@ public class TowerScheduleManager {
public TowerScheduleData getCurrentTowerScheduleData(){ public TowerScheduleData getCurrentTowerScheduleData(){
var data = GameData.getTowerScheduleDataMap().get(towerScheduleConfig.getScheduleId()); var data = GameData.getTowerScheduleDataMap().get(towerScheduleConfig.getScheduleId());
if(data == null){ if(data == null){
Grasscutter.getLogger().error("Could not get current tower schedule data by config:{}", towerScheduleConfig); Grasscutter.getLogger().error("Could not get current tower schedule data by schedule id {}, please check your resource files",
towerScheduleConfig.getScheduleId());
} }
return data; return data;
......
...@@ -10,6 +10,7 @@ import emu.grasscutter.game.player.Player; ...@@ -10,6 +10,7 @@ import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.game.player.Player.SceneLoadState;
import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.props.EntityIdType; import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.DungeonData; import emu.grasscutter.data.def.DungeonData;
import emu.grasscutter.data.def.SceneData; import emu.grasscutter.data.def.SceneData;
...@@ -267,6 +268,9 @@ public class World implements Iterable<Player> { ...@@ -267,6 +268,9 @@ public class World implements Iterable<Player> {
enterReason = EnterReason.DungeonEnter; enterReason = EnterReason.DungeonEnter;
} else if (oldScene == newScene) { } else if (oldScene == newScene) {
enterType = EnterType.ENTER_GOTO; enterType = EnterType.ENTER_GOTO;
} else if (newScene.getSceneType() == SceneType.SCENE_HOME_WORLD) {
// Home
enterType = EnterType.ENTER_SELF_HOME;
} }
// Teleport packet // Teleport packet
......
...@@ -14,6 +14,8 @@ import emu.grasscutter.game.managers.ChatManager; ...@@ -14,6 +14,8 @@ import emu.grasscutter.game.managers.ChatManager;
import emu.grasscutter.game.managers.InventoryManager; import emu.grasscutter.game.managers.InventoryManager;
import emu.grasscutter.game.managers.MultiplayerManager; import emu.grasscutter.game.managers.MultiplayerManager;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.quest.ServerQuestHandler;
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
import emu.grasscutter.game.shop.ShopManager; import emu.grasscutter.game.shop.ShopManager;
import emu.grasscutter.game.tower.TowerScheduleManager; import emu.grasscutter.game.tower.TowerScheduleManager;
import emu.grasscutter.game.world.World; import emu.grasscutter.game.world.World;
...@@ -37,7 +39,8 @@ import static emu.grasscutter.Configuration.*; ...@@ -37,7 +39,8 @@ import static emu.grasscutter.Configuration.*;
public final class GameServer extends KcpServer { public final class GameServer extends KcpServer {
private final InetSocketAddress address; private final InetSocketAddress address;
private final GameServerPacketHandler packetHandler; private final GameServerPacketHandler packetHandler;
private final ServerQuestHandler questHandler;
private final Map<Integer, Player> players; private final Map<Integer, Player> players;
private final Set<World> worlds; private final Set<World> worlds;
...@@ -68,6 +71,7 @@ public final class GameServer extends KcpServer { ...@@ -68,6 +71,7 @@ public final class GameServer extends KcpServer {
this.setServerInitializer(new GameServerInitializer(this)); this.setServerInitializer(new GameServerInitializer(this));
this.address = address; this.address = address;
this.packetHandler = new GameServerPacketHandler(PacketHandler.class); this.packetHandler = new GameServerPacketHandler(PacketHandler.class);
this.questHandler = new ServerQuestHandler();
this.players = new ConcurrentHashMap<>(); this.players = new ConcurrentHashMap<>();
this.worlds = Collections.synchronizedSet(new HashSet<>()); this.worlds = Collections.synchronizedSet(new HashSet<>());
...@@ -91,6 +95,10 @@ public final class GameServer extends KcpServer { ...@@ -91,6 +95,10 @@ public final class GameServer extends KcpServer {
return packetHandler; return packetHandler;
} }
public ServerQuestHandler getQuestHandler() {
return questHandler;
}
public Map<Integer, Player> getPlayers() { public Map<Integer, Player> getPlayers() {
return players; return players;
} }
......
...@@ -252,6 +252,7 @@ public class GameSession extends KcpChannel { ...@@ -252,6 +252,7 @@ public class GameSession extends KcpChannel {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
data.release();
packet.release(); packet.release();
} }
} }
......
...@@ -11,12 +11,6 @@ import emu.grasscutter.server.game.GameSession; ...@@ -11,12 +11,6 @@ import emu.grasscutter.server.game.GameSession;
public class HandlerEnterTransPointRegionNotify extends PacketHandler { public class HandlerEnterTransPointRegionNotify extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception{ public void handle(GameSession session, byte[] header, byte[] payload) throws Exception{
Player player = session.getPlayer(); session.getPlayer().getSotSManager().handleEnterTransPointRegionNotify();
SotSManager sotsManager = player.getSotSManager();
sotsManager.refillSpringVolume();
sotsManager.autoRevive(session);
sotsManager.scheduleAutoRecover(session);
// TODO: allow interaction with the SotS?
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment