emu.grasscutter.server.packet.recv.HandlerEnterTrialAvatarActivityDungeonReq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grasscutter Show documentation
Show all versions of grasscutter Show documentation
A server software reimplementation for an anime game.
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.activity.trialavatar.TrialAvatarActivityHandler;
import emu.grasscutter.game.props.ActivityType;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.EnterTrialAvatarActivityDungeonReqOuterClass.EnterTrialAvatarActivityDungeonReq;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketEnterTrialAvatarActivityDungeonRsp;
import lombok.val;
@Opcodes(PacketOpcodes.EnterTrialAvatarActivityDungeonReq)
public class HandlerEnterTrialAvatarActivityDungeonReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
val req = EnterTrialAvatarActivityDungeonReq.parseFrom(payload);
val handler =
session
.getPlayer()
.getActivityManager()
.getActivityHandlerAs(
ActivityType.NEW_ACTIVITY_TRIAL_AVATAR, TrialAvatarActivityHandler.class);
boolean result =
handler.isPresent()
&& handler
.get()
.enterTrialDungeon(
session.getPlayer(), req.getTrialAvatarIndexId(), req.getEnterPointId());
session
.getPlayer()
.sendPacket(
new PacketEnterTrialAvatarActivityDungeonRsp(
req.getActivityId(), req.getTrialAvatarIndexId(), result));
}
}