mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 07:37:43 +00:00
Format code [skip actions]
This commit is contained in:
parent
fc42f665a7
commit
cdcdf924bd
@ -12,14 +12,27 @@ import lombok.experimental.FieldDefaults;
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
@Getter
|
||||
public class HomeWorldEventData extends GameResource {
|
||||
@SerializedName(value = "id", alternate = {"BBEIIPEFDPE"})
|
||||
@SerializedName(
|
||||
value = "id",
|
||||
alternate = {"BBEIIPEFDPE"})
|
||||
int id;
|
||||
@SerializedName(value = "eventType", alternate = {"JOCKIMECHDP"})
|
||||
|
||||
@SerializedName(
|
||||
value = "eventType",
|
||||
alternate = {"JOCKIMECHDP"})
|
||||
SuiteEventType eventType;
|
||||
|
||||
int avatarID;
|
||||
@SerializedName(value = "talkId", alternate = {"IGNJAICDFPD"})
|
||||
|
||||
@SerializedName(
|
||||
value = "talkId",
|
||||
alternate = {"IGNJAICDFPD"})
|
||||
int talkId;
|
||||
|
||||
int rewardID;
|
||||
@SerializedName(value = "suiteId", alternate = {"FEHOKMJPOED"})
|
||||
|
||||
@SerializedName(
|
||||
value = "suiteId",
|
||||
alternate = {"FEHOKMJPOED"})
|
||||
int suiteId;
|
||||
}
|
||||
|
@ -8,9 +8,8 @@ import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.net.proto.VisionTypeOuterClass;
|
||||
import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketSceneEntityDisappearNotify;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import lombok.Getter;
|
||||
|
||||
public class EntityHomeAnimal extends EntityMonster implements Rebornable {
|
||||
private int rebornCDTickCount;
|
||||
|
@ -12,17 +12,16 @@ import emu.grasscutter.game.props.SceneType;
|
||||
import emu.grasscutter.net.proto.HomeAvatarTalkFinishInfoOuterClass;
|
||||
import emu.grasscutter.server.packet.send.*;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
@Entity(value = "homes", useDiscriminator = false)
|
||||
@Data
|
||||
|
@ -67,7 +67,8 @@ public class HomeBlockItem {
|
||||
.map(homeNpcData -> HomeNPCItem.parseFrom(homeNpcData, owner))
|
||||
.toList();
|
||||
|
||||
this.suiteList = homeBlockArrangementInfo.getFurnitureSuiteListList().stream()
|
||||
this.suiteList =
|
||||
homeBlockArrangementInfo.getFurnitureSuiteListList().stream()
|
||||
.map(HomeSuiteItem::parseFrom)
|
||||
.toList();
|
||||
}
|
||||
@ -98,7 +99,11 @@ public class HomeBlockItem {
|
||||
public List<? extends HomeMarkPointProtoFactory> getMarkPointProtoFactories() {
|
||||
this.reassignIfNull();
|
||||
|
||||
return Stream.of(this.deployFurnitureList, this.persistentFurnitureList, this.deployNPCList, this.suiteList)
|
||||
return Stream.of(
|
||||
this.deployFurnitureList,
|
||||
this.persistentFurnitureList,
|
||||
this.deployNPCList,
|
||||
this.suiteList)
|
||||
.flatMap(Collection::stream)
|
||||
.toList();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package emu.grasscutter.game.home;
|
||||
|
||||
import com.github.davidmoten.guavamini.Lists;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.home.suite.event.HomeAvatarRewardEvent;
|
||||
import emu.grasscutter.game.home.suite.event.HomeAvatarSummonEvent;
|
||||
import emu.grasscutter.game.home.suite.event.SuiteEventType;
|
||||
@ -12,13 +11,12 @@ import emu.grasscutter.net.proto.HomeAvatarSummonAllEventNotifyOuterClass;
|
||||
import emu.grasscutter.net.proto.RetcodeOuterClass;
|
||||
import emu.grasscutter.server.packet.send.PacketHomeAvatarSummonAllEventNotify;
|
||||
import emu.grasscutter.utils.Either;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public class HomeModuleManager {
|
||||
@ -59,13 +57,15 @@ public class HomeModuleManager {
|
||||
|
||||
private void fireAllAvatarRewardEvent() {
|
||||
this.rewardEvents.clear();
|
||||
var allBlockItems = Stream.of(this.getOutdoorSceneItem(), this.getIndoorSceneItem())
|
||||
var allBlockItems =
|
||||
Stream.of(this.getOutdoorSceneItem(), this.getIndoorSceneItem())
|
||||
.map(HomeSceneItem::getBlockItems)
|
||||
.map(Map::values)
|
||||
.flatMap(Collection::stream)
|
||||
.toList();
|
||||
|
||||
var suites = allBlockItems.stream()
|
||||
var suites =
|
||||
allBlockItems.stream()
|
||||
.map(HomeBlockItem::getSuiteList)
|
||||
.flatMap(Collection::stream)
|
||||
.distinct()
|
||||
@ -74,14 +74,25 @@ public class HomeModuleManager {
|
||||
allBlockItems.stream()
|
||||
.map(HomeBlockItem::getDeployNPCList)
|
||||
.flatMap(Collection::stream)
|
||||
.forEach(avatar -> {
|
||||
suites.forEach(suite -> {
|
||||
var data = SuiteEventType.HOME_AVATAR_REWARD_EVENT.getEventDataFrom(avatar.getAvatarId(), suite.getSuiteId());
|
||||
.forEach(
|
||||
avatar -> {
|
||||
suites.forEach(
|
||||
suite -> {
|
||||
var data =
|
||||
SuiteEventType.HOME_AVATAR_REWARD_EVENT.getEventDataFrom(
|
||||
avatar.getAvatarId(), suite.getSuiteId());
|
||||
if (data == null || this.home.isRewardEventFinished(data.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.rewardEvents.add(new HomeAvatarRewardEvent(homeOwner, data.getId(), data.getRewardID(), data.getAvatarID(), data.getSuiteId(), suite.getGuid()));
|
||||
this.rewardEvents.add(
|
||||
new HomeAvatarRewardEvent(
|
||||
homeOwner,
|
||||
data.getId(),
|
||||
data.getRewardID(),
|
||||
data.getAvatarID(),
|
||||
data.getSuiteId(),
|
||||
suite.getGuid()));
|
||||
});
|
||||
});
|
||||
|
||||
@ -92,7 +103,8 @@ public class HomeModuleManager {
|
||||
}
|
||||
|
||||
private void cancelSummonEventIfAvatarLeave() {
|
||||
var avatars = Stream.of(this.getOutdoorSceneItem(), this.getIndoorSceneItem())
|
||||
var avatars =
|
||||
Stream.of(this.getOutdoorSceneItem(), this.getIndoorSceneItem())
|
||||
.map(HomeSceneItem::getBlockItems)
|
||||
.map(Map::values)
|
||||
.flatMap(Collection::stream)
|
||||
@ -121,8 +133,11 @@ public class HomeModuleManager {
|
||||
return Either.left(event.giveRewards());
|
||||
}
|
||||
|
||||
public Either<HomeAvatarSummonEvent, Integer> fireAvatarSummonEvent(Player owner, int avatarId, int guid, int suiteId) {
|
||||
var targetSuite = ((HomeScene) owner.getScene()).getSceneItem().getBlockItems().values().stream()
|
||||
public Either<HomeAvatarSummonEvent, Integer> fireAvatarSummonEvent(
|
||||
Player owner, int avatarId, int guid, int suiteId) {
|
||||
var targetSuite =
|
||||
((HomeScene) owner.getScene())
|
||||
.getSceneItem().getBlockItems().values().stream()
|
||||
.map(HomeBlockItem::getSuiteList)
|
||||
.flatMap(Collection::stream)
|
||||
.filter(suite -> suite.getGuid() == guid)
|
||||
@ -148,7 +163,9 @@ public class HomeModuleManager {
|
||||
return Either.right(RetcodeOuterClass.Retcode.RET_HOME_CLIENT_PARAM_INVALID_VALUE);
|
||||
}
|
||||
|
||||
var event = new HomeAvatarSummonEvent(owner, eventData.getId(), eventData.getRewardID(), avatarId, suiteId, guid);
|
||||
var event =
|
||||
new HomeAvatarSummonEvent(
|
||||
owner, eventData.getId(), eventData.getRewardID(), avatarId, suiteId, guid);
|
||||
this.summonEvents.add(event);
|
||||
owner.sendPacket(new PacketHomeAvatarSummonAllEventNotify(owner));
|
||||
return Either.left(event);
|
||||
@ -163,7 +180,8 @@ public class HomeModuleManager {
|
||||
if (!this.rewardEvents.isEmpty()) {
|
||||
notify.setRewardEvent(this.rewardEvents.get(0).toProto()).setIsEventTrigger(true);
|
||||
|
||||
notify.addAllPendingList(this.rewardEvents.subList(1, this.rewardEvents.size()).stream()
|
||||
notify.addAllPendingList(
|
||||
this.rewardEvents.subList(1, this.rewardEvents.size()).stream()
|
||||
.map(HomeAvatarRewardEvent::toProto)
|
||||
.toList());
|
||||
}
|
||||
@ -171,11 +189,11 @@ public class HomeModuleManager {
|
||||
return notify.build();
|
||||
}
|
||||
|
||||
public HomeAvatarSummonAllEventNotifyOuterClass.HomeAvatarSummonAllEventNotify toSummonEventProto() {
|
||||
public HomeAvatarSummonAllEventNotifyOuterClass.HomeAvatarSummonAllEventNotify
|
||||
toSummonEventProto() {
|
||||
return HomeAvatarSummonAllEventNotifyOuterClass.HomeAvatarSummonAllEventNotify.newBuilder()
|
||||
.addAllSummonEventList(this.summonEvents.stream()
|
||||
.map(HomeAvatarSummonEvent::toProto)
|
||||
.toList())
|
||||
.addAllSummonEventList(
|
||||
this.summonEvents.stream().map(HomeAvatarSummonEvent::toProto).toList())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -10,16 +10,15 @@ import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.world.Position;
|
||||
import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
|
@ -11,10 +11,9 @@ import emu.grasscutter.server.game.GameServer;
|
||||
import emu.grasscutter.server.packet.send.PacketDelTeamEntityNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketPlayerChatNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketPlayerGameTimeNotify;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import lombok.Getter;
|
||||
|
||||
public class HomeWorld extends World {
|
||||
@Getter private final GameHome home;
|
||||
|
@ -212,7 +212,10 @@ public class HomeWorldMPSystem extends BaseGameSystem {
|
||||
player.setCurHomeWorld(myHome);
|
||||
myHome.getHome().onOwnerLogin(player);
|
||||
|
||||
player.sendPacket(new PacketPlayerQuitFromHomeNotify(PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.QuitReason.BACK_TO_MY_WORLD));
|
||||
player.sendPacket(
|
||||
new PacketPlayerQuitFromHomeNotify(
|
||||
PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.QuitReason
|
||||
.BACK_TO_MY_WORLD));
|
||||
player.sendPacket(
|
||||
new PacketPlayerEnterSceneNotify(
|
||||
player,
|
||||
@ -261,7 +264,9 @@ public class HomeWorldMPSystem extends BaseGameSystem {
|
||||
victim.setCurHomeWorld(myHome);
|
||||
myHome.getHome().onOwnerLogin(victim);
|
||||
|
||||
victim.sendPacket(new PacketPlayerQuitFromHomeNotify(PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.QuitReason.KICK_BY_HOST));
|
||||
victim.sendPacket(
|
||||
new PacketPlayerQuitFromHomeNotify(
|
||||
PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.QuitReason.KICK_BY_HOST));
|
||||
victim.sendPacket(
|
||||
new PacketPlayerEnterSceneNotify(
|
||||
victim,
|
||||
|
@ -7,15 +7,14 @@ import emu.grasscutter.game.world.Position;
|
||||
import emu.grasscutter.net.proto.HomeFurnitureSuiteDataOuterClass;
|
||||
import emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass;
|
||||
import emu.grasscutter.net.proto.HomeMarkPointSuiteDataOuterClass;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Builder(builderMethodName = "of")
|
||||
@Getter
|
||||
@ -28,7 +27,8 @@ public class HomeSuiteItem implements HomeMarkPointProtoFactory {
|
||||
List<Integer> includedFurnitureIndexList;
|
||||
boolean isAllowSummon;
|
||||
|
||||
public static HomeSuiteItem parseFrom(HomeFurnitureSuiteDataOuterClass.HomeFurnitureSuiteData data) {
|
||||
public static HomeSuiteItem parseFrom(
|
||||
HomeFurnitureSuiteDataOuterClass.HomeFurnitureSuiteData data) {
|
||||
return HomeSuiteItem.of()
|
||||
.guid(data.getGuid())
|
||||
.suiteId(data.getSuiteId())
|
||||
@ -48,15 +48,15 @@ public class HomeSuiteItem implements HomeMarkPointProtoFactory {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@Nullable @Override
|
||||
public HomeMarkPointFurnitureDataOuterClass.HomeMarkPointFurnitureData toMarkPointProto() {
|
||||
return HomeMarkPointFurnitureDataOuterClass.HomeMarkPointFurnitureData.newBuilder()
|
||||
.setFurnitureId(SUITE_FURNITURE_ID)
|
||||
.setPos(this.pos.toProto())
|
||||
.setFurnitureType(this.getType().getValue())
|
||||
.setGuid(this.guid)
|
||||
.setSuiteData(HomeMarkPointSuiteDataOuterClass.HomeMarkPointSuiteData.newBuilder()
|
||||
.setSuiteData(
|
||||
HomeMarkPointSuiteDataOuterClass.HomeMarkPointSuiteData.newBuilder()
|
||||
.setSuiteId(this.suiteId)
|
||||
.build())
|
||||
.build();
|
||||
|
@ -3,13 +3,12 @@ package emu.grasscutter.game.home.suite.event;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
public abstract class HomeAvatarEvent {
|
||||
@ -21,7 +20,8 @@ public abstract class HomeAvatarEvent {
|
||||
final int guid;
|
||||
final int randomPos;
|
||||
|
||||
public HomeAvatarEvent(Player homeOwner, int eventId, int rewardId, int avatarId, int suiteId, int guid) {
|
||||
public HomeAvatarEvent(
|
||||
Player homeOwner, int eventId, int rewardId, int avatarId, int suiteId, int guid) {
|
||||
this.homeOwner = homeOwner;
|
||||
this.eventId = eventId;
|
||||
this.rewardId = rewardId;
|
||||
|
@ -5,11 +5,11 @@ import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.ActionReason;
|
||||
import emu.grasscutter.net.proto.HomeAvatarRewardEventInfoOuterClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeAvatarRewardEvent extends HomeAvatarEvent {
|
||||
public HomeAvatarRewardEvent(Player homeOwner, int eventId, int rewardId, int avatarId, int suiteId, int guid) {
|
||||
public HomeAvatarRewardEvent(
|
||||
Player homeOwner, int eventId, int rewardId, int avatarId, int suiteId, int guid) {
|
||||
super(homeOwner, eventId, rewardId, avatarId, suiteId, guid);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,8 @@ public class HomeAvatarSummonEvent extends HomeAvatarEvent {
|
||||
public static final int TIME_LIMIT_SECS = 240;
|
||||
final int eventOverTime;
|
||||
|
||||
public HomeAvatarSummonEvent(Player homeOwner, int eventId, int rewardId, int avatarId, int suiteId, int guid) {
|
||||
public HomeAvatarSummonEvent(
|
||||
Player homeOwner, int eventId, int rewardId, int avatarId, int suiteId, int guid) {
|
||||
super(homeOwner, eventId, rewardId, avatarId, suiteId, guid);
|
||||
|
||||
this.eventOverTime = Utils.getCurrentSeconds() + TIME_LIMIT_SECS;
|
||||
|
@ -2,17 +2,19 @@ package emu.grasscutter.game.home.suite.event;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.HomeWorldEventData;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum SuiteEventType {
|
||||
HOME_AVATAR_REWARD_EVENT,
|
||||
HOME_AVATAR_SUMMON_EVENT;
|
||||
|
||||
@Nullable
|
||||
public HomeWorldEventData getEventDataFrom(int avatarId, int suiteId) {
|
||||
@Nullable public HomeWorldEventData getEventDataFrom(int avatarId, int suiteId) {
|
||||
return GameData.getHomeWorldEventDataMap().values().stream()
|
||||
.filter(data -> data.getEventType() == this && data.getAvatarID() == avatarId && data.getSuiteId() == suiteId)
|
||||
.filter(
|
||||
data ->
|
||||
data.getEventType() == this
|
||||
&& data.getAvatarID() == avatarId
|
||||
&& data.getSuiteId() == suiteId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
@ -16,15 +16,14 @@ public class HandlerHomeAvatarRewardEventGetReq extends PacketHandler {
|
||||
var req = HomeAvatarRewardEventGetReqOuterClass.HomeAvatarRewardEventGetReq.parseFrom(payload);
|
||||
|
||||
var player = session.getPlayer();
|
||||
var rewardsOrError = player.getCurHomeWorld().getModuleManager().claimAvatarRewards(req.getEventId());
|
||||
var rewardsOrError =
|
||||
player.getCurHomeWorld().getModuleManager().claimAvatarRewards(req.getEventId());
|
||||
session.send(new PacketHomeAvatarRewardEventNotify(player));
|
||||
session.send(new PacketHomeAvatarAllFinishRewardNotify(player));
|
||||
|
||||
session.send(
|
||||
rewardsOrError.map(
|
||||
gameItems -> new PacketHomeAvatarRewardEventGetRsp(req.getEventId(), gameItems),
|
||||
integer -> new PacketHomeAvatarRewardEventGetRsp(req.getEventId(), integer)
|
||||
)
|
||||
);
|
||||
integer -> new PacketHomeAvatarRewardEventGetRsp(req.getEventId(), integer)));
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,10 @@ public class HandlerHomeAvatarSummonEventReq extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
var req = HomeAvatarSummonEventReqOuterClass.HomeAvatarSummonEventReq.parseFrom(payload);
|
||||
var moduleManager = session.getPlayer().getCurHomeWorld().getModuleManager();
|
||||
var eventOrError = moduleManager.fireAvatarSummonEvent(session.getPlayer(), req.getAvatarId(), req.getGuid(), req.getSuitId());
|
||||
session.send(eventOrError.map(PacketHomeAvatarSummonEventRsp::new, PacketHomeAvatarSummonEventRsp::new));
|
||||
var eventOrError =
|
||||
moduleManager.fireAvatarSummonEvent(
|
||||
session.getPlayer(), req.getAvatarId(), req.getGuid(), req.getSuitId());
|
||||
session.send(
|
||||
eventOrError.map(PacketHomeAvatarSummonEventRsp::new, PacketHomeAvatarSummonEventRsp::new));
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ public class HandlerHomeSceneInitFinishReq extends PacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
curHomeWorld.ifHost(session.getPlayer(), player -> {
|
||||
curHomeWorld.ifHost(
|
||||
session.getPlayer(),
|
||||
player -> {
|
||||
player.sendPacket(new PacketHomeAvatarRewardEventNotify(player));
|
||||
player.sendPacket(new PacketHomeAvatarSummonAllEventNotify(player));
|
||||
});
|
||||
|
@ -11,7 +11,8 @@ public class PacketHomeAvatarAllFinishRewardNotify extends BasePacket {
|
||||
|
||||
var list = player.getHome().getFinishedRewardEventIdSet();
|
||||
if (list != null) {
|
||||
this.setData(HomeAvatarAllFinishRewardNotifyOuterClass.HomeAvatarAllFinishRewardNotify.newBuilder()
|
||||
this.setData(
|
||||
HomeAvatarAllFinishRewardNotifyOuterClass.HomeAvatarAllFinishRewardNotify.newBuilder()
|
||||
.addAllEventIdList(player.getHome().getFinishedRewardEventIdSet()));
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.HomeAvatarRewardEventGetRspOuterClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PacketHomeAvatarRewardEventGetRsp extends BasePacket {
|
||||
public PacketHomeAvatarRewardEventGetRsp(int eventId, List<GameItem> rewards) {
|
||||
super(PacketOpcodes.HomeAvatarRewardEventGetRsp);
|
||||
|
||||
this.setData(HomeAvatarRewardEventGetRspOuterClass.HomeAvatarRewardEventGetRsp.newBuilder()
|
||||
this.setData(
|
||||
HomeAvatarRewardEventGetRspOuterClass.HomeAvatarRewardEventGetRsp.newBuilder()
|
||||
.setEventId(eventId)
|
||||
.addAllItemList(rewards.stream().map(GameItem::toItemParam).toList()));
|
||||
}
|
||||
@ -19,7 +19,8 @@ public class PacketHomeAvatarRewardEventGetRsp extends BasePacket {
|
||||
public PacketHomeAvatarRewardEventGetRsp(int eventId, int retcode) {
|
||||
super(PacketOpcodes.HomeAvatarRewardEventGetRsp);
|
||||
|
||||
this.setData(HomeAvatarRewardEventGetRspOuterClass.HomeAvatarRewardEventGetRsp.newBuilder()
|
||||
this.setData(
|
||||
HomeAvatarRewardEventGetRspOuterClass.HomeAvatarRewardEventGetRsp.newBuilder()
|
||||
.setEventId(eventId)
|
||||
.setRetcode(retcode));
|
||||
}
|
||||
|
@ -9,14 +9,16 @@ public class PacketHomeAvatarSummonEventRsp extends BasePacket {
|
||||
public PacketHomeAvatarSummonEventRsp(HomeAvatarSummonEvent event) {
|
||||
super(PacketOpcodes.HomeAvatarSummonEventRsp);
|
||||
|
||||
this.setData(HomeAvatarSummonEventRspOuterClass.HomeAvatarSummonEventRsp.newBuilder()
|
||||
this.setData(
|
||||
HomeAvatarSummonEventRspOuterClass.HomeAvatarSummonEventRsp.newBuilder()
|
||||
.setEventId(event.getEventId()));
|
||||
}
|
||||
|
||||
public PacketHomeAvatarSummonEventRsp(int retcode) {
|
||||
super(PacketOpcodes.HomeAvatarSummonEventRsp);
|
||||
|
||||
this.setData(HomeAvatarSummonEventRspOuterClass.HomeAvatarSummonEventRsp.newBuilder()
|
||||
this.setData(
|
||||
HomeAvatarSummonEventRspOuterClass.HomeAvatarSummonEventRsp.newBuilder()
|
||||
.setRetcode(retcode));
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,8 @@ public class PacketHomeAvatarSummonFinishRsp extends BasePacket {
|
||||
public PacketHomeAvatarSummonFinishRsp(int eventId) {
|
||||
super(PacketOpcodes.HomeAvatarSummonFinishRsp);
|
||||
|
||||
this.setData(HomeAvatarSummonFinishRspOuterClass.HomeAvatarSummonFinishRsp.newBuilder()
|
||||
this.setData(
|
||||
HomeAvatarSummonFinishRspOuterClass.HomeAvatarSummonFinishRsp.newBuilder()
|
||||
.setEventId(eventId));
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,11 @@ import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.PlayerQuitFromHomeNotifyOuterClass;
|
||||
|
||||
public class PacketPlayerQuitFromHomeNotify extends BasePacket {
|
||||
public PacketPlayerQuitFromHomeNotify(PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.QuitReason reason) {
|
||||
public PacketPlayerQuitFromHomeNotify(
|
||||
PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.QuitReason reason) {
|
||||
super(PacketOpcodes.PlayerQuitFromHomeNotify);
|
||||
|
||||
this.setData(PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.newBuilder()
|
||||
.setReason(reason));
|
||||
this.setData(
|
||||
PlayerQuitFromHomeNotifyOuterClass.PlayerQuitFromHomeNotify.newBuilder().setReason(reason));
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ public abstract class Either<L, R> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U, V> Either<U, V> mapBoth(Function<? super L, ? extends U> f1, Function<? super R, ? extends V> f2) {
|
||||
public <U, V> Either<U, V> mapBoth(
|
||||
Function<? super L, ? extends U> f1, Function<? super R, ? extends V> f2) {
|
||||
return new Left<>(f1.apply(this.value));
|
||||
}
|
||||
|
||||
@ -71,7 +72,8 @@ public abstract class Either<L, R> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U, V> Either<U, V> mapBoth(Function<? super L, ? extends U> f1, Function<? super R, ? extends V> f2) {
|
||||
public <U, V> Either<U, V> mapBoth(
|
||||
Function<? super L, ? extends U> f1, Function<? super R, ? extends V> f2) {
|
||||
return new Right<>(f2.apply(this.value));
|
||||
}
|
||||
|
||||
@ -120,10 +122,10 @@ public abstract class Either<L, R> {
|
||||
}
|
||||
}
|
||||
|
||||
private Either() {
|
||||
}
|
||||
private Either() {}
|
||||
|
||||
public abstract <U, V> Either<U, V> mapBoth(Function<? super L, ? extends U> f1, Function<? super R, ? extends V> f2);
|
||||
public abstract <U, V> Either<U, V> mapBoth(
|
||||
Function<? super L, ? extends U> f1, Function<? super R, ? extends V> f2);
|
||||
|
||||
public abstract <T> T map(Function<? super L, ? extends T> l, Function<? super R, ? extends T> r);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user