Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
KingRainbow44 2023-09-02 19:04:09 -04:00
commit ed0e89074b
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
6 changed files with 150 additions and 137 deletions

View File

@ -25,10 +25,10 @@ public final class HomeTransferReqOuterClass {
int getGuid(); int getGuid();
/** /**
* <code>bool JFEOCNJLCLG = 5;</code> * <code>bool is_transfer_to_main_house_point = 5;</code>
* @return The jFEOCNJLCLG. * @return The isTransferToMainHousePoint.
*/ */
boolean getJFEOCNJLCLG(); boolean getIsTransferToMainHousePoint();
/** /**
* <code>bool is_transfer_to_safe_point = 3;</code> * <code>bool is_transfer_to_safe_point = 3;</code>
@ -93,7 +93,7 @@ public final class HomeTransferReqOuterClass {
} }
case 40: { case 40: {
jFEOCNJLCLG_ = input.readBool(); isTransferToMainHousePoint_ = input.readBool();
break; break;
} }
case 96: { case 96: {
@ -144,15 +144,15 @@ public final class HomeTransferReqOuterClass {
return guid_; return guid_;
} }
public static final int JFEOCNJLCLG_FIELD_NUMBER = 5; public static final int IS_TRANSFER_TO_MAIN_HOUSE_POINT_FIELD_NUMBER = 5;
private boolean jFEOCNJLCLG_; private boolean isTransferToMainHousePoint_;
/** /**
* <code>bool JFEOCNJLCLG = 5;</code> * <code>bool is_transfer_to_main_house_point = 5;</code>
* @return The jFEOCNJLCLG. * @return The isTransferToMainHousePoint.
*/ */
@java.lang.Override @java.lang.Override
public boolean getJFEOCNJLCLG() { public boolean getIsTransferToMainHousePoint() {
return jFEOCNJLCLG_; return isTransferToMainHousePoint_;
} }
public static final int IS_TRANSFER_TO_SAFE_POINT_FIELD_NUMBER = 3; public static final int IS_TRANSFER_TO_SAFE_POINT_FIELD_NUMBER = 3;
@ -183,8 +183,8 @@ public final class HomeTransferReqOuterClass {
if (isTransferToSafePoint_ != false) { if (isTransferToSafePoint_ != false) {
output.writeBool(3, isTransferToSafePoint_); output.writeBool(3, isTransferToSafePoint_);
} }
if (jFEOCNJLCLG_ != false) { if (isTransferToMainHousePoint_ != false) {
output.writeBool(5, jFEOCNJLCLG_); output.writeBool(5, isTransferToMainHousePoint_);
} }
if (guid_ != 0) { if (guid_ != 0) {
output.writeUInt32(12, guid_); output.writeUInt32(12, guid_);
@ -202,9 +202,9 @@ public final class HomeTransferReqOuterClass {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBoolSize(3, isTransferToSafePoint_); .computeBoolSize(3, isTransferToSafePoint_);
} }
if (jFEOCNJLCLG_ != false) { if (isTransferToMainHousePoint_ != false) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBoolSize(5, jFEOCNJLCLG_); .computeBoolSize(5, isTransferToMainHousePoint_);
} }
if (guid_ != 0) { if (guid_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -227,8 +227,8 @@ public final class HomeTransferReqOuterClass {
if (getGuid() if (getGuid()
!= other.getGuid()) return false; != other.getGuid()) return false;
if (getJFEOCNJLCLG() if (getIsTransferToMainHousePoint()
!= other.getJFEOCNJLCLG()) return false; != other.getIsTransferToMainHousePoint()) return false;
if (getIsTransferToSafePoint() if (getIsTransferToSafePoint()
!= other.getIsTransferToSafePoint()) return false; != other.getIsTransferToSafePoint()) return false;
if (!unknownFields.equals(other.unknownFields)) return false; if (!unknownFields.equals(other.unknownFields)) return false;
@ -244,9 +244,9 @@ public final class HomeTransferReqOuterClass {
hash = (19 * hash) + getDescriptor().hashCode(); hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + GUID_FIELD_NUMBER; hash = (37 * hash) + GUID_FIELD_NUMBER;
hash = (53 * hash) + getGuid(); hash = (53 * hash) + getGuid();
hash = (37 * hash) + JFEOCNJLCLG_FIELD_NUMBER; hash = (37 * hash) + IS_TRANSFER_TO_MAIN_HOUSE_POINT_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getJFEOCNJLCLG()); getIsTransferToMainHousePoint());
hash = (37 * hash) + IS_TRANSFER_TO_SAFE_POINT_FIELD_NUMBER; hash = (37 * hash) + IS_TRANSFER_TO_SAFE_POINT_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIsTransferToSafePoint()); getIsTransferToSafePoint());
@ -390,7 +390,7 @@ public final class HomeTransferReqOuterClass {
super.clear(); super.clear();
guid_ = 0; guid_ = 0;
jFEOCNJLCLG_ = false; isTransferToMainHousePoint_ = false;
isTransferToSafePoint_ = false; isTransferToSafePoint_ = false;
@ -421,7 +421,7 @@ public final class HomeTransferReqOuterClass {
public emu.grasscutter.net.proto.HomeTransferReqOuterClass.HomeTransferReq buildPartial() { public emu.grasscutter.net.proto.HomeTransferReqOuterClass.HomeTransferReq buildPartial() {
emu.grasscutter.net.proto.HomeTransferReqOuterClass.HomeTransferReq result = new emu.grasscutter.net.proto.HomeTransferReqOuterClass.HomeTransferReq(this); emu.grasscutter.net.proto.HomeTransferReqOuterClass.HomeTransferReq result = new emu.grasscutter.net.proto.HomeTransferReqOuterClass.HomeTransferReq(this);
result.guid_ = guid_; result.guid_ = guid_;
result.jFEOCNJLCLG_ = jFEOCNJLCLG_; result.isTransferToMainHousePoint_ = isTransferToMainHousePoint_;
result.isTransferToSafePoint_ = isTransferToSafePoint_; result.isTransferToSafePoint_ = isTransferToSafePoint_;
onBuilt(); onBuilt();
return result; return result;
@ -474,8 +474,8 @@ public final class HomeTransferReqOuterClass {
if (other.getGuid() != 0) { if (other.getGuid() != 0) {
setGuid(other.getGuid()); setGuid(other.getGuid());
} }
if (other.getJFEOCNJLCLG() != false) { if (other.getIsTransferToMainHousePoint() != false) {
setJFEOCNJLCLG(other.getJFEOCNJLCLG()); setIsTransferToMainHousePoint(other.getIsTransferToMainHousePoint());
} }
if (other.getIsTransferToSafePoint() != false) { if (other.getIsTransferToSafePoint() != false) {
setIsTransferToSafePoint(other.getIsTransferToSafePoint()); setIsTransferToSafePoint(other.getIsTransferToSafePoint());
@ -540,33 +540,33 @@ public final class HomeTransferReqOuterClass {
return this; return this;
} }
private boolean jFEOCNJLCLG_ ; private boolean isTransferToMainHousePoint_ ;
/** /**
* <code>bool JFEOCNJLCLG = 5;</code> * <code>bool is_transfer_to_main_house_point = 5;</code>
* @return The jFEOCNJLCLG. * @return The isTransferToMainHousePoint.
*/ */
@java.lang.Override @java.lang.Override
public boolean getJFEOCNJLCLG() { public boolean getIsTransferToMainHousePoint() {
return jFEOCNJLCLG_; return isTransferToMainHousePoint_;
} }
/** /**
* <code>bool JFEOCNJLCLG = 5;</code> * <code>bool is_transfer_to_main_house_point = 5;</code>
* @param value The jFEOCNJLCLG to set. * @param value The isTransferToMainHousePoint to set.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder setJFEOCNJLCLG(boolean value) { public Builder setIsTransferToMainHousePoint(boolean value) {
jFEOCNJLCLG_ = value; isTransferToMainHousePoint_ = value;
onChanged(); onChanged();
return this; return this;
} }
/** /**
* <code>bool JFEOCNJLCLG = 5;</code> * <code>bool is_transfer_to_main_house_point = 5;</code>
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder clearJFEOCNJLCLG() { public Builder clearIsTransferToMainHousePoint() {
jFEOCNJLCLG_ = false; isTransferToMainHousePoint_ = false;
onChanged(); onChanged();
return this; return this;
} }
@ -668,10 +668,11 @@ public final class HomeTransferReqOuterClass {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\025HomeTransferReq.proto\"W\n\017HomeTransferR" + "\n\025HomeTransferReq.proto\"k\n\017HomeTransferR" +
"eq\022\014\n\004guid\030\014 \001(\r\022\023\n\013JFEOCNJLCLG\030\005 \001(\010\022!\n" + "eq\022\014\n\004guid\030\014 \001(\r\022\'\n\037is_transfer_to_main_" +
"\031is_transfer_to_safe_point\030\003 \001(\010B\033\n\031emu." + "house_point\030\005 \001(\010\022!\n\031is_transfer_to_safe" +
"grasscutter.net.protob\006proto3" "_point\030\003 \001(\010B\033\n\031emu.grasscutter.net.prot" +
"ob\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,
@ -682,7 +683,7 @@ public final class HomeTransferReqOuterClass {
internal_static_HomeTransferReq_fieldAccessorTable = new internal_static_HomeTransferReq_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_HomeTransferReq_descriptor, internal_static_HomeTransferReq_descriptor,
new java.lang.String[] { "Guid", "JFEOCNJLCLG", "IsTransferToSafePoint", }); new java.lang.String[] { "Guid", "IsTransferToMainHousePoint", "IsTransferToSafePoint", });
} }
// @@protoc_insertion_point(outer_class_scope) // @@protoc_insertion_point(outer_class_scope)

View File

@ -37,10 +37,10 @@ public final class TryEnterHomeReqOuterClass {
int getTargetPoint(); int getTargetPoint();
/** /**
* <code>bool JFEOCNJLCLG = 12;</code> * <code>bool is_transfer_to_main_house_point = 12;</code>
* @return The jFEOCNJLCLG. * @return The isTransferToMainHousePoint.
*/ */
boolean getJFEOCNJLCLG(); boolean getIsTransferToMainHousePoint();
} }
/** /**
* <pre> * <pre>
@ -109,7 +109,7 @@ public final class TryEnterHomeReqOuterClass {
} }
case 96: { case 96: {
jFEOCNJLCLG_ = input.readBool(); isTransferToMainHousePoint_ = input.readBool();
break; break;
} }
default: { default: {
@ -177,15 +177,15 @@ public final class TryEnterHomeReqOuterClass {
return targetPoint_; return targetPoint_;
} }
public static final int JFEOCNJLCLG_FIELD_NUMBER = 12; public static final int IS_TRANSFER_TO_MAIN_HOUSE_POINT_FIELD_NUMBER = 12;
private boolean jFEOCNJLCLG_; private boolean isTransferToMainHousePoint_;
/** /**
* <code>bool JFEOCNJLCLG = 12;</code> * <code>bool is_transfer_to_main_house_point = 12;</code>
* @return The jFEOCNJLCLG. * @return The isTransferToMainHousePoint.
*/ */
@java.lang.Override @java.lang.Override
public boolean getJFEOCNJLCLG() { public boolean getIsTransferToMainHousePoint() {
return jFEOCNJLCLG_; return isTransferToMainHousePoint_;
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
@ -211,8 +211,8 @@ public final class TryEnterHomeReqOuterClass {
if (isTransferToSafePoint_ != false) { if (isTransferToSafePoint_ != false) {
output.writeBool(9, isTransferToSafePoint_); output.writeBool(9, isTransferToSafePoint_);
} }
if (jFEOCNJLCLG_ != false) { if (isTransferToMainHousePoint_ != false) {
output.writeBool(12, jFEOCNJLCLG_); output.writeBool(12, isTransferToMainHousePoint_);
} }
unknownFields.writeTo(output); unknownFields.writeTo(output);
} }
@ -235,9 +235,9 @@ public final class TryEnterHomeReqOuterClass {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBoolSize(9, isTransferToSafePoint_); .computeBoolSize(9, isTransferToSafePoint_);
} }
if (jFEOCNJLCLG_ != false) { if (isTransferToMainHousePoint_ != false) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBoolSize(12, jFEOCNJLCLG_); .computeBoolSize(12, isTransferToMainHousePoint_);
} }
size += unknownFields.getSerializedSize(); size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
@ -260,8 +260,8 @@ public final class TryEnterHomeReqOuterClass {
!= other.getIsTransferToSafePoint()) return false; != other.getIsTransferToSafePoint()) return false;
if (getTargetPoint() if (getTargetPoint()
!= other.getTargetPoint()) return false; != other.getTargetPoint()) return false;
if (getJFEOCNJLCLG() if (getIsTransferToMainHousePoint()
!= other.getJFEOCNJLCLG()) return false; != other.getIsTransferToMainHousePoint()) return false;
if (!unknownFields.equals(other.unknownFields)) return false; if (!unknownFields.equals(other.unknownFields)) return false;
return true; return true;
} }
@ -280,9 +280,9 @@ public final class TryEnterHomeReqOuterClass {
getIsTransferToSafePoint()); getIsTransferToSafePoint());
hash = (37 * hash) + TARGET_POINT_FIELD_NUMBER; hash = (37 * hash) + TARGET_POINT_FIELD_NUMBER;
hash = (53 * hash) + getTargetPoint(); hash = (53 * hash) + getTargetPoint();
hash = (37 * hash) + JFEOCNJLCLG_FIELD_NUMBER; hash = (37 * hash) + IS_TRANSFER_TO_MAIN_HOUSE_POINT_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getJFEOCNJLCLG()); getIsTransferToMainHousePoint());
hash = (29 * hash) + unknownFields.hashCode(); hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash; memoizedHashCode = hash;
return hash; return hash;
@ -427,7 +427,7 @@ public final class TryEnterHomeReqOuterClass {
targetPoint_ = 0; targetPoint_ = 0;
jFEOCNJLCLG_ = false; isTransferToMainHousePoint_ = false;
return this; return this;
} }
@ -458,7 +458,7 @@ public final class TryEnterHomeReqOuterClass {
result.targetUid_ = targetUid_; result.targetUid_ = targetUid_;
result.isTransferToSafePoint_ = isTransferToSafePoint_; result.isTransferToSafePoint_ = isTransferToSafePoint_;
result.targetPoint_ = targetPoint_; result.targetPoint_ = targetPoint_;
result.jFEOCNJLCLG_ = jFEOCNJLCLG_; result.isTransferToMainHousePoint_ = isTransferToMainHousePoint_;
onBuilt(); onBuilt();
return result; return result;
} }
@ -516,8 +516,8 @@ public final class TryEnterHomeReqOuterClass {
if (other.getTargetPoint() != 0) { if (other.getTargetPoint() != 0) {
setTargetPoint(other.getTargetPoint()); setTargetPoint(other.getTargetPoint());
} }
if (other.getJFEOCNJLCLG() != false) { if (other.getIsTransferToMainHousePoint() != false) {
setJFEOCNJLCLG(other.getJFEOCNJLCLG()); setIsTransferToMainHousePoint(other.getIsTransferToMainHousePoint());
} }
this.mergeUnknownFields(other.unknownFields); this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
@ -641,33 +641,33 @@ public final class TryEnterHomeReqOuterClass {
return this; return this;
} }
private boolean jFEOCNJLCLG_ ; private boolean isTransferToMainHousePoint_ ;
/** /**
* <code>bool JFEOCNJLCLG = 12;</code> * <code>bool is_transfer_to_main_house_point = 12;</code>
* @return The jFEOCNJLCLG. * @return The isTransferToMainHousePoint.
*/ */
@java.lang.Override @java.lang.Override
public boolean getJFEOCNJLCLG() { public boolean getIsTransferToMainHousePoint() {
return jFEOCNJLCLG_; return isTransferToMainHousePoint_;
} }
/** /**
* <code>bool JFEOCNJLCLG = 12;</code> * <code>bool is_transfer_to_main_house_point = 12;</code>
* @param value The jFEOCNJLCLG to set. * @param value The isTransferToMainHousePoint to set.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder setJFEOCNJLCLG(boolean value) { public Builder setIsTransferToMainHousePoint(boolean value) {
jFEOCNJLCLG_ = value; isTransferToMainHousePoint_ = value;
onChanged(); onChanged();
return this; return this;
} }
/** /**
* <code>bool JFEOCNJLCLG = 12;</code> * <code>bool is_transfer_to_main_house_point = 12;</code>
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder clearJFEOCNJLCLG() { public Builder clearIsTransferToMainHousePoint() {
jFEOCNJLCLG_ = false; isTransferToMainHousePoint_ = false;
onChanged(); onChanged();
return this; return this;
} }
@ -738,11 +738,11 @@ public final class TryEnterHomeReqOuterClass {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\025TryEnterHomeReq.proto\"s\n\017TryEnterHomeR" + "\n\025TryEnterHomeReq.proto\"\207\001\n\017TryEnterHome" +
"eq\022\022\n\ntarget_uid\030\004 \001(\r\022!\n\031is_transfer_to" + "Req\022\022\n\ntarget_uid\030\004 \001(\r\022!\n\031is_transfer_t" +
"_safe_point\030\t \001(\010\022\024\n\014target_point\030\005 \001(\r\022" + "o_safe_point\030\t \001(\010\022\024\n\014target_point\030\005 \001(\r" +
"\023\n\013JFEOCNJLCLG\030\014 \001(\010B\033\n\031emu.grasscutter." + "\022\'\n\037is_transfer_to_main_house_point\030\014 \001(" +
"net.protob\006proto3" "\010B\033\n\031emu.grasscutter.net.protob\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,
@ -753,7 +753,7 @@ public final class TryEnterHomeReqOuterClass {
internal_static_TryEnterHomeReq_fieldAccessorTable = new internal_static_TryEnterHomeReq_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_TryEnterHomeReq_descriptor, internal_static_TryEnterHomeReq_descriptor,
new java.lang.String[] { "TargetUid", "IsTransferToSafePoint", "TargetPoint", "JFEOCNJLCLG", }); new java.lang.String[] { "TargetUid", "IsTransferToSafePoint", "TargetPoint", "IsTransferToMainHousePoint", });
} }
// @@protoc_insertion_point(outer_class_scope) // @@protoc_insertion_point(outer_class_scope)

View File

@ -9,9 +9,12 @@ import emu.grasscutter.game.entity.EntityHomeAnimal;
import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Position;
import emu.grasscutter.game.world.Scene; import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo; import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo;
import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.*; import lombok.*;
import lombok.experimental.FieldDefaults; import lombok.experimental.FieldDefaults;
@ -81,6 +84,21 @@ public class HomeSceneItem {
return mainHouse == null || mainHouse.getAsItem() == null; return mainHouse == null || mainHouse.getAsItem() == null;
} }
@Nullable
public Position getTeleportPointPos(int guid) {
var pos = new AtomicReference<Position>();
this.getBlockItems().values().stream()
.map(HomeBlockItem::getDeployFurnitureList)
.flatMap(Collection::stream)
.filter(homeFurnitureItem -> homeFurnitureItem.getGuid() == guid)
.map(HomeFurnitureItem::getSpawnPos)
.findFirst()
.ifPresent(pos::set);
return pos.get();
}
public List<EntityHomeAnimal> getAnimals(Scene scene) { public List<EntityHomeAnimal> getAnimals(Scene scene) {
return this.blockItems.values().stream() return this.blockItems.values().stream()
.map(HomeBlockItem::getDeployAnimalList) .map(HomeBlockItem::getDeployAnimalList)

View File

@ -2,11 +2,18 @@ package emu.grasscutter.game.home;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.EnterReason; import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.world.*; import emu.grasscutter.game.world.Position;
import emu.grasscutter.game.world.World;
import emu.grasscutter.game.world.data.TeleportProperties; import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.net.proto.*; import emu.grasscutter.net.proto.EnterTypeOuterClass;
import emu.grasscutter.server.event.player.*; import emu.grasscutter.net.proto.OtherPlayerEnterHomeNotifyOuterClass;
import emu.grasscutter.server.game.*; import emu.grasscutter.net.proto.PlayerApplyEnterHomeResultNotifyOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.server.event.player.PlayerEnterHomeEvent;
import emu.grasscutter.server.event.player.PlayerLeaveHomeEvent;
import emu.grasscutter.server.event.player.PlayerTeleportEvent;
import emu.grasscutter.server.game.BaseGameSystem;
import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.packet.send.*;
public class HomeWorldMPSystem extends BaseGameSystem { public class HomeWorldMPSystem extends BaseGameSystem {
@ -98,10 +105,10 @@ public class HomeWorldMPSystem extends BaseGameSystem {
return; return;
} }
this.enterHome(requester, owner); this.enterHome(requester, owner, 0, false);
} }
public void enterHome(Player requester, Player owner) { public void enterHome(Player requester, Player owner, int teleportPoint, boolean toSafe) {
if (requester.getWorld().isMultiplayer()) { if (requester.getWorld().isMultiplayer()) {
return; return;
} }
@ -134,9 +141,16 @@ public class HomeWorldMPSystem extends BaseGameSystem {
} }
int realmId = 2000 + owner.getCurrentRealmId(); int realmId = 2000 + owner.getCurrentRealmId();
targetHome.getHomeSceneItem(realmId); var item = targetHome.getHomeSceneItem(realmId);
targetHome.save(); targetHome.save();
var pos = world.getSceneById(realmId).getScriptManager().getConfig().born_pos; var pos = toSafe ? world.getSceneById(realmId).getScriptManager().getConfig().born_pos : item.getBornPos();
if (teleportPoint != 0) {
var target = item.getTeleportPointPos(teleportPoint);
if (target != null) {
pos = target;
}
}
requester.getPrevPosForHome().set(requester.getPosition()); requester.getPrevPosForHome().set(requester.getPosition());
requester.setCurHomeWorld(world); requester.setCurHomeWorld(world);
@ -188,21 +202,12 @@ public class HomeWorldMPSystem extends BaseGameSystem {
player.getPosition().set(pos); player.getPosition().set(pos);
var world = new World(player); var world = new World(player);
world.addPlayer(player, prevScene); world.addPlayer(player, prevScene);
player player.getCurHomeWorld().sendPacketToHostIfOnline(new PacketOtherPlayerEnterOrLeaveHomeNotify(player, OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.LEAVE));
.getCurHomeWorld() var myHome = this.server.getHomeWorldOrCreate(player);
.sendPacketToHostIfOnline( player.setCurHomeWorld(myHome);
new PacketOtherPlayerEnterOrLeaveHomeNotify( myHome.getHome().onOwnerLogin(player);
player,
OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.LEAVE));
player.setCurHomeWorld(this.server.getHomeWorldOrCreate(player));
player.sendPacket( player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterTypeOuterClass.EnterType.ENTER_TYPE_BACK, EnterReason.TeamBack, prevScene, pos));
new PacketPlayerEnterSceneNotify(
player,
EnterTypeOuterClass.EnterType.ENTER_TYPE_BACK,
EnterReason.TeamBack,
prevScene,
pos));
return true; return true;
} }
@ -234,13 +239,10 @@ public class HomeWorldMPSystem extends BaseGameSystem {
victim.getPosition().set(victim.getPrevPosForHome()); victim.getPosition().set(victim.getPrevPosForHome());
var world = new World(victim); var world = new World(victim);
world.addPlayer(victim, 3); world.addPlayer(victim, 3);
victim victim.getCurHomeWorld().sendPacketToHostIfOnline(new PacketOtherPlayerEnterOrLeaveHomeNotify(victim, OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.LEAVE));
.getCurHomeWorld() var myHome = this.server.getHomeWorldOrCreate(victim);
.sendPacketToHostIfOnline( victim.setCurHomeWorld(myHome);
new PacketOtherPlayerEnterOrLeaveHomeNotify( myHome.getHome().onOwnerLogin(victim);
victim,
OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.LEAVE));
victim.setCurHomeWorld(this.server.getHomeWorldOrCreate(victim));
victim.sendPacket( victim.sendPacket(
new PacketPlayerEnterSceneNotify( new PacketPlayerEnterSceneNotify(

View File

@ -1,11 +1,11 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import com.github.davidmoten.guavamini.Lists; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.game.home.HomeFurnitureItem; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.*; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeTransferReqOuterClass; import emu.grasscutter.net.proto.HomeTransferReqOuterClass;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import java.util.List;
@Opcodes(PacketOpcodes.HomeTransferReq) @Opcodes(PacketOpcodes.HomeTransferReq)
public class HandlerHomeTransferReq extends PacketHandler { public class HandlerHomeTransferReq extends PacketHandler {
@ -16,28 +16,15 @@ public class HandlerHomeTransferReq extends PacketHandler {
var home = player.getCurHomeWorld().getHome(); var home = player.getCurHomeWorld().getHome();
var item = home.getHomeSceneItem(player.getSceneId()); var item = home.getHomeSceneItem(player.getSceneId());
if (req.getIsTransferToSafePoint()) { var pos = req.getIsTransferToMainHousePoint() ? item.getBornPos() : player.getCurHomeWorld().getSceneById(player.getSceneId()).getScriptManager().getConfig().born_pos;
player if (req.getGuid() != 0) {
.getCurHomeWorld() var target = item.getTeleportPointPos(req.getGuid());
.transferPlayerToScene(player, player.getSceneId(), item.getBornPos()); if (target != null) {
} else { pos = target;
for (var homeBlockItem : item.getBlockItems().values()) {
List<HomeFurnitureItem> items = Lists.newArrayList();
items.addAll(homeBlockItem.getDeployFurnitureList());
items.addAll(homeBlockItem.getPersistentFurnitureList());
items.stream()
.filter(homeFurnitureItem -> homeFurnitureItem.getGuid() == req.getGuid())
.findFirst()
.ifPresent(
homeFurnitureItem -> {
player
.getCurHomeWorld()
.transferPlayerToScene(
player, player.getSceneId(), homeFurnitureItem.getSpawnPos());
});
} }
} }
player.getCurHomeWorld().transferPlayerToScene(player, player.getSceneId(), pos);
session.send(new BasePacket(PacketOpcodes.HomeTransferRsp)); session.send(new BasePacket(PacketOpcodes.HomeTransferRsp));
} }
} }

View File

@ -1,8 +1,12 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.home.GameHome; import emu.grasscutter.game.home.GameHome;
import emu.grasscutter.net.packet.*; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.proto.*; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.TryEnterHomeReqOuterClass;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketTryEnterHomeRsp; import emu.grasscutter.server.packet.send.PacketTryEnterHomeRsp;
@ -45,15 +49,16 @@ public class HandlerTryEnterHomeReq extends PacketHandler {
RetcodeOuterClass.Retcode.RET_HOME_HOME_REFUSE_GUEST_ENTER_VALUE, RetcodeOuterClass.Retcode.RET_HOME_HOME_REFUSE_GUEST_ENTER_VALUE,
req.getTargetUid())); req.getTargetUid()));
} }
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
.FRIEND_ENTER_HOME_OPTION_DIRECT_VALUE -> { case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_DIRECT_VALUE -> {
session.getServer().getHomeWorldMPSystem().enterHome(session.getPlayer(), targetPlayer); session.getServer().getHomeWorldMPSystem().enterHome(session.getPlayer(), targetPlayer, req.getTargetPoint(), req.getIsTransferToSafePoint());
} }
} }
return; return;
} }
session.getServer().getHomeWorldMPSystem().enterHome(session.getPlayer(), targetPlayer); session.getServer().getHomeWorldMPSystem().enterHome(session.getPlayer(), targetPlayer, req.getTargetPoint(), req.getIsTransferToSafePoint());
} }
} }