Format code [skip actions]

This commit is contained in:
github-actions 2023-10-17 05:42:17 +00:00
parent b7a9d28f02
commit bc8e7c21ce
7 changed files with 38 additions and 44 deletions

View File

@ -1,7 +1,7 @@
package emu.grasscutter.data.excels.dungeon; package emu.grasscutter.data.excels.dungeon;
import emu.grasscutter.game.dungeons.enums.*;
import emu.grasscutter.data.*; import emu.grasscutter.data.*;
import emu.grasscutter.game.dungeons.enums.*;
import java.util.List; import java.util.List;
import lombok.*; import lombok.*;
@ -39,7 +39,8 @@ public class DungeonEntryData extends GameResource {
public int getLevelCondition() { public int getLevelCondition() {
for (var cond : satisfiedCond) { for (var cond : satisfiedCond) {
if (cond.type != null && cond.type.equals(DungeonEntrySatisfiedConditionType.DUNGEON_ENTRY_CONDITION_LEVEL)) { if (cond.type != null
&& cond.type.equals(DungeonEntrySatisfiedConditionType.DUNGEON_ENTRY_CONDITION_LEVEL)) {
return cond.param1; return cond.param1;
} }
} }
@ -48,7 +49,8 @@ public class DungeonEntryData extends GameResource {
public int getQuestCondition() { public int getQuestCondition() {
for (var cond : satisfiedCond) { for (var cond : satisfiedCond) {
if (cond.type != null && cond.type.equals(DungeonEntrySatisfiedConditionType.DUNGEON_ENTRY_CONDITION_QUEST)) { if (cond.type != null
&& cond.type.equals(DungeonEntrySatisfiedConditionType.DUNGEON_ENTRY_CONDITION_QUEST)) {
return cond.param1; return cond.param1;
} }
} }

View File

@ -7,14 +7,10 @@ import emu.grasscutter.data.excels.dungeon.*;
import emu.grasscutter.game.dungeons.handlers.DungeonBaseHandler; import emu.grasscutter.game.dungeons.handlers.DungeonBaseHandler;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.SceneType; import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.world.*; import emu.grasscutter.game.world.*;
import emu.grasscutter.net.packet.*; import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.game.*; import emu.grasscutter.server.game.*;
import emu.grasscutter.server.packet.send.PacketDungeonEntryInfoRsp; import emu.grasscutter.server.packet.send.PacketDungeonEntryInfoRsp;
import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.ints.*;
import java.util.List; import java.util.List;
import lombok.val; import lombok.val;

View File

@ -1,8 +1,6 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.*; import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.DungeonRestartReqOuterClass.DungeonRestartReq;
import emu.grasscutter.net.proto.DungeonRestartRspOuterClass.DungeonRestartRsp;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
@Opcodes(PacketOpcodes.DungeonRestartReq) @Opcodes(PacketOpcodes.DungeonRestartReq)

View File

@ -1,11 +1,9 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.net.packet.*; import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketGetDungeonEntryExploreConditionRsp;
import emu.grasscutter.server.packet.send.PacketDungeonEntryToBeExploreNotify;
import emu.grasscutter.net.proto.GetDungeonEntryExploreConditionReqOuterClass.GetDungeonEntryExploreConditionReq; import emu.grasscutter.net.proto.GetDungeonEntryExploreConditionReqOuterClass.GetDungeonEntryExploreConditionReq;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketDungeonEntryToBeExploreNotify;
@Opcodes(PacketOpcodes.GetDungeonEntryExploreConditionReq) @Opcodes(PacketOpcodes.GetDungeonEntryExploreConditionReq)
public class HandlerGetDungeonEntryExploreConditionReq extends PacketHandler { public class HandlerGetDungeonEntryExploreConditionReq extends PacketHandler {
@ -16,12 +14,11 @@ public class HandlerGetDungeonEntryExploreConditionReq extends PacketHandler {
// TODO Send GetDungeonEntryExploreConditionRsp if condition // TODO Send GetDungeonEntryExploreConditionRsp if condition
// (adventurer rank or quest completion) is not met. Parse // (adventurer rank or quest completion) is not met. Parse
// dungeon entry conditions from DungeonEntryExcelConfigData.json. // dungeon entry conditions from DungeonEntryExcelConfigData.json.
//session.send(new PacketGetDungeonEntryExploreConditionRsp(req.getDungeonEntryConfigId())); // session.send(new PacketGetDungeonEntryExploreConditionRsp(req.getDungeonEntryConfigId()));
// For now, just unlock any domain the player touches. // For now, just unlock any domain the player touches.
session.send(new PacketDungeonEntryToBeExploreNotify( session.send(
req.getDungeonEntryScenePointId(), new PacketDungeonEntryToBeExploreNotify(
req.getSceneId(), req.getDungeonEntryScenePointId(), req.getSceneId(), req.getDungeonEntryConfigId()));
req.getDungeonEntryConfigId()));
} }
} }

View File

@ -6,15 +6,16 @@ import emu.grasscutter.net.proto.DungeonEntryToBeExploreNotifyOuterClass.Dungeon
public class PacketDungeonEntryToBeExploreNotify extends BasePacket { public class PacketDungeonEntryToBeExploreNotify extends BasePacket {
/** /**
* Marks the dungeon as pending exploration. * Marks the dungeon as pending exploration. This creates the "Unknown" text bubble above the
* This creates the "Unknown" text bubble above the dungeon entry in the world map. * dungeon entry in the world map.
*/ */
public PacketDungeonEntryToBeExploreNotify(int dungeonEntryScenePointId, int sceneId, int dungeonEntryConfigId) { public PacketDungeonEntryToBeExploreNotify(
int dungeonEntryScenePointId, int sceneId, int dungeonEntryConfigId) {
super(PacketOpcodes.DungeonEntryToBeExploreNotify); super(PacketOpcodes.DungeonEntryToBeExploreNotify);
this.setData(DungeonEntryToBeExploreNotify.newBuilder() this.setData(
.setDungeonEntryScenePointId(dungeonEntryScenePointId) DungeonEntryToBeExploreNotify.newBuilder()
.setSceneId(sceneId) .setDungeonEntryScenePointId(dungeonEntryScenePointId)
.setDungeonEntryConfigId(dungeonEntryConfigId) .setSceneId(sceneId)
); .setDungeonEntryConfigId(dungeonEntryConfigId));
} }
} }

View File

@ -2,29 +2,32 @@ package emu.grasscutter.server.packet.send;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.net.packet.*; import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.GetDungeonEntryExploreConditionRspOuterClass.GetDungeonEntryExploreConditionRsp;
import emu.grasscutter.net.proto.DungeonEntryCondOuterClass.DungeonEntryCond;
import emu.grasscutter.net.proto.DungeonEntryBlockReasonOuterClass.DungeonEntryBlockReason; import emu.grasscutter.net.proto.DungeonEntryBlockReasonOuterClass.DungeonEntryBlockReason;
import emu.grasscutter.net.proto.DungeonEntryCondOuterClass.DungeonEntryCond;
import emu.grasscutter.net.proto.GetDungeonEntryExploreConditionRspOuterClass.GetDungeonEntryExploreConditionRsp;
public class PacketGetDungeonEntryExploreConditionRsp extends BasePacket { public class PacketGetDungeonEntryExploreConditionRsp extends BasePacket {
public PacketGetDungeonEntryExploreConditionRsp(int dungeonId) { public PacketGetDungeonEntryExploreConditionRsp(int dungeonId) {
super(PacketOpcodes.GetDungeonEntryExploreConditionRsp); super(PacketOpcodes.GetDungeonEntryExploreConditionRsp);
var data = GameData.getDungeonEntryDataMap().values().stream() var data =
.filter(d -> d.getId() == dungeonId) GameData.getDungeonEntryDataMap().values().stream()
.toList().get(0); .filter(d -> d.getId() == dungeonId)
.toList()
.get(0);
var level = data.getLevelCondition(); var level = data.getLevelCondition();
var quest = data.getQuestCondition(); var quest = data.getQuestCondition();
var proto = GetDungeonEntryExploreConditionRsp.newBuilder() var proto =
.setRetcode(0) GetDungeonEntryExploreConditionRsp.newBuilder()
.setDungeonEntryCond(DungeonEntryCond.newBuilder() .setRetcode(0)
// There is also a DUNGEON_ENTRY_REASON_MULIPLE but only one param1 .setDungeonEntryCond(
// field to put values in. Only report the required level for now, then. DungeonEntryCond.newBuilder()
.setCondReason(DungeonEntryBlockReason.DUNGEON_ENTRY_REASON_LEVEL) // There is also a DUNGEON_ENTRY_REASON_MULIPLE but only one param1
.setParam1(level) // field to put values in. Only report the required level for now, then.
) .setCondReason(DungeonEntryBlockReason.DUNGEON_ENTRY_REASON_LEVEL)
.build(); .setParam1(level))
.build();
this.setData(proto); this.setData(proto);
} }

View File

@ -6,9 +6,6 @@ import emu.grasscutter.net.proto.UnfreezeGroupLimitNotifyOuterClass.UnfreezeGrou
public class PacketUnfreezeGroupLimitNotify extends BasePacket { public class PacketUnfreezeGroupLimitNotify extends BasePacket {
public PacketUnfreezeGroupLimitNotify(int pointId, int sceneId) { public PacketUnfreezeGroupLimitNotify(int pointId, int sceneId) {
super(PacketOpcodes.UnfreezeGroupLimitNotify); super(PacketOpcodes.UnfreezeGroupLimitNotify);
this.setData(UnfreezeGroupLimitNotify.newBuilder() this.setData(UnfreezeGroupLimitNotify.newBuilder().setPointId(pointId).setSceneId(sceneId));
.setPointId(pointId)
.setSceneId(sceneId)
);
} }
} }