feat: support multiplayer mode in teapot (#2317)

This commit is contained in:
hamusuke 2023-08-30 10:12:21 +09:00 committed by GitHub
parent 667008ecf1
commit 8563d4b574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 1740 additions and 844 deletions

View File

@ -43,17 +43,17 @@ public final class HomeBasicInfoOuterClass {
boolean getIsInEditMode(); boolean getIsInEditMode();
/** /**
* <code>uint32 cur_module_id = 13;</code> * <code>uint32 cur_room_scene_id = 13;</code>
* @return The curModuleId.
*/
int getCurModuleId();
/**
* <code>uint32 cur_room_scene_id = 8;</code>
* @return The curRoomSceneId. * @return The curRoomSceneId.
*/ */
int getCurRoomSceneId(); int getCurRoomSceneId();
/**
* <code>uint32 cur_module_id = 8;</code>
* @return The curModuleId.
*/
int getCurModuleId();
/** /**
* <code>uint64 exp = 10;</code> * <code>uint64 exp = 10;</code>
* @return The exp. * @return The exp.
@ -139,7 +139,7 @@ public final class HomeBasicInfoOuterClass {
} }
case 64: { case 64: {
curRoomSceneId_ = input.readUInt32(); curModuleId_ = input.readUInt32();
break; break;
} }
case 72: { case 72: {
@ -159,7 +159,7 @@ public final class HomeBasicInfoOuterClass {
} }
case 104: { case 104: {
curModuleId_ = input.readUInt32(); curRoomSceneId_ = input.readUInt32();
break; break;
} }
case 112: { case 112: {
@ -272,21 +272,10 @@ public final class HomeBasicInfoOuterClass {
return isInEditMode_; return isInEditMode_;
} }
public static final int CUR_MODULE_ID_FIELD_NUMBER = 13; public static final int CUR_ROOM_SCENE_ID_FIELD_NUMBER = 13;
private int curModuleId_;
/**
* <code>uint32 cur_module_id = 13;</code>
* @return The curModuleId.
*/
@java.lang.Override
public int getCurModuleId() {
return curModuleId_;
}
public static final int CUR_ROOM_SCENE_ID_FIELD_NUMBER = 8;
private int curRoomSceneId_; private int curRoomSceneId_;
/** /**
* <code>uint32 cur_room_scene_id = 8;</code> * <code>uint32 cur_room_scene_id = 13;</code>
* @return The curRoomSceneId. * @return The curRoomSceneId.
*/ */
@java.lang.Override @java.lang.Override
@ -294,6 +283,17 @@ public final class HomeBasicInfoOuterClass {
return curRoomSceneId_; return curRoomSceneId_;
} }
public static final int CUR_MODULE_ID_FIELD_NUMBER = 8;
private int curModuleId_;
/**
* <code>uint32 cur_module_id = 8;</code>
* @return The curModuleId.
*/
@java.lang.Override
public int getCurModuleId() {
return curModuleId_;
}
public static final int EXP_FIELD_NUMBER = 10; public static final int EXP_FIELD_NUMBER = 10;
private long exp_; private long exp_;
/** /**
@ -359,8 +359,8 @@ public final class HomeBasicInfoOuterClass {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ownerNickName_)) { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ownerNickName_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, ownerNickName_); com.google.protobuf.GeneratedMessageV3.writeString(output, 5, ownerNickName_);
} }
if (curRoomSceneId_ != 0) { if (curModuleId_ != 0) {
output.writeUInt32(8, curRoomSceneId_); output.writeUInt32(8, curModuleId_);
} }
if (isInEditMode_ != false) { if (isInEditMode_ != false) {
output.writeBool(9, isInEditMode_); output.writeBool(9, isInEditMode_);
@ -371,8 +371,8 @@ public final class HomeBasicInfoOuterClass {
if (level_ != 0) { if (level_ != 0) {
output.writeUInt32(11, level_); output.writeUInt32(11, level_);
} }
if (curModuleId_ != 0) { if (curRoomSceneId_ != 0) {
output.writeUInt32(13, curModuleId_); output.writeUInt32(13, curRoomSceneId_);
} }
if (homeOwnerUid_ != 0) { if (homeOwnerUid_ != 0) {
output.writeUInt32(14, homeOwnerUid_); output.writeUInt32(14, homeOwnerUid_);
@ -392,9 +392,9 @@ public final class HomeBasicInfoOuterClass {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ownerNickName_)) { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(ownerNickName_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, ownerNickName_); size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, ownerNickName_);
} }
if (curRoomSceneId_ != 0) { if (curModuleId_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(8, curRoomSceneId_); .computeUInt32Size(8, curModuleId_);
} }
if (isInEditMode_ != false) { if (isInEditMode_ != false) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -408,9 +408,9 @@ public final class HomeBasicInfoOuterClass {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(11, level_); .computeUInt32Size(11, level_);
} }
if (curModuleId_ != 0) { if (curRoomSceneId_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(13, curModuleId_); .computeUInt32Size(13, curRoomSceneId_);
} }
if (homeOwnerUid_ != 0) { if (homeOwnerUid_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -441,10 +441,10 @@ public final class HomeBasicInfoOuterClass {
.equals(other.getOwnerNickName())) return false; .equals(other.getOwnerNickName())) return false;
if (getIsInEditMode() if (getIsInEditMode()
!= other.getIsInEditMode()) return false; != other.getIsInEditMode()) return false;
if (getCurModuleId()
!= other.getCurModuleId()) return false;
if (getCurRoomSceneId() if (getCurRoomSceneId()
!= other.getCurRoomSceneId()) return false; != other.getCurRoomSceneId()) return false;
if (getCurModuleId()
!= other.getCurModuleId()) return false;
if (getExp() if (getExp()
!= other.getExp()) return false; != other.getExp()) return false;
if (getHomeOwnerUid() if (getHomeOwnerUid()
@ -472,10 +472,10 @@ public final class HomeBasicInfoOuterClass {
hash = (37 * hash) + IS_IN_EDIT_MODE_FIELD_NUMBER; hash = (37 * hash) + IS_IN_EDIT_MODE_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIsInEditMode()); getIsInEditMode());
hash = (37 * hash) + CUR_MODULE_ID_FIELD_NUMBER;
hash = (53 * hash) + getCurModuleId();
hash = (37 * hash) + CUR_ROOM_SCENE_ID_FIELD_NUMBER; hash = (37 * hash) + CUR_ROOM_SCENE_ID_FIELD_NUMBER;
hash = (53 * hash) + getCurRoomSceneId(); hash = (53 * hash) + getCurRoomSceneId();
hash = (37 * hash) + CUR_MODULE_ID_FIELD_NUMBER;
hash = (53 * hash) + getCurModuleId();
hash = (37 * hash) + EXP_FIELD_NUMBER; hash = (37 * hash) + EXP_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong( hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getExp()); getExp());
@ -628,10 +628,10 @@ public final class HomeBasicInfoOuterClass {
isInEditMode_ = false; isInEditMode_ = false;
curModuleId_ = 0;
curRoomSceneId_ = 0; curRoomSceneId_ = 0;
curModuleId_ = 0;
exp_ = 0L; exp_ = 0L;
homeOwnerUid_ = 0; homeOwnerUid_ = 0;
@ -671,8 +671,8 @@ public final class HomeBasicInfoOuterClass {
result.level_ = level_; result.level_ = level_;
result.ownerNickName_ = ownerNickName_; result.ownerNickName_ = ownerNickName_;
result.isInEditMode_ = isInEditMode_; result.isInEditMode_ = isInEditMode_;
result.curModuleId_ = curModuleId_;
result.curRoomSceneId_ = curRoomSceneId_; result.curRoomSceneId_ = curRoomSceneId_;
result.curModuleId_ = curModuleId_;
result.exp_ = exp_; result.exp_ = exp_;
result.homeOwnerUid_ = homeOwnerUid_; result.homeOwnerUid_ = homeOwnerUid_;
if (limitedShopInfoBuilder_ == null) { if (limitedShopInfoBuilder_ == null) {
@ -738,12 +738,12 @@ public final class HomeBasicInfoOuterClass {
if (other.getIsInEditMode() != false) { if (other.getIsInEditMode() != false) {
setIsInEditMode(other.getIsInEditMode()); setIsInEditMode(other.getIsInEditMode());
} }
if (other.getCurModuleId() != 0) {
setCurModuleId(other.getCurModuleId());
}
if (other.getCurRoomSceneId() != 0) { if (other.getCurRoomSceneId() != 0) {
setCurRoomSceneId(other.getCurRoomSceneId()); setCurRoomSceneId(other.getCurRoomSceneId());
} }
if (other.getCurModuleId() != 0) {
setCurModuleId(other.getCurModuleId());
}
if (other.getExp() != 0L) { if (other.getExp() != 0L) {
setExp(other.getExp()); setExp(other.getExp());
} }
@ -920,40 +920,9 @@ public final class HomeBasicInfoOuterClass {
return this; return this;
} }
private int curModuleId_ ;
/**
* <code>uint32 cur_module_id = 13;</code>
* @return The curModuleId.
*/
@java.lang.Override
public int getCurModuleId() {
return curModuleId_;
}
/**
* <code>uint32 cur_module_id = 13;</code>
* @param value The curModuleId to set.
* @return This builder for chaining.
*/
public Builder setCurModuleId(int value) {
curModuleId_ = value;
onChanged();
return this;
}
/**
* <code>uint32 cur_module_id = 13;</code>
* @return This builder for chaining.
*/
public Builder clearCurModuleId() {
curModuleId_ = 0;
onChanged();
return this;
}
private int curRoomSceneId_ ; private int curRoomSceneId_ ;
/** /**
* <code>uint32 cur_room_scene_id = 8;</code> * <code>uint32 cur_room_scene_id = 13;</code>
* @return The curRoomSceneId. * @return The curRoomSceneId.
*/ */
@java.lang.Override @java.lang.Override
@ -961,7 +930,7 @@ public final class HomeBasicInfoOuterClass {
return curRoomSceneId_; return curRoomSceneId_;
} }
/** /**
* <code>uint32 cur_room_scene_id = 8;</code> * <code>uint32 cur_room_scene_id = 13;</code>
* @param value The curRoomSceneId to set. * @param value The curRoomSceneId to set.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@ -972,7 +941,7 @@ public final class HomeBasicInfoOuterClass {
return this; return this;
} }
/** /**
* <code>uint32 cur_room_scene_id = 8;</code> * <code>uint32 cur_room_scene_id = 13;</code>
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder clearCurRoomSceneId() { public Builder clearCurRoomSceneId() {
@ -982,6 +951,37 @@ public final class HomeBasicInfoOuterClass {
return this; return this;
} }
private int curModuleId_ ;
/**
* <code>uint32 cur_module_id = 8;</code>
* @return The curModuleId.
*/
@java.lang.Override
public int getCurModuleId() {
return curModuleId_;
}
/**
* <code>uint32 cur_module_id = 8;</code>
* @param value The curModuleId to set.
* @return This builder for chaining.
*/
public Builder setCurModuleId(int value) {
curModuleId_ = value;
onChanged();
return this;
}
/**
* <code>uint32 cur_module_id = 8;</code>
* @return This builder for chaining.
*/
public Builder clearCurModuleId() {
curModuleId_ = 0;
onChanged();
return this;
}
private long exp_ ; private long exp_ ;
/** /**
* <code>uint64 exp = 10;</code> * <code>uint64 exp = 10;</code>
@ -1232,8 +1232,8 @@ public final class HomeBasicInfoOuterClass {
"\n\023HomeBasicInfo.proto\032\031HomeLimitedShopIn" + "\n\023HomeBasicInfo.proto\032\031HomeLimitedShopIn" +
"fo.proto\"\330\001\n\rHomeBasicInfo\022\r\n\005level\030\013 \001(" + "fo.proto\"\330\001\n\rHomeBasicInfo\022\r\n\005level\030\013 \001(" +
"\r\022\027\n\017owner_nick_name\030\005 \001(\t\022\027\n\017is_in_edit" + "\r\022\027\n\017owner_nick_name\030\005 \001(\t\022\027\n\017is_in_edit" +
"_mode\030\t \001(\010\022\025\n\rcur_module_id\030\r \001(\r\022\031\n\021cu" + "_mode\030\t \001(\010\022\031\n\021cur_room_scene_id\030\r \001(\r\022\025" +
"r_room_scene_id\030\010 \001(\r\022\013\n\003exp\030\n \001(\004\022\026\n\016ho" + "\n\rcur_module_id\030\010 \001(\r\022\013\n\003exp\030\n \001(\004\022\026\n\016ho" +
"me_owner_uid\030\016 \001(\r\022/\n\021limited_shop_info\030" + "me_owner_uid\030\016 \001(\r\022/\n\021limited_shop_info\030" +
"\017 \001(\0132\024.HomeLimitedShopInfoB\033\n\031emu.grass" + "\017 \001(\0132\024.HomeLimitedShopInfoB\033\n\031emu.grass" +
"cutter.net.protob\006proto3" "cutter.net.protob\006proto3"
@ -1248,7 +1248,7 @@ public final class HomeBasicInfoOuterClass {
internal_static_HomeBasicInfo_fieldAccessorTable = new internal_static_HomeBasicInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_HomeBasicInfo_descriptor, internal_static_HomeBasicInfo_descriptor,
new java.lang.String[] { "Level", "OwnerNickName", "IsInEditMode", "CurModuleId", "CurRoomSceneId", "Exp", "HomeOwnerUid", "LimitedShopInfo", }); new java.lang.String[] { "Level", "OwnerNickName", "IsInEditMode", "CurRoomSceneId", "CurModuleId", "Exp", "HomeOwnerUid", "LimitedShopInfo", });
emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.getDescriptor(); emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.getDescriptor();
} }

View File

@ -19,16 +19,16 @@ public final class HomeLimitedShopInfoOuterClass {
com.google.protobuf.MessageOrBuilder { com.google.protobuf.MessageOrBuilder {
/** /**
* <code>fixed32 PCECKPDEEBD = 13;</code> * <code>fixed32 end_time = 13;</code>
* @return The pCECKPDEEBD. * @return The endTime.
*/ */
int getPCECKPDEEBD(); int getEndTime();
/** /**
* <code>fixed32 IMBFLHNJAPD = 6;</code> * <code>fixed32 start_time = 6;</code>
* @return The iMBFLHNJAPD. * @return The startTime.
*/ */
int getIMBFLHNJAPD(); int getStartTime();
/** /**
* <code>fixed32 LMJPHDCDAJK = 15;</code> * <code>fixed32 LMJPHDCDAJK = 15;</code>
@ -128,7 +128,7 @@ public final class HomeLimitedShopInfoOuterClass {
} }
case 53: { case 53: {
iMBFLHNJAPD_ = input.readFixed32(); startTime_ = input.readFixed32();
break; break;
} }
case 58: { case 58: {
@ -159,7 +159,7 @@ public final class HomeLimitedShopInfoOuterClass {
} }
case 109: { case 109: {
pCECKPDEEBD_ = input.readFixed32(); endTime_ = input.readFixed32();
break; break;
} }
case 125: { case 125: {
@ -199,26 +199,26 @@ public final class HomeLimitedShopInfoOuterClass {
emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.class, emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.Builder.class); emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.class, emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.Builder.class);
} }
public static final int PCECKPDEEBD_FIELD_NUMBER = 13; public static final int END_TIME_FIELD_NUMBER = 13;
private int pCECKPDEEBD_; private int endTime_;
/** /**
* <code>fixed32 PCECKPDEEBD = 13;</code> * <code>fixed32 end_time = 13;</code>
* @return The pCECKPDEEBD. * @return The endTime.
*/ */
@java.lang.Override @java.lang.Override
public int getPCECKPDEEBD() { public int getEndTime() {
return pCECKPDEEBD_; return endTime_;
} }
public static final int IMBFLHNJAPD_FIELD_NUMBER = 6; public static final int START_TIME_FIELD_NUMBER = 6;
private int iMBFLHNJAPD_; private int startTime_;
/** /**
* <code>fixed32 IMBFLHNJAPD = 6;</code> * <code>fixed32 start_time = 6;</code>
* @return The iMBFLHNJAPD. * @return The startTime.
*/ */
@java.lang.Override @java.lang.Override
public int getIMBFLHNJAPD() { public int getStartTime() {
return iMBFLHNJAPD_; return startTime_;
} }
public static final int LMJPHDCDAJK_FIELD_NUMBER = 15; public static final int LMJPHDCDAJK_FIELD_NUMBER = 15;
@ -312,8 +312,8 @@ public final class HomeLimitedShopInfoOuterClass {
if (uid_ != 0) { if (uid_ != 0) {
output.writeUInt32(2, uid_); output.writeUInt32(2, uid_);
} }
if (iMBFLHNJAPD_ != 0) { if (startTime_ != 0) {
output.writeFixed32(6, iMBFLHNJAPD_); output.writeFixed32(6, startTime_);
} }
if (djinnRot_ != null) { if (djinnRot_ != null) {
output.writeMessage(7, getDjinnRot()); output.writeMessage(7, getDjinnRot());
@ -321,8 +321,8 @@ public final class HomeLimitedShopInfoOuterClass {
if (djinnPos_ != null) { if (djinnPos_ != null) {
output.writeMessage(8, getDjinnPos()); output.writeMessage(8, getDjinnPos());
} }
if (pCECKPDEEBD_ != 0) { if (endTime_ != 0) {
output.writeFixed32(13, pCECKPDEEBD_); output.writeFixed32(13, endTime_);
} }
if (lMJPHDCDAJK_ != 0) { if (lMJPHDCDAJK_ != 0) {
output.writeFixed32(15, lMJPHDCDAJK_); output.writeFixed32(15, lMJPHDCDAJK_);
@ -340,9 +340,9 @@ public final class HomeLimitedShopInfoOuterClass {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(2, uid_); .computeUInt32Size(2, uid_);
} }
if (iMBFLHNJAPD_ != 0) { if (startTime_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeFixed32Size(6, iMBFLHNJAPD_); .computeFixed32Size(6, startTime_);
} }
if (djinnRot_ != null) { if (djinnRot_ != null) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -352,9 +352,9 @@ public final class HomeLimitedShopInfoOuterClass {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(8, getDjinnPos()); .computeMessageSize(8, getDjinnPos());
} }
if (pCECKPDEEBD_ != 0) { if (endTime_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeFixed32Size(13, pCECKPDEEBD_); .computeFixed32Size(13, endTime_);
} }
if (lMJPHDCDAJK_ != 0) { if (lMJPHDCDAJK_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -375,10 +375,10 @@ public final class HomeLimitedShopInfoOuterClass {
} }
emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo other = (emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo) obj; emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo other = (emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo) obj;
if (getPCECKPDEEBD() if (getEndTime()
!= other.getPCECKPDEEBD()) return false; != other.getEndTime()) return false;
if (getIMBFLHNJAPD() if (getStartTime()
!= other.getIMBFLHNJAPD()) return false; != other.getStartTime()) return false;
if (getLMJPHDCDAJK() if (getLMJPHDCDAJK()
!= other.getLMJPHDCDAJK()) return false; != other.getLMJPHDCDAJK()) return false;
if (hasDjinnRot() != other.hasDjinnRot()) return false; if (hasDjinnRot() != other.hasDjinnRot()) return false;
@ -404,10 +404,10 @@ public final class HomeLimitedShopInfoOuterClass {
} }
int hash = 41; int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode(); hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + PCECKPDEEBD_FIELD_NUMBER; hash = (37 * hash) + END_TIME_FIELD_NUMBER;
hash = (53 * hash) + getPCECKPDEEBD(); hash = (53 * hash) + getEndTime();
hash = (37 * hash) + IMBFLHNJAPD_FIELD_NUMBER; hash = (37 * hash) + START_TIME_FIELD_NUMBER;
hash = (53 * hash) + getIMBFLHNJAPD(); hash = (53 * hash) + getStartTime();
hash = (37 * hash) + LMJPHDCDAJK_FIELD_NUMBER; hash = (37 * hash) + LMJPHDCDAJK_FIELD_NUMBER;
hash = (53 * hash) + getLMJPHDCDAJK(); hash = (53 * hash) + getLMJPHDCDAJK();
if (hasDjinnRot()) { if (hasDjinnRot()) {
@ -557,9 +557,9 @@ public final class HomeLimitedShopInfoOuterClass {
@java.lang.Override @java.lang.Override
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
pCECKPDEEBD_ = 0; endTime_ = 0;
iMBFLHNJAPD_ = 0; startTime_ = 0;
lMJPHDCDAJK_ = 0; lMJPHDCDAJK_ = 0;
@ -603,8 +603,8 @@ public final class HomeLimitedShopInfoOuterClass {
@java.lang.Override @java.lang.Override
public emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo buildPartial() { public emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo buildPartial() {
emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo result = new emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo(this); emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo result = new emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo(this);
result.pCECKPDEEBD_ = pCECKPDEEBD_; result.endTime_ = endTime_;
result.iMBFLHNJAPD_ = iMBFLHNJAPD_; result.startTime_ = startTime_;
result.lMJPHDCDAJK_ = lMJPHDCDAJK_; result.lMJPHDCDAJK_ = lMJPHDCDAJK_;
if (djinnRotBuilder_ == null) { if (djinnRotBuilder_ == null) {
result.djinnRot_ = djinnRot_; result.djinnRot_ = djinnRot_;
@ -665,11 +665,11 @@ public final class HomeLimitedShopInfoOuterClass {
public Builder mergeFrom(emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo other) { public Builder mergeFrom(emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo other) {
if (other == emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.getDefaultInstance()) return this; if (other == emu.grasscutter.net.proto.HomeLimitedShopInfoOuterClass.HomeLimitedShopInfo.getDefaultInstance()) return this;
if (other.getPCECKPDEEBD() != 0) { if (other.getEndTime() != 0) {
setPCECKPDEEBD(other.getPCECKPDEEBD()); setEndTime(other.getEndTime());
} }
if (other.getIMBFLHNJAPD() != 0) { if (other.getStartTime() != 0) {
setIMBFLHNJAPD(other.getIMBFLHNJAPD()); setStartTime(other.getStartTime());
} }
if (other.getLMJPHDCDAJK() != 0) { if (other.getLMJPHDCDAJK() != 0) {
setLMJPHDCDAJK(other.getLMJPHDCDAJK()); setLMJPHDCDAJK(other.getLMJPHDCDAJK());
@ -712,64 +712,64 @@ public final class HomeLimitedShopInfoOuterClass {
return this; return this;
} }
private int pCECKPDEEBD_ ; private int endTime_ ;
/** /**
* <code>fixed32 PCECKPDEEBD = 13;</code> * <code>fixed32 end_time = 13;</code>
* @return The pCECKPDEEBD. * @return The endTime.
*/ */
@java.lang.Override @java.lang.Override
public int getPCECKPDEEBD() { public int getEndTime() {
return pCECKPDEEBD_; return endTime_;
} }
/** /**
* <code>fixed32 PCECKPDEEBD = 13;</code> * <code>fixed32 end_time = 13;</code>
* @param value The pCECKPDEEBD to set. * @param value The endTime to set.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder setPCECKPDEEBD(int value) { public Builder setEndTime(int value) {
pCECKPDEEBD_ = value; endTime_ = value;
onChanged(); onChanged();
return this; return this;
} }
/** /**
* <code>fixed32 PCECKPDEEBD = 13;</code> * <code>fixed32 end_time = 13;</code>
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder clearPCECKPDEEBD() { public Builder clearEndTime() {
pCECKPDEEBD_ = 0; endTime_ = 0;
onChanged(); onChanged();
return this; return this;
} }
private int iMBFLHNJAPD_ ; private int startTime_ ;
/** /**
* <code>fixed32 IMBFLHNJAPD = 6;</code> * <code>fixed32 start_time = 6;</code>
* @return The iMBFLHNJAPD. * @return The startTime.
*/ */
@java.lang.Override @java.lang.Override
public int getIMBFLHNJAPD() { public int getStartTime() {
return iMBFLHNJAPD_; return startTime_;
} }
/** /**
* <code>fixed32 IMBFLHNJAPD = 6;</code> * <code>fixed32 start_time = 6;</code>
* @param value The iMBFLHNJAPD to set. * @param value The startTime to set.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder setIMBFLHNJAPD(int value) { public Builder setStartTime(int value) {
iMBFLHNJAPD_ = value; startTime_ = value;
onChanged(); onChanged();
return this; return this;
} }
/** /**
* <code>fixed32 IMBFLHNJAPD = 6;</code> * <code>fixed32 start_time = 6;</code>
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder clearIMBFLHNJAPD() { public Builder clearStartTime() {
iMBFLHNJAPD_ = 0; startTime_ = 0;
onChanged(); onChanged();
return this; return this;
} }
@ -1141,11 +1141,11 @@ public final class HomeLimitedShopInfoOuterClass {
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\031HomeLimitedShopInfo.proto\032\014Vector.prot" + "\n\031HomeLimitedShopInfo.proto\032\014Vector.prot" +
"o\"\231\001\n\023HomeLimitedShopInfo\022\023\n\013PCECKPDEEBD" + "o\"\225\001\n\023HomeLimitedShopInfo\022\020\n\010end_time\030\r " +
"\030\r \001(\007\022\023\n\013IMBFLHNJAPD\030\006 \001(\007\022\023\n\013LMJPHDCDA" + "\001(\007\022\022\n\nstart_time\030\006 \001(\007\022\023\n\013LMJPHDCDAJK\030\017" +
"JK\030\017 \001(\007\022\032\n\tdjinn_rot\030\007 \001(\0132\007.Vector\022\032\n\t" + " \001(\007\022\032\n\tdjinn_rot\030\007 \001(\0132\007.Vector\022\032\n\tdjin" +
"djinn_pos\030\010 \001(\0132\007.Vector\022\013\n\003uid\030\002 \001(\rB\033\n" + "n_pos\030\010 \001(\0132\007.Vector\022\013\n\003uid\030\002 \001(\rB\033\n\031emu" +
"\031emu.grasscutter.net.protob\006proto3" ".grasscutter.net.protob\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData, .internalBuildGeneratedFileFrom(descriptorData,
@ -1157,7 +1157,7 @@ public final class HomeLimitedShopInfoOuterClass {
internal_static_HomeLimitedShopInfo_fieldAccessorTable = new internal_static_HomeLimitedShopInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_HomeLimitedShopInfo_descriptor, internal_static_HomeLimitedShopInfo_descriptor,
new java.lang.String[] { "PCECKPDEEBD", "IMBFLHNJAPD", "LMJPHDCDAJK", "DjinnRot", "DjinnPos", "Uid", }); new java.lang.String[] { "EndTime", "StartTime", "LMJPHDCDAJK", "DjinnRot", "DjinnPos", "Uid", });
emu.grasscutter.net.proto.VectorOuterClass.getDescriptor(); emu.grasscutter.net.proto.VectorOuterClass.getDescriptor();
} }

View File

@ -43,19 +43,19 @@ public final class HomeMarkPointSceneDataOuterClass {
int index); int index);
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
* @return Whether the teapotSpiritPos field is set. * @return Whether the safePointPos field is set.
*/ */
boolean hasTeapotSpiritPos(); boolean hasSafePointPos();
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
* @return The teapotSpiritPos. * @return The safePointPos.
*/ */
emu.grasscutter.net.proto.VectorOuterClass.Vector getTeapotSpiritPos(); emu.grasscutter.net.proto.VectorOuterClass.Vector getSafePointPos();
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getTeapotSpiritPosOrBuilder(); emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getSafePointPosOrBuilder();
/** /**
* <code>uint32 module_id = 9;</code> * <code>uint32 module_id = 9;</code>
@ -70,19 +70,19 @@ public final class HomeMarkPointSceneDataOuterClass {
int getSceneId(); int getSceneId();
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
* @return Whether the safePointPos field is set. * @return Whether the teapotSpiritPos field is set.
*/ */
boolean hasSafePointPos(); boolean hasTeapotSpiritPos();
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
* @return The safePointPos. * @return The teapotSpiritPos.
*/ */
emu.grasscutter.net.proto.VectorOuterClass.Vector getSafePointPos(); emu.grasscutter.net.proto.VectorOuterClass.Vector getTeapotSpiritPos();
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getSafePointPosOrBuilder(); emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getTeapotSpiritPosOrBuilder();
} }
/** /**
* <pre> * <pre>
@ -137,13 +137,13 @@ public final class HomeMarkPointSceneDataOuterClass {
break; break;
case 26: { case 26: {
emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder subBuilder = null; emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder subBuilder = null;
if (safePointPos_ != null) { if (teapotSpiritPos_ != null) {
subBuilder = safePointPos_.toBuilder(); subBuilder = teapotSpiritPos_.toBuilder();
} }
safePointPos_ = input.readMessage(emu.grasscutter.net.proto.VectorOuterClass.Vector.parser(), extensionRegistry); teapotSpiritPos_ = input.readMessage(emu.grasscutter.net.proto.VectorOuterClass.Vector.parser(), extensionRegistry);
if (subBuilder != null) { if (subBuilder != null) {
subBuilder.mergeFrom(safePointPos_); subBuilder.mergeFrom(teapotSpiritPos_);
safePointPos_ = subBuilder.buildPartial(); teapotSpiritPos_ = subBuilder.buildPartial();
} }
break; break;
@ -164,13 +164,13 @@ public final class HomeMarkPointSceneDataOuterClass {
} }
case 66: { case 66: {
emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder subBuilder = null; emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder subBuilder = null;
if (teapotSpiritPos_ != null) { if (safePointPos_ != null) {
subBuilder = teapotSpiritPos_.toBuilder(); subBuilder = safePointPos_.toBuilder();
} }
teapotSpiritPos_ = input.readMessage(emu.grasscutter.net.proto.VectorOuterClass.Vector.parser(), extensionRegistry); safePointPos_ = input.readMessage(emu.grasscutter.net.proto.VectorOuterClass.Vector.parser(), extensionRegistry);
if (subBuilder != null) { if (subBuilder != null) {
subBuilder.mergeFrom(teapotSpiritPos_); subBuilder.mergeFrom(safePointPos_);
teapotSpiritPos_ = subBuilder.buildPartial(); safePointPos_ = subBuilder.buildPartial();
} }
break; break;
@ -255,30 +255,30 @@ public final class HomeMarkPointSceneDataOuterClass {
return furnitureList_.get(index); return furnitureList_.get(index);
} }
public static final int TEAPOT_SPIRIT_POS_FIELD_NUMBER = 8; public static final int SAFE_POINT_POS_FIELD_NUMBER = 8;
private emu.grasscutter.net.proto.VectorOuterClass.Vector teapotSpiritPos_; private emu.grasscutter.net.proto.VectorOuterClass.Vector safePointPos_;
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
* @return Whether the teapotSpiritPos field is set. * @return Whether the safePointPos field is set.
*/ */
@java.lang.Override @java.lang.Override
public boolean hasTeapotSpiritPos() { public boolean hasSafePointPos() {
return teapotSpiritPos_ != null; return safePointPos_ != null;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
* @return The teapotSpiritPos. * @return The safePointPos.
*/ */
@java.lang.Override @java.lang.Override
public emu.grasscutter.net.proto.VectorOuterClass.Vector getTeapotSpiritPos() { public emu.grasscutter.net.proto.VectorOuterClass.Vector getSafePointPos() {
return teapotSpiritPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : teapotSpiritPos_; return safePointPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : safePointPos_;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
@java.lang.Override @java.lang.Override
public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getTeapotSpiritPosOrBuilder() { public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getSafePointPosOrBuilder() {
return getTeapotSpiritPos(); return getSafePointPos();
} }
public static final int MODULE_ID_FIELD_NUMBER = 9; public static final int MODULE_ID_FIELD_NUMBER = 9;
@ -303,30 +303,30 @@ public final class HomeMarkPointSceneDataOuterClass {
return sceneId_; return sceneId_;
} }
public static final int SAFE_POINT_POS_FIELD_NUMBER = 3; public static final int TEAPOT_SPIRIT_POS_FIELD_NUMBER = 3;
private emu.grasscutter.net.proto.VectorOuterClass.Vector safePointPos_; private emu.grasscutter.net.proto.VectorOuterClass.Vector teapotSpiritPos_;
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
* @return Whether the safePointPos field is set. * @return Whether the teapotSpiritPos field is set.
*/ */
@java.lang.Override @java.lang.Override
public boolean hasSafePointPos() { public boolean hasTeapotSpiritPos() {
return safePointPos_ != null; return teapotSpiritPos_ != null;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
* @return The safePointPos. * @return The teapotSpiritPos.
*/ */
@java.lang.Override @java.lang.Override
public emu.grasscutter.net.proto.VectorOuterClass.Vector getSafePointPos() { public emu.grasscutter.net.proto.VectorOuterClass.Vector getTeapotSpiritPos() {
return safePointPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : safePointPos_; return teapotSpiritPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : teapotSpiritPos_;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
@java.lang.Override @java.lang.Override
public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getSafePointPosOrBuilder() { public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getTeapotSpiritPosOrBuilder() {
return getSafePointPos(); return getTeapotSpiritPos();
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
@ -343,8 +343,8 @@ public final class HomeMarkPointSceneDataOuterClass {
@java.lang.Override @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException { throws java.io.IOException {
if (safePointPos_ != null) { if (teapotSpiritPos_ != null) {
output.writeMessage(3, getSafePointPos()); output.writeMessage(3, getTeapotSpiritPos());
} }
if (sceneId_ != 0) { if (sceneId_ != 0) {
output.writeUInt32(5, sceneId_); output.writeUInt32(5, sceneId_);
@ -352,8 +352,8 @@ public final class HomeMarkPointSceneDataOuterClass {
for (int i = 0; i < furnitureList_.size(); i++) { for (int i = 0; i < furnitureList_.size(); i++) {
output.writeMessage(7, furnitureList_.get(i)); output.writeMessage(7, furnitureList_.get(i));
} }
if (teapotSpiritPos_ != null) { if (safePointPos_ != null) {
output.writeMessage(8, getTeapotSpiritPos()); output.writeMessage(8, getSafePointPos());
} }
if (moduleId_ != 0) { if (moduleId_ != 0) {
output.writeUInt32(9, moduleId_); output.writeUInt32(9, moduleId_);
@ -367,9 +367,9 @@ public final class HomeMarkPointSceneDataOuterClass {
if (size != -1) return size; if (size != -1) return size;
size = 0; size = 0;
if (safePointPos_ != null) { if (teapotSpiritPos_ != null) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getSafePointPos()); .computeMessageSize(3, getTeapotSpiritPos());
} }
if (sceneId_ != 0) { if (sceneId_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -379,9 +379,9 @@ public final class HomeMarkPointSceneDataOuterClass {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(7, furnitureList_.get(i)); .computeMessageSize(7, furnitureList_.get(i));
} }
if (teapotSpiritPos_ != null) { if (safePointPos_ != null) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeMessageSize(8, getTeapotSpiritPos()); .computeMessageSize(8, getSafePointPos());
} }
if (moduleId_ != 0) { if (moduleId_ != 0) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -404,19 +404,19 @@ public final class HomeMarkPointSceneDataOuterClass {
if (!getFurnitureListList() if (!getFurnitureListList()
.equals(other.getFurnitureListList())) return false; .equals(other.getFurnitureListList())) return false;
if (hasTeapotSpiritPos() != other.hasTeapotSpiritPos()) return false; if (hasSafePointPos() != other.hasSafePointPos()) return false;
if (hasTeapotSpiritPos()) { if (hasSafePointPos()) {
if (!getTeapotSpiritPos() if (!getSafePointPos()
.equals(other.getTeapotSpiritPos())) return false; .equals(other.getSafePointPos())) return false;
} }
if (getModuleId() if (getModuleId()
!= other.getModuleId()) return false; != other.getModuleId()) return false;
if (getSceneId() if (getSceneId()
!= other.getSceneId()) return false; != other.getSceneId()) return false;
if (hasSafePointPos() != other.hasSafePointPos()) return false; if (hasTeapotSpiritPos() != other.hasTeapotSpiritPos()) return false;
if (hasSafePointPos()) { if (hasTeapotSpiritPos()) {
if (!getSafePointPos() if (!getTeapotSpiritPos()
.equals(other.getSafePointPos())) return false; .equals(other.getTeapotSpiritPos())) return false;
} }
if (!unknownFields.equals(other.unknownFields)) return false; if (!unknownFields.equals(other.unknownFields)) return false;
return true; return true;
@ -433,17 +433,17 @@ public final class HomeMarkPointSceneDataOuterClass {
hash = (37 * hash) + FURNITURE_LIST_FIELD_NUMBER; hash = (37 * hash) + FURNITURE_LIST_FIELD_NUMBER;
hash = (53 * hash) + getFurnitureListList().hashCode(); hash = (53 * hash) + getFurnitureListList().hashCode();
} }
if (hasTeapotSpiritPos()) { if (hasSafePointPos()) {
hash = (37 * hash) + TEAPOT_SPIRIT_POS_FIELD_NUMBER; hash = (37 * hash) + SAFE_POINT_POS_FIELD_NUMBER;
hash = (53 * hash) + getTeapotSpiritPos().hashCode(); hash = (53 * hash) + getSafePointPos().hashCode();
} }
hash = (37 * hash) + MODULE_ID_FIELD_NUMBER; hash = (37 * hash) + MODULE_ID_FIELD_NUMBER;
hash = (53 * hash) + getModuleId(); hash = (53 * hash) + getModuleId();
hash = (37 * hash) + SCENE_ID_FIELD_NUMBER; hash = (37 * hash) + SCENE_ID_FIELD_NUMBER;
hash = (53 * hash) + getSceneId(); hash = (53 * hash) + getSceneId();
if (hasSafePointPos()) { if (hasTeapotSpiritPos()) {
hash = (37 * hash) + SAFE_POINT_POS_FIELD_NUMBER; hash = (37 * hash) + TEAPOT_SPIRIT_POS_FIELD_NUMBER;
hash = (53 * hash) + getSafePointPos().hashCode(); hash = (53 * hash) + getTeapotSpiritPos().hashCode();
} }
hash = (29 * hash) + unknownFields.hashCode(); hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash; memoizedHashCode = hash;
@ -589,22 +589,22 @@ public final class HomeMarkPointSceneDataOuterClass {
} else { } else {
furnitureListBuilder_.clear(); furnitureListBuilder_.clear();
} }
if (teapotSpiritPosBuilder_ == null) {
teapotSpiritPos_ = null;
} else {
teapotSpiritPos_ = null;
teapotSpiritPosBuilder_ = null;
}
moduleId_ = 0;
sceneId_ = 0;
if (safePointPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
safePointPos_ = null; safePointPos_ = null;
} else { } else {
safePointPos_ = null; safePointPos_ = null;
safePointPosBuilder_ = null; safePointPosBuilder_ = null;
} }
moduleId_ = 0;
sceneId_ = 0;
if (teapotSpiritPosBuilder_ == null) {
teapotSpiritPos_ = null;
} else {
teapotSpiritPos_ = null;
teapotSpiritPosBuilder_ = null;
}
return this; return this;
} }
@ -641,18 +641,18 @@ public final class HomeMarkPointSceneDataOuterClass {
} else { } else {
result.furnitureList_ = furnitureListBuilder_.build(); result.furnitureList_ = furnitureListBuilder_.build();
} }
if (teapotSpiritPosBuilder_ == null) {
result.teapotSpiritPos_ = teapotSpiritPos_;
} else {
result.teapotSpiritPos_ = teapotSpiritPosBuilder_.build();
}
result.moduleId_ = moduleId_;
result.sceneId_ = sceneId_;
if (safePointPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
result.safePointPos_ = safePointPos_; result.safePointPos_ = safePointPos_;
} else { } else {
result.safePointPos_ = safePointPosBuilder_.build(); result.safePointPos_ = safePointPosBuilder_.build();
} }
result.moduleId_ = moduleId_;
result.sceneId_ = sceneId_;
if (teapotSpiritPosBuilder_ == null) {
result.teapotSpiritPos_ = teapotSpiritPos_;
} else {
result.teapotSpiritPos_ = teapotSpiritPosBuilder_.build();
}
onBuilt(); onBuilt();
return result; return result;
} }
@ -727,8 +727,8 @@ public final class HomeMarkPointSceneDataOuterClass {
} }
} }
} }
if (other.hasTeapotSpiritPos()) { if (other.hasSafePointPos()) {
mergeTeapotSpiritPos(other.getTeapotSpiritPos()); mergeSafePointPos(other.getSafePointPos());
} }
if (other.getModuleId() != 0) { if (other.getModuleId() != 0) {
setModuleId(other.getModuleId()); setModuleId(other.getModuleId());
@ -736,8 +736,8 @@ public final class HomeMarkPointSceneDataOuterClass {
if (other.getSceneId() != 0) { if (other.getSceneId() != 0) {
setSceneId(other.getSceneId()); setSceneId(other.getSceneId());
} }
if (other.hasSafePointPos()) { if (other.hasTeapotSpiritPos()) {
mergeSafePointPos(other.getSafePointPos()); mergeTeapotSpiritPos(other.getTeapotSpiritPos());
} }
this.mergeUnknownFields(other.unknownFields); this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
@ -1009,123 +1009,123 @@ public final class HomeMarkPointSceneDataOuterClass {
return furnitureListBuilder_; return furnitureListBuilder_;
} }
private emu.grasscutter.net.proto.VectorOuterClass.Vector teapotSpiritPos_; private emu.grasscutter.net.proto.VectorOuterClass.Vector safePointPos_;
private com.google.protobuf.SingleFieldBuilderV3< private com.google.protobuf.SingleFieldBuilderV3<
emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> teapotSpiritPosBuilder_; emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> safePointPosBuilder_;
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
* @return Whether the teapotSpiritPos field is set. * @return Whether the safePointPos field is set.
*/ */
public boolean hasTeapotSpiritPos() { public boolean hasSafePointPos() {
return teapotSpiritPosBuilder_ != null || teapotSpiritPos_ != null; return safePointPosBuilder_ != null || safePointPos_ != null;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
* @return The teapotSpiritPos. * @return The safePointPos.
*/ */
public emu.grasscutter.net.proto.VectorOuterClass.Vector getTeapotSpiritPos() { public emu.grasscutter.net.proto.VectorOuterClass.Vector getSafePointPos() {
if (teapotSpiritPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
return teapotSpiritPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : teapotSpiritPos_; return safePointPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : safePointPos_;
} else { } else {
return teapotSpiritPosBuilder_.getMessage(); return safePointPosBuilder_.getMessage();
} }
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
public Builder setTeapotSpiritPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) { public Builder setSafePointPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) {
if (teapotSpiritPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
teapotSpiritPos_ = value; safePointPos_ = value;
onChanged(); onChanged();
} else { } else {
teapotSpiritPosBuilder_.setMessage(value); safePointPosBuilder_.setMessage(value);
} }
return this; return this;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
public Builder setTeapotSpiritPos( public Builder setSafePointPos(
emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder builderForValue) { emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder builderForValue) {
if (teapotSpiritPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
teapotSpiritPos_ = builderForValue.build(); safePointPos_ = builderForValue.build();
onChanged(); onChanged();
} else { } else {
teapotSpiritPosBuilder_.setMessage(builderForValue.build()); safePointPosBuilder_.setMessage(builderForValue.build());
} }
return this; return this;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
public Builder mergeTeapotSpiritPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) { public Builder mergeSafePointPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) {
if (teapotSpiritPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
if (teapotSpiritPos_ != null) { if (safePointPos_ != null) {
teapotSpiritPos_ = safePointPos_ =
emu.grasscutter.net.proto.VectorOuterClass.Vector.newBuilder(teapotSpiritPos_).mergeFrom(value).buildPartial(); emu.grasscutter.net.proto.VectorOuterClass.Vector.newBuilder(safePointPos_).mergeFrom(value).buildPartial();
} else { } else {
teapotSpiritPos_ = value; safePointPos_ = value;
} }
onChanged(); onChanged();
} else { } else {
teapotSpiritPosBuilder_.mergeFrom(value); safePointPosBuilder_.mergeFrom(value);
} }
return this; return this;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
public Builder clearTeapotSpiritPos() { public Builder clearSafePointPos() {
if (teapotSpiritPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
teapotSpiritPos_ = null; safePointPos_ = null;
onChanged(); onChanged();
} else { } else {
teapotSpiritPos_ = null; safePointPos_ = null;
teapotSpiritPosBuilder_ = null; safePointPosBuilder_ = null;
} }
return this; return this;
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
public emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder getTeapotSpiritPosBuilder() { public emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder getSafePointPosBuilder() {
onChanged(); onChanged();
return getTeapotSpiritPosFieldBuilder().getBuilder(); return getSafePointPosFieldBuilder().getBuilder();
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getTeapotSpiritPosOrBuilder() { public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getSafePointPosOrBuilder() {
if (teapotSpiritPosBuilder_ != null) { if (safePointPosBuilder_ != null) {
return teapotSpiritPosBuilder_.getMessageOrBuilder(); return safePointPosBuilder_.getMessageOrBuilder();
} else { } else {
return teapotSpiritPos_ == null ? return safePointPos_ == null ?
emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : teapotSpiritPos_; emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : safePointPos_;
} }
} }
/** /**
* <code>.Vector teapot_spirit_pos = 8;</code> * <code>.Vector safe_point_pos = 8;</code>
*/ */
private com.google.protobuf.SingleFieldBuilderV3< private com.google.protobuf.SingleFieldBuilderV3<
emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>
getTeapotSpiritPosFieldBuilder() { getSafePointPosFieldBuilder() {
if (teapotSpiritPosBuilder_ == null) { if (safePointPosBuilder_ == null) {
teapotSpiritPosBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< safePointPosBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>( emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>(
getTeapotSpiritPos(), getSafePointPos(),
getParentForChildren(), getParentForChildren(),
isClean()); isClean());
teapotSpiritPos_ = null; safePointPos_ = null;
} }
return teapotSpiritPosBuilder_; return safePointPosBuilder_;
} }
private int moduleId_ ; private int moduleId_ ;
@ -1190,123 +1190,123 @@ public final class HomeMarkPointSceneDataOuterClass {
return this; return this;
} }
private emu.grasscutter.net.proto.VectorOuterClass.Vector safePointPos_; private emu.grasscutter.net.proto.VectorOuterClass.Vector teapotSpiritPos_;
private com.google.protobuf.SingleFieldBuilderV3< private com.google.protobuf.SingleFieldBuilderV3<
emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> safePointPosBuilder_; emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> teapotSpiritPosBuilder_;
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
* @return Whether the safePointPos field is set. * @return Whether the teapotSpiritPos field is set.
*/ */
public boolean hasSafePointPos() { public boolean hasTeapotSpiritPos() {
return safePointPosBuilder_ != null || safePointPos_ != null; return teapotSpiritPosBuilder_ != null || teapotSpiritPos_ != null;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
* @return The safePointPos. * @return The teapotSpiritPos.
*/ */
public emu.grasscutter.net.proto.VectorOuterClass.Vector getSafePointPos() { public emu.grasscutter.net.proto.VectorOuterClass.Vector getTeapotSpiritPos() {
if (safePointPosBuilder_ == null) { if (teapotSpiritPosBuilder_ == null) {
return safePointPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : safePointPos_; return teapotSpiritPos_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : teapotSpiritPos_;
} else { } else {
return safePointPosBuilder_.getMessage(); return teapotSpiritPosBuilder_.getMessage();
} }
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
public Builder setSafePointPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) { public Builder setTeapotSpiritPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) {
if (safePointPosBuilder_ == null) { if (teapotSpiritPosBuilder_ == null) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
safePointPos_ = value; teapotSpiritPos_ = value;
onChanged(); onChanged();
} else { } else {
safePointPosBuilder_.setMessage(value); teapotSpiritPosBuilder_.setMessage(value);
} }
return this; return this;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
public Builder setSafePointPos( public Builder setTeapotSpiritPos(
emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder builderForValue) { emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder builderForValue) {
if (safePointPosBuilder_ == null) { if (teapotSpiritPosBuilder_ == null) {
safePointPos_ = builderForValue.build(); teapotSpiritPos_ = builderForValue.build();
onChanged(); onChanged();
} else { } else {
safePointPosBuilder_.setMessage(builderForValue.build()); teapotSpiritPosBuilder_.setMessage(builderForValue.build());
} }
return this; return this;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
public Builder mergeSafePointPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) { public Builder mergeTeapotSpiritPos(emu.grasscutter.net.proto.VectorOuterClass.Vector value) {
if (safePointPosBuilder_ == null) { if (teapotSpiritPosBuilder_ == null) {
if (safePointPos_ != null) { if (teapotSpiritPos_ != null) {
safePointPos_ = teapotSpiritPos_ =
emu.grasscutter.net.proto.VectorOuterClass.Vector.newBuilder(safePointPos_).mergeFrom(value).buildPartial(); emu.grasscutter.net.proto.VectorOuterClass.Vector.newBuilder(teapotSpiritPos_).mergeFrom(value).buildPartial();
} else { } else {
safePointPos_ = value; teapotSpiritPos_ = value;
} }
onChanged(); onChanged();
} else { } else {
safePointPosBuilder_.mergeFrom(value); teapotSpiritPosBuilder_.mergeFrom(value);
} }
return this; return this;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
public Builder clearSafePointPos() { public Builder clearTeapotSpiritPos() {
if (safePointPosBuilder_ == null) { if (teapotSpiritPosBuilder_ == null) {
safePointPos_ = null; teapotSpiritPos_ = null;
onChanged(); onChanged();
} else { } else {
safePointPos_ = null; teapotSpiritPos_ = null;
safePointPosBuilder_ = null; teapotSpiritPosBuilder_ = null;
} }
return this; return this;
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
public emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder getSafePointPosBuilder() { public emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder getTeapotSpiritPosBuilder() {
onChanged(); onChanged();
return getSafePointPosFieldBuilder().getBuilder(); return getTeapotSpiritPosFieldBuilder().getBuilder();
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getSafePointPosOrBuilder() { public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getTeapotSpiritPosOrBuilder() {
if (safePointPosBuilder_ != null) { if (teapotSpiritPosBuilder_ != null) {
return safePointPosBuilder_.getMessageOrBuilder(); return teapotSpiritPosBuilder_.getMessageOrBuilder();
} else { } else {
return safePointPos_ == null ? return teapotSpiritPos_ == null ?
emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : safePointPos_; emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : teapotSpiritPos_;
} }
} }
/** /**
* <code>.Vector safe_point_pos = 3;</code> * <code>.Vector teapot_spirit_pos = 3;</code>
*/ */
private com.google.protobuf.SingleFieldBuilderV3< private com.google.protobuf.SingleFieldBuilderV3<
emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>
getSafePointPosFieldBuilder() { getTeapotSpiritPosFieldBuilder() {
if (safePointPosBuilder_ == null) { if (teapotSpiritPosBuilder_ == null) {
safePointPosBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< teapotSpiritPosBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>( emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>(
getSafePointPos(), getTeapotSpiritPos(),
getParentForChildren(), getParentForChildren(),
isClean()); isClean());
safePointPos_ = null; teapotSpiritPos_ = null;
} }
return safePointPosBuilder_; return teapotSpiritPosBuilder_;
} }
@java.lang.Override @java.lang.Override
public final Builder setUnknownFields( public final Builder setUnknownFields(
@ -1378,10 +1378,10 @@ public final class HomeMarkPointSceneDataOuterClass {
"\n\034HomeMarkPointSceneData.proto\032 HomeMark" + "\n\034HomeMarkPointSceneData.proto\032 HomeMark" +
"PointFurnitureData.proto\032\014Vector.proto\"\267" + "PointFurnitureData.proto\032\014Vector.proto\"\267" +
"\001\n\026HomeMarkPointSceneData\0223\n\016furniture_l" + "\001\n\026HomeMarkPointSceneData\0223\n\016furniture_l" +
"ist\030\007 \003(\0132\033.HomeMarkPointFurnitureData\022\"" + "ist\030\007 \003(\0132\033.HomeMarkPointFurnitureData\022\037" +
"\n\021teapot_spirit_pos\030\010 \001(\0132\007.Vector\022\021\n\tmo" + "\n\016safe_point_pos\030\010 \001(\0132\007.Vector\022\021\n\tmodul" +
"dule_id\030\t \001(\r\022\020\n\010scene_id\030\005 \001(\r\022\037\n\016safe_" + "e_id\030\t \001(\r\022\020\n\010scene_id\030\005 \001(\r\022\"\n\021teapot_s" +
"point_pos\030\003 \001(\0132\007.VectorB\033\n\031emu.grasscut" + "pirit_pos\030\003 \001(\0132\007.VectorB\033\n\031emu.grasscut" +
"ter.net.protob\006proto3" "ter.net.protob\006proto3"
}; };
descriptor = com.google.protobuf.Descriptors.FileDescriptor descriptor = com.google.protobuf.Descriptors.FileDescriptor
@ -1395,7 +1395,7 @@ public final class HomeMarkPointSceneDataOuterClass {
internal_static_HomeMarkPointSceneData_fieldAccessorTable = new internal_static_HomeMarkPointSceneData_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_HomeMarkPointSceneData_descriptor, internal_static_HomeMarkPointSceneData_descriptor,
new java.lang.String[] { "FurnitureList", "TeapotSpiritPos", "ModuleId", "SceneId", "SafePointPos", }); new java.lang.String[] { "FurnitureList", "SafePointPos", "ModuleId", "SceneId", "TeapotSpiritPos", });
emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass.getDescriptor(); emu.grasscutter.net.proto.HomeMarkPointFurnitureDataOuterClass.getDescriptor();
emu.grasscutter.net.proto.VectorOuterClass.getDescriptor(); emu.grasscutter.net.proto.VectorOuterClass.getDescriptor();
} }

View File

@ -19,39 +19,39 @@ public final class PlayerHomeCompInfoOuterClass {
com.google.protobuf.MessageOrBuilder { com.google.protobuf.MessageOrBuilder {
/** /**
* <code>repeated uint32 unlocked_module_id_list = 3;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return A list containing the unlockedModuleIdList.
*/
java.util.List<java.lang.Integer> getUnlockedModuleIdListList();
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @return The count of unlockedModuleIdList.
*/
int getUnlockedModuleIdListCount();
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @param index The index of the element to return.
* @return The unlockedModuleIdList at the given index.
*/
int getUnlockedModuleIdList(int index);
/**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code>
* @return A list containing the levelupRewardGotLevelList. * @return A list containing the levelupRewardGotLevelList.
*/ */
java.util.List<java.lang.Integer> getLevelupRewardGotLevelListList(); java.util.List<java.lang.Integer> getLevelupRewardGotLevelListList();
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return The count of levelupRewardGotLevelList. * @return The count of levelupRewardGotLevelList.
*/ */
int getLevelupRewardGotLevelListCount(); int getLevelupRewardGotLevelListCount();
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @param index The index of the element to return. * @param index The index of the element to return.
* @return The levelupRewardGotLevelList at the given index. * @return The levelupRewardGotLevelList at the given index.
*/ */
int getLevelupRewardGotLevelList(int index); int getLevelupRewardGotLevelList(int index);
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return A list containing the unlockedModuleIdList.
*/
java.util.List<java.lang.Integer> getUnlockedModuleIdListList();
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return The count of unlockedModuleIdList.
*/
int getUnlockedModuleIdListCount();
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @param index The index of the element to return.
* @return The unlockedModuleIdList at the given index.
*/
int getUnlockedModuleIdList(int index);
/** /**
* <code>repeated uint32 seen_module_id_list = 8;</code> * <code>repeated uint32 seen_module_id_list = 8;</code>
* @return A list containing the seenModuleIdList. * @return A list containing the seenModuleIdList.
@ -97,8 +97,8 @@ public final class PlayerHomeCompInfoOuterClass {
super(builder); super(builder);
} }
private PlayerHomeCompInfo() { private PlayerHomeCompInfo() {
unlockedModuleIdList_ = emptyIntList();
levelupRewardGotLevelList_ = emptyIntList(); levelupRewardGotLevelList_ = emptyIntList();
unlockedModuleIdList_ = emptyIntList();
seenModuleIdList_ = emptyIntList(); seenModuleIdList_ = emptyIntList();
friendEnterHomeOption_ = 0; friendEnterHomeOption_ = 0;
} }
@ -136,21 +136,21 @@ public final class PlayerHomeCompInfoOuterClass {
break; break;
case 24: { case 24: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) { if (!((mutable_bitField0_ & 0x00000001) != 0)) {
unlockedModuleIdList_ = newIntList(); levelupRewardGotLevelList_ = newIntList();
mutable_bitField0_ |= 0x00000001; mutable_bitField0_ |= 0x00000001;
} }
unlockedModuleIdList_.addInt(input.readUInt32()); levelupRewardGotLevelList_.addInt(input.readUInt32());
break; break;
} }
case 26: { case 26: {
int length = input.readRawVarint32(); int length = input.readRawVarint32();
int limit = input.pushLimit(length); int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
unlockedModuleIdList_ = newIntList(); levelupRewardGotLevelList_ = newIntList();
mutable_bitField0_ |= 0x00000001; mutable_bitField0_ |= 0x00000001;
} }
while (input.getBytesUntilLimit() > 0) { while (input.getBytesUntilLimit() > 0) {
unlockedModuleIdList_.addInt(input.readUInt32()); levelupRewardGotLevelList_.addInt(input.readUInt32());
} }
input.popLimit(limit); input.popLimit(limit);
break; break;
@ -178,21 +178,21 @@ public final class PlayerHomeCompInfoOuterClass {
} }
case 80: { case 80: {
if (!((mutable_bitField0_ & 0x00000002) != 0)) { if (!((mutable_bitField0_ & 0x00000002) != 0)) {
levelupRewardGotLevelList_ = newIntList(); unlockedModuleIdList_ = newIntList();
mutable_bitField0_ |= 0x00000002; mutable_bitField0_ |= 0x00000002;
} }
levelupRewardGotLevelList_.addInt(input.readUInt32()); unlockedModuleIdList_.addInt(input.readUInt32());
break; break;
} }
case 82: { case 82: {
int length = input.readRawVarint32(); int length = input.readRawVarint32();
int limit = input.pushLimit(length); int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) {
levelupRewardGotLevelList_ = newIntList(); unlockedModuleIdList_ = newIntList();
mutable_bitField0_ |= 0x00000002; mutable_bitField0_ |= 0x00000002;
} }
while (input.getBytesUntilLimit() > 0) { while (input.getBytesUntilLimit() > 0) {
levelupRewardGotLevelList_.addInt(input.readUInt32()); unlockedModuleIdList_.addInt(input.readUInt32());
} }
input.popLimit(limit); input.popLimit(limit);
break; break;
@ -219,13 +219,13 @@ public final class PlayerHomeCompInfoOuterClass {
e).setUnfinishedMessage(this); e).setUnfinishedMessage(this);
} finally { } finally {
if (((mutable_bitField0_ & 0x00000001) != 0)) { if (((mutable_bitField0_ & 0x00000001) != 0)) {
unlockedModuleIdList_.makeImmutable(); // C levelupRewardGotLevelList_.makeImmutable(); // C
} }
if (((mutable_bitField0_ & 0x00000004) != 0)) { if (((mutable_bitField0_ & 0x00000004) != 0)) {
seenModuleIdList_.makeImmutable(); // C seenModuleIdList_.makeImmutable(); // C
} }
if (((mutable_bitField0_ & 0x00000002) != 0)) { if (((mutable_bitField0_ & 0x00000002) != 0)) {
levelupRewardGotLevelList_.makeImmutable(); // C unlockedModuleIdList_.makeImmutable(); // C
} }
this.unknownFields = unknownFields.build(); this.unknownFields = unknownFields.build();
makeExtensionsImmutable(); makeExtensionsImmutable();
@ -244,38 +244,10 @@ public final class PlayerHomeCompInfoOuterClass {
emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.class, emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.Builder.class); emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.class, emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.Builder.class);
} }
public static final int UNLOCKED_MODULE_ID_LIST_FIELD_NUMBER = 3; public static final int LEVELUP_REWARD_GOT_LEVEL_LIST_FIELD_NUMBER = 3;
private com.google.protobuf.Internal.IntList unlockedModuleIdList_;
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @return A list containing the unlockedModuleIdList.
*/
@java.lang.Override
public java.util.List<java.lang.Integer>
getUnlockedModuleIdListList() {
return unlockedModuleIdList_;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @return The count of unlockedModuleIdList.
*/
public int getUnlockedModuleIdListCount() {
return unlockedModuleIdList_.size();
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @param index The index of the element to return.
* @return The unlockedModuleIdList at the given index.
*/
public int getUnlockedModuleIdList(int index) {
return unlockedModuleIdList_.getInt(index);
}
private int unlockedModuleIdListMemoizedSerializedSize = -1;
public static final int LEVELUP_REWARD_GOT_LEVEL_LIST_FIELD_NUMBER = 10;
private com.google.protobuf.Internal.IntList levelupRewardGotLevelList_; private com.google.protobuf.Internal.IntList levelupRewardGotLevelList_;
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return A list containing the levelupRewardGotLevelList. * @return A list containing the levelupRewardGotLevelList.
*/ */
@java.lang.Override @java.lang.Override
@ -284,14 +256,14 @@ public final class PlayerHomeCompInfoOuterClass {
return levelupRewardGotLevelList_; return levelupRewardGotLevelList_;
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return The count of levelupRewardGotLevelList. * @return The count of levelupRewardGotLevelList.
*/ */
public int getLevelupRewardGotLevelListCount() { public int getLevelupRewardGotLevelListCount() {
return levelupRewardGotLevelList_.size(); return levelupRewardGotLevelList_.size();
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @param index The index of the element to return. * @param index The index of the element to return.
* @return The levelupRewardGotLevelList at the given index. * @return The levelupRewardGotLevelList at the given index.
*/ */
@ -300,6 +272,34 @@ public final class PlayerHomeCompInfoOuterClass {
} }
private int levelupRewardGotLevelListMemoizedSerializedSize = -1; private int levelupRewardGotLevelListMemoizedSerializedSize = -1;
public static final int UNLOCKED_MODULE_ID_LIST_FIELD_NUMBER = 10;
private com.google.protobuf.Internal.IntList unlockedModuleIdList_;
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return A list containing the unlockedModuleIdList.
*/
@java.lang.Override
public java.util.List<java.lang.Integer>
getUnlockedModuleIdListList() {
return unlockedModuleIdList_;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return The count of unlockedModuleIdList.
*/
public int getUnlockedModuleIdListCount() {
return unlockedModuleIdList_.size();
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @param index The index of the element to return.
* @return The unlockedModuleIdList at the given index.
*/
public int getUnlockedModuleIdList(int index) {
return unlockedModuleIdList_.getInt(index);
}
private int unlockedModuleIdListMemoizedSerializedSize = -1;
public static final int SEEN_MODULE_ID_LIST_FIELD_NUMBER = 8; public static final int SEEN_MODULE_ID_LIST_FIELD_NUMBER = 8;
private com.google.protobuf.Internal.IntList seenModuleIdList_; private com.google.protobuf.Internal.IntList seenModuleIdList_;
/** /**
@ -362,12 +362,12 @@ public final class PlayerHomeCompInfoOuterClass {
public void writeTo(com.google.protobuf.CodedOutputStream output) public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (getUnlockedModuleIdListList().size() > 0) { if (getLevelupRewardGotLevelListList().size() > 0) {
output.writeUInt32NoTag(26); output.writeUInt32NoTag(26);
output.writeUInt32NoTag(unlockedModuleIdListMemoizedSerializedSize); output.writeUInt32NoTag(levelupRewardGotLevelListMemoizedSerializedSize);
} }
for (int i = 0; i < unlockedModuleIdList_.size(); i++) { for (int i = 0; i < levelupRewardGotLevelList_.size(); i++) {
output.writeUInt32NoTag(unlockedModuleIdList_.getInt(i)); output.writeUInt32NoTag(levelupRewardGotLevelList_.getInt(i));
} }
if (getSeenModuleIdListList().size() > 0) { if (getSeenModuleIdListList().size() > 0) {
output.writeUInt32NoTag(66); output.writeUInt32NoTag(66);
@ -376,12 +376,12 @@ public final class PlayerHomeCompInfoOuterClass {
for (int i = 0; i < seenModuleIdList_.size(); i++) { for (int i = 0; i < seenModuleIdList_.size(); i++) {
output.writeUInt32NoTag(seenModuleIdList_.getInt(i)); output.writeUInt32NoTag(seenModuleIdList_.getInt(i));
} }
if (getLevelupRewardGotLevelListList().size() > 0) { if (getUnlockedModuleIdListList().size() > 0) {
output.writeUInt32NoTag(82); output.writeUInt32NoTag(82);
output.writeUInt32NoTag(levelupRewardGotLevelListMemoizedSerializedSize); output.writeUInt32NoTag(unlockedModuleIdListMemoizedSerializedSize);
} }
for (int i = 0; i < levelupRewardGotLevelList_.size(); i++) { for (int i = 0; i < unlockedModuleIdList_.size(); i++) {
output.writeUInt32NoTag(levelupRewardGotLevelList_.getInt(i)); output.writeUInt32NoTag(unlockedModuleIdList_.getInt(i));
} }
if (friendEnterHomeOption_ != emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_NEED_CONFIRM.getNumber()) { if (friendEnterHomeOption_ != emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_NEED_CONFIRM.getNumber()) {
output.writeEnum(15, friendEnterHomeOption_); output.writeEnum(15, friendEnterHomeOption_);
@ -397,17 +397,17 @@ public final class PlayerHomeCompInfoOuterClass {
size = 0; size = 0;
{ {
int dataSize = 0; int dataSize = 0;
for (int i = 0; i < unlockedModuleIdList_.size(); i++) { for (int i = 0; i < levelupRewardGotLevelList_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream dataSize += com.google.protobuf.CodedOutputStream
.computeUInt32SizeNoTag(unlockedModuleIdList_.getInt(i)); .computeUInt32SizeNoTag(levelupRewardGotLevelList_.getInt(i));
} }
size += dataSize; size += dataSize;
if (!getUnlockedModuleIdListList().isEmpty()) { if (!getLevelupRewardGotLevelListList().isEmpty()) {
size += 1; size += 1;
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize); .computeInt32SizeNoTag(dataSize);
} }
unlockedModuleIdListMemoizedSerializedSize = dataSize; levelupRewardGotLevelListMemoizedSerializedSize = dataSize;
} }
{ {
int dataSize = 0; int dataSize = 0;
@ -425,17 +425,17 @@ public final class PlayerHomeCompInfoOuterClass {
} }
{ {
int dataSize = 0; int dataSize = 0;
for (int i = 0; i < levelupRewardGotLevelList_.size(); i++) { for (int i = 0; i < unlockedModuleIdList_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream dataSize += com.google.protobuf.CodedOutputStream
.computeUInt32SizeNoTag(levelupRewardGotLevelList_.getInt(i)); .computeUInt32SizeNoTag(unlockedModuleIdList_.getInt(i));
} }
size += dataSize; size += dataSize;
if (!getLevelupRewardGotLevelListList().isEmpty()) { if (!getUnlockedModuleIdListList().isEmpty()) {
size += 1; size += 1;
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize); .computeInt32SizeNoTag(dataSize);
} }
levelupRewardGotLevelListMemoizedSerializedSize = dataSize; unlockedModuleIdListMemoizedSerializedSize = dataSize;
} }
if (friendEnterHomeOption_ != emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_NEED_CONFIRM.getNumber()) { if (friendEnterHomeOption_ != emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_NEED_CONFIRM.getNumber()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -456,10 +456,10 @@ public final class PlayerHomeCompInfoOuterClass {
} }
emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo other = (emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo) obj; emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo other = (emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo) obj;
if (!getUnlockedModuleIdListList()
.equals(other.getUnlockedModuleIdListList())) return false;
if (!getLevelupRewardGotLevelListList() if (!getLevelupRewardGotLevelListList()
.equals(other.getLevelupRewardGotLevelListList())) return false; .equals(other.getLevelupRewardGotLevelListList())) return false;
if (!getUnlockedModuleIdListList()
.equals(other.getUnlockedModuleIdListList())) return false;
if (!getSeenModuleIdListList() if (!getSeenModuleIdListList()
.equals(other.getSeenModuleIdListList())) return false; .equals(other.getSeenModuleIdListList())) return false;
if (friendEnterHomeOption_ != other.friendEnterHomeOption_) return false; if (friendEnterHomeOption_ != other.friendEnterHomeOption_) return false;
@ -474,14 +474,14 @@ public final class PlayerHomeCompInfoOuterClass {
} }
int hash = 41; int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode(); hash = (19 * hash) + getDescriptor().hashCode();
if (getUnlockedModuleIdListCount() > 0) {
hash = (37 * hash) + UNLOCKED_MODULE_ID_LIST_FIELD_NUMBER;
hash = (53 * hash) + getUnlockedModuleIdListList().hashCode();
}
if (getLevelupRewardGotLevelListCount() > 0) { if (getLevelupRewardGotLevelListCount() > 0) {
hash = (37 * hash) + LEVELUP_REWARD_GOT_LEVEL_LIST_FIELD_NUMBER; hash = (37 * hash) + LEVELUP_REWARD_GOT_LEVEL_LIST_FIELD_NUMBER;
hash = (53 * hash) + getLevelupRewardGotLevelListList().hashCode(); hash = (53 * hash) + getLevelupRewardGotLevelListList().hashCode();
} }
if (getUnlockedModuleIdListCount() > 0) {
hash = (37 * hash) + UNLOCKED_MODULE_ID_LIST_FIELD_NUMBER;
hash = (53 * hash) + getUnlockedModuleIdListList().hashCode();
}
if (getSeenModuleIdListCount() > 0) { if (getSeenModuleIdListCount() > 0) {
hash = (37 * hash) + SEEN_MODULE_ID_LIST_FIELD_NUMBER; hash = (37 * hash) + SEEN_MODULE_ID_LIST_FIELD_NUMBER;
hash = (53 * hash) + getSeenModuleIdListList().hashCode(); hash = (53 * hash) + getSeenModuleIdListList().hashCode();
@ -625,9 +625,9 @@ public final class PlayerHomeCompInfoOuterClass {
@java.lang.Override @java.lang.Override
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
unlockedModuleIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
levelupRewardGotLevelList_ = emptyIntList(); levelupRewardGotLevelList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
unlockedModuleIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
seenModuleIdList_ = emptyIntList(); seenModuleIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000004);
@ -661,15 +661,15 @@ public final class PlayerHomeCompInfoOuterClass {
emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo result = new emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo(this); emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo result = new emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo(this);
int from_bitField0_ = bitField0_; int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) != 0)) { if (((bitField0_ & 0x00000001) != 0)) {
unlockedModuleIdList_.makeImmutable(); levelupRewardGotLevelList_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
} }
result.unlockedModuleIdList_ = unlockedModuleIdList_; result.levelupRewardGotLevelList_ = levelupRewardGotLevelList_;
if (((bitField0_ & 0x00000002) != 0)) { if (((bitField0_ & 0x00000002) != 0)) {
levelupRewardGotLevelList_.makeImmutable(); unlockedModuleIdList_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
} }
result.levelupRewardGotLevelList_ = levelupRewardGotLevelList_; result.unlockedModuleIdList_ = unlockedModuleIdList_;
if (((bitField0_ & 0x00000004) != 0)) { if (((bitField0_ & 0x00000004) != 0)) {
seenModuleIdList_.makeImmutable(); seenModuleIdList_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000004);
@ -724,26 +724,26 @@ public final class PlayerHomeCompInfoOuterClass {
public Builder mergeFrom(emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo other) { public Builder mergeFrom(emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo other) {
if (other == emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.getDefaultInstance()) return this; if (other == emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.getDefaultInstance()) return this;
if (!other.unlockedModuleIdList_.isEmpty()) {
if (unlockedModuleIdList_.isEmpty()) {
unlockedModuleIdList_ = other.unlockedModuleIdList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureUnlockedModuleIdListIsMutable();
unlockedModuleIdList_.addAll(other.unlockedModuleIdList_);
}
onChanged();
}
if (!other.levelupRewardGotLevelList_.isEmpty()) { if (!other.levelupRewardGotLevelList_.isEmpty()) {
if (levelupRewardGotLevelList_.isEmpty()) { if (levelupRewardGotLevelList_.isEmpty()) {
levelupRewardGotLevelList_ = other.levelupRewardGotLevelList_; levelupRewardGotLevelList_ = other.levelupRewardGotLevelList_;
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000001);
} else { } else {
ensureLevelupRewardGotLevelListIsMutable(); ensureLevelupRewardGotLevelListIsMutable();
levelupRewardGotLevelList_.addAll(other.levelupRewardGotLevelList_); levelupRewardGotLevelList_.addAll(other.levelupRewardGotLevelList_);
} }
onChanged(); onChanged();
} }
if (!other.unlockedModuleIdList_.isEmpty()) {
if (unlockedModuleIdList_.isEmpty()) {
unlockedModuleIdList_ = other.unlockedModuleIdList_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureUnlockedModuleIdListIsMutable();
unlockedModuleIdList_.addAll(other.unlockedModuleIdList_);
}
onChanged();
}
if (!other.seenModuleIdList_.isEmpty()) { if (!other.seenModuleIdList_.isEmpty()) {
if (seenModuleIdList_.isEmpty()) { if (seenModuleIdList_.isEmpty()) {
seenModuleIdList_ = other.seenModuleIdList_; seenModuleIdList_ = other.seenModuleIdList_;
@ -787,110 +787,31 @@ public final class PlayerHomeCompInfoOuterClass {
} }
private int bitField0_; private int bitField0_;
private com.google.protobuf.Internal.IntList unlockedModuleIdList_ = emptyIntList(); private com.google.protobuf.Internal.IntList levelupRewardGotLevelList_ = emptyIntList();
private void ensureUnlockedModuleIdListIsMutable() { private void ensureLevelupRewardGotLevelListIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) { if (!((bitField0_ & 0x00000001) != 0)) {
unlockedModuleIdList_ = mutableCopy(unlockedModuleIdList_); levelupRewardGotLevelList_ = mutableCopy(levelupRewardGotLevelList_);
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
} }
} }
/** /**
* <code>repeated uint32 unlocked_module_id_list = 3;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return A list containing the unlockedModuleIdList.
*/
public java.util.List<java.lang.Integer>
getUnlockedModuleIdListList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(unlockedModuleIdList_) : unlockedModuleIdList_;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @return The count of unlockedModuleIdList.
*/
public int getUnlockedModuleIdListCount() {
return unlockedModuleIdList_.size();
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @param index The index of the element to return.
* @return The unlockedModuleIdList at the given index.
*/
public int getUnlockedModuleIdList(int index) {
return unlockedModuleIdList_.getInt(index);
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @param index The index to set the value at.
* @param value The unlockedModuleIdList to set.
* @return This builder for chaining.
*/
public Builder setUnlockedModuleIdList(
int index, int value) {
ensureUnlockedModuleIdListIsMutable();
unlockedModuleIdList_.setInt(index, value);
onChanged();
return this;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @param value The unlockedModuleIdList to add.
* @return This builder for chaining.
*/
public Builder addUnlockedModuleIdList(int value) {
ensureUnlockedModuleIdListIsMutable();
unlockedModuleIdList_.addInt(value);
onChanged();
return this;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @param values The unlockedModuleIdList to add.
* @return This builder for chaining.
*/
public Builder addAllUnlockedModuleIdList(
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureUnlockedModuleIdListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, unlockedModuleIdList_);
onChanged();
return this;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 3;</code>
* @return This builder for chaining.
*/
public Builder clearUnlockedModuleIdList() {
unlockedModuleIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList levelupRewardGotLevelList_ = emptyIntList();
private void ensureLevelupRewardGotLevelListIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
levelupRewardGotLevelList_ = mutableCopy(levelupRewardGotLevelList_);
bitField0_ |= 0x00000002;
}
}
/**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code>
* @return A list containing the levelupRewardGotLevelList. * @return A list containing the levelupRewardGotLevelList.
*/ */
public java.util.List<java.lang.Integer> public java.util.List<java.lang.Integer>
getLevelupRewardGotLevelListList() { getLevelupRewardGotLevelListList() {
return ((bitField0_ & 0x00000002) != 0) ? return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(levelupRewardGotLevelList_) : levelupRewardGotLevelList_; java.util.Collections.unmodifiableList(levelupRewardGotLevelList_) : levelupRewardGotLevelList_;
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return The count of levelupRewardGotLevelList. * @return The count of levelupRewardGotLevelList.
*/ */
public int getLevelupRewardGotLevelListCount() { public int getLevelupRewardGotLevelListCount() {
return levelupRewardGotLevelList_.size(); return levelupRewardGotLevelList_.size();
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @param index The index of the element to return. * @param index The index of the element to return.
* @return The levelupRewardGotLevelList at the given index. * @return The levelupRewardGotLevelList at the given index.
*/ */
@ -898,7 +819,7 @@ public final class PlayerHomeCompInfoOuterClass {
return levelupRewardGotLevelList_.getInt(index); return levelupRewardGotLevelList_.getInt(index);
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @param index The index to set the value at. * @param index The index to set the value at.
* @param value The levelupRewardGotLevelList to set. * @param value The levelupRewardGotLevelList to set.
* @return This builder for chaining. * @return This builder for chaining.
@ -911,7 +832,7 @@ public final class PlayerHomeCompInfoOuterClass {
return this; return this;
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @param value The levelupRewardGotLevelList to add. * @param value The levelupRewardGotLevelList to add.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@ -922,7 +843,7 @@ public final class PlayerHomeCompInfoOuterClass {
return this; return this;
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @param values The levelupRewardGotLevelList to add. * @param values The levelupRewardGotLevelList to add.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@ -935,11 +856,90 @@ public final class PlayerHomeCompInfoOuterClass {
return this; return this;
} }
/** /**
* <code>repeated uint32 levelup_reward_got_level_list = 10;</code> * <code>repeated uint32 levelup_reward_got_level_list = 3;</code>
* @return This builder for chaining. * @return This builder for chaining.
*/ */
public Builder clearLevelupRewardGotLevelList() { public Builder clearLevelupRewardGotLevelList() {
levelupRewardGotLevelList_ = emptyIntList(); levelupRewardGotLevelList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList unlockedModuleIdList_ = emptyIntList();
private void ensureUnlockedModuleIdListIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
unlockedModuleIdList_ = mutableCopy(unlockedModuleIdList_);
bitField0_ |= 0x00000002;
}
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return A list containing the unlockedModuleIdList.
*/
public java.util.List<java.lang.Integer>
getUnlockedModuleIdListList() {
return ((bitField0_ & 0x00000002) != 0) ?
java.util.Collections.unmodifiableList(unlockedModuleIdList_) : unlockedModuleIdList_;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return The count of unlockedModuleIdList.
*/
public int getUnlockedModuleIdListCount() {
return unlockedModuleIdList_.size();
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @param index The index of the element to return.
* @return The unlockedModuleIdList at the given index.
*/
public int getUnlockedModuleIdList(int index) {
return unlockedModuleIdList_.getInt(index);
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @param index The index to set the value at.
* @param value The unlockedModuleIdList to set.
* @return This builder for chaining.
*/
public Builder setUnlockedModuleIdList(
int index, int value) {
ensureUnlockedModuleIdListIsMutable();
unlockedModuleIdList_.setInt(index, value);
onChanged();
return this;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @param value The unlockedModuleIdList to add.
* @return This builder for chaining.
*/
public Builder addUnlockedModuleIdList(int value) {
ensureUnlockedModuleIdListIsMutable();
unlockedModuleIdList_.addInt(value);
onChanged();
return this;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @param values The unlockedModuleIdList to add.
* @return This builder for chaining.
*/
public Builder addAllUnlockedModuleIdList(
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureUnlockedModuleIdListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, unlockedModuleIdList_);
onChanged();
return this;
}
/**
* <code>repeated uint32 unlocked_module_id_list = 10;</code>
* @return This builder for chaining.
*/
public Builder clearUnlockedModuleIdList() {
unlockedModuleIdList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
onChanged(); onChanged();
return this; return this;
@ -1145,9 +1145,9 @@ public final class PlayerHomeCompInfoOuterClass {
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\030PlayerHomeCompInfo.proto\032\033FriendEnterH" + "\n\030PlayerHomeCompInfo.proto\032\033FriendEnterH" +
"omeOption.proto\"\263\001\n\022PlayerHomeCompInfo\022\037" + "omeOption.proto\"\263\001\n\022PlayerHomeCompInfo\022%" +
"\n\027unlocked_module_id_list\030\003 \003(\r\022%\n\035level" + "\n\035levelup_reward_got_level_list\030\003 \003(\r\022\037\n" +
"up_reward_got_level_list\030\n \003(\r\022\033\n\023seen_m" + "\027unlocked_module_id_list\030\n \003(\r\022\033\n\023seen_m" +
"odule_id_list\030\010 \003(\r\0228\n\030friend_enter_home" + "odule_id_list\030\010 \003(\r\0228\n\030friend_enter_home" +
"_option\030\017 \001(\0162\026.FriendEnterHomeOptionB\033\n" + "_option\030\017 \001(\0162\026.FriendEnterHomeOptionB\033\n" +
"\031emu.grasscutter.net.protob\006proto3" "\031emu.grasscutter.net.protob\006proto3"
@ -1162,7 +1162,7 @@ public final class PlayerHomeCompInfoOuterClass {
internal_static_PlayerHomeCompInfo_fieldAccessorTable = new internal_static_PlayerHomeCompInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_PlayerHomeCompInfo_descriptor, internal_static_PlayerHomeCompInfo_descriptor,
new java.lang.String[] { "UnlockedModuleIdList", "LevelupRewardGotLevelList", "SeenModuleIdList", "FriendEnterHomeOption", }); new java.lang.String[] { "LevelupRewardGotLevelList", "UnlockedModuleIdList", "SeenModuleIdList", "FriendEnterHomeOption", });
emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass.getDescriptor(); emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass.getDescriptor();
} }

View File

@ -2,11 +2,12 @@ package emu.grasscutter.data.binout;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.game.world.Position; import emu.grasscutter.game.world.Position;
import java.util.List;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Data; import lombok.Data;
import lombok.experimental.FieldDefaults; import lombok.experimental.FieldDefaults;
import java.util.List;
@Data @Data
@FieldDefaults(level = AccessLevel.PRIVATE) @FieldDefaults(level = AccessLevel.PRIVATE)
public class HomeworldDefaultSaveData { public class HomeworldDefaultSaveData {

View File

@ -11,9 +11,10 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults(level = AccessLevel.PRIVATE) @FieldDefaults(level = AccessLevel.PRIVATE)
@ResourceType(name = {"HomeWorldBgmExcelConfigData.json"}) @ResourceType(name = {"HomeWorldBgmExcelConfigData.json"})
public class HomeWorldBgmData extends GameResource { public class HomeWorldBgmData extends GameResource {
@SerializedName(value = "homeBgmId", alternate = "MJJENLEBKEF") @SerializedName(value = "homeBgmId", alternate = {"MJJENLEBKEF"})
private int homeBgmId; private int homeBgmId;
@SerializedName(value = "isDefaultUnlock", alternate = {"GBEONILEOBA"})
private boolean isDefaultUnlock; private boolean isDefaultUnlock;
private boolean NBIDHGOOCKD; private boolean NBIDHGOOCKD;
private boolean JJMNJMCCOKP; private boolean JJMNJMCCOKP;

View File

@ -109,6 +109,7 @@ public class Friendship {
.setParam(getFriendProfile().getDaysSinceLogin()) .setParam(getFriendProfile().getDaysSinceLogin())
.setIsGameSource(true) .setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC) .setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.setFriendEnterHomeOptionValue(getFriendProfile().getEnterHomeOption())
.build(); .build();
return proto; return proto;

View File

@ -3,8 +3,11 @@ package emu.grasscutter.game.friends;
import dev.morphia.annotations.AlsoLoad; import dev.morphia.annotations.AlsoLoad;
import dev.morphia.annotations.Entity; import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Transient; import dev.morphia.annotations.Transient;
import emu.grasscutter.game.home.GameHome;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
import lombok.Getter;
@Entity @Entity
public class PlayerProfile { public class PlayerProfile {
@ -17,11 +20,12 @@ public class PlayerProfile {
private int avatarId; private int avatarId;
private String name; private String name;
private String signature; private String signature;
private int achievements;
private int playerLevel; private int playerLevel;
private int worldLevel; private int worldLevel;
private int lastActiveTime; private int lastActiveTime;
@Getter
private int enterHomeOption;
@Deprecated // Morphia only @Deprecated // Morphia only
public PlayerProfile() {} public PlayerProfile() {}
@ -59,10 +63,6 @@ public class PlayerProfile {
return signature; return signature;
} }
public int getAchievements() {
return achievements;
}
public int getPlayerLevel() { public int getPlayerLevel() {
return playerLevel; return playerLevel;
} }
@ -99,7 +99,7 @@ public class PlayerProfile {
this.nameCard = player.getNameCardId(); this.nameCard = player.getNameCardId();
this.playerLevel = player.getLevel(); this.playerLevel = player.getLevel();
this.worldLevel = player.getWorldLevel(); this.worldLevel = player.getWorldLevel();
// this.achievements = 0; this.enterHomeOption = player.tryGetHome().map(GameHome::getEnterHomeOption).orElse(FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_REFUSE_VALUE);
this.updateLastActiveTime(); this.updateLastActiveTime();
} }
} }

View File

@ -0,0 +1,10 @@
package emu.grasscutter.game.home;
import emu.grasscutter.game.CoopRequest;
import emu.grasscutter.game.player.Player;
public class EnterHomeRequest extends CoopRequest {
public EnterHomeRequest(Player requester) {
super(requester);
}
}

View File

@ -4,31 +4,40 @@ import dev.morphia.annotations.*;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.HomeWorldLevelData; import emu.grasscutter.data.excels.HomeWorldLevelData;
import emu.grasscutter.data.excels.scene.SceneData;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.packet.send.*;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; 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.ZonedDateTime;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.FieldDefaults;
@Entity(value = "homes", useDiscriminator = false) @Entity(value = "homes", useDiscriminator = false)
@Data @Data
@FieldDefaults(level = AccessLevel.PRIVATE) @FieldDefaults(level = AccessLevel.PRIVATE)
@Builder(builderMethodName = "of") @Builder(builderMethodName = "of")
public class GameHome { public class GameHome {
@Id String id; public static final Set<Integer> HOME_SCENE_IDS = GameData.getSceneDataMap().values().stream()
.filter(sceneData -> sceneData.getSceneType() == SceneType.SCENE_HOME_WORLD || sceneData.getSceneType() == SceneType.SCENE_HOME_ROOM)
.map(SceneData::getId).collect(Collectors.toUnmodifiableSet());
@Id
String id;
@Indexed(options = @IndexOptions(unique = true)) @Indexed(options = @IndexOptions(unique = true))
long ownerUid; long ownerUid;
@Transient Player player; @Transient
Player player;
int level; int level;
int exp; int exp;
@ -49,13 +58,17 @@ public class GameHome {
return home; return home;
} }
public static boolean doesHomeExist(int uid) {
return DatabaseHelper.getHomeByUid(uid) != null;
}
public static GameHome create(Integer uid) { public static GameHome create(Integer uid) {
return GameHome.of() return GameHome.of()
.ownerUid(uid) .ownerUid(uid)
.level(1) .level(1)
.sceneMap(new ConcurrentHashMap<>()) .sceneMap(new ConcurrentHashMap<>())
.unlockedHomeBgmList(new HashSet<>()) .unlockedHomeBgmList(new HashSet<>())
.build(); .build();
} }
public void save() { public void save() {
@ -64,19 +77,19 @@ public class GameHome {
public HomeSceneItem getHomeSceneItem(int sceneId) { public HomeSceneItem getHomeSceneItem(int sceneId) {
return sceneMap.computeIfAbsent( return sceneMap.computeIfAbsent(
sceneId, sceneId,
e -> { e -> {
var defaultItem = GameData.getHomeworldDefaultSaveData().get(sceneId); var defaultItem = GameData.getHomeworldDefaultSaveData().get(sceneId);
if (defaultItem != null) { if (defaultItem != null) {
Grasscutter.getLogger() Grasscutter.getLogger()
.info("Set player {} home {} to initial setting", ownerUid, sceneId); .info("Set player {} home {} to initial setting", ownerUid, sceneId);
return HomeSceneItem.parseFrom(defaultItem, sceneId); return HomeSceneItem.parseFrom(defaultItem, sceneId);
} else { } else {
// Realm res missing bricks account, use default realm data to allow main house // Realm res missing bricks account, use default realm data to allow main house
defaultItem = GameData.getHomeworldDefaultSaveData().get(2001); defaultItem = GameData.getHomeworldDefaultSaveData().get(2001);
return HomeSceneItem.parseFrom(defaultItem, sceneId); return HomeSceneItem.parseFrom(defaultItem, sceneId);
} }
}); });
} }
public void onOwnerLogin(Player player) { public void onOwnerLogin(Player player) {
@ -130,9 +143,9 @@ public class GameHome {
private Set<Integer> getDefaultUnlockedHomeBgmIds() { private Set<Integer> getDefaultUnlockedHomeBgmIds() {
return GameData.getHomeWorldBgmDataMap().int2ObjectEntrySet().stream() return GameData.getHomeWorldBgmDataMap().int2ObjectEntrySet().stream()
.filter(e -> e.getValue().isDefaultUnlock()) .filter(e -> e.getValue().isDefaultUnlock())
.map(Int2ObjectMap.Entry::getIntKey) .map(Int2ObjectMap.Entry::getIntKey)
.collect(Collectors.toUnmodifiableSet()); .collect(Collectors.toUnmodifiableSet());
} }
// Same as Player.java addExpDirectly // Same as Player.java addExpDirectly
@ -171,7 +184,7 @@ public class GameHome {
// Ensure next update is at top of the hour // Ensure next update is at top of the hour
nextUpdateTime = nextUpdateTime =
(int) ZonedDateTime.now().plusHours(1).truncatedTo(ChronoUnit.HOURS).toEpochSecond(); (int) ZonedDateTime.now().plusHours(1).truncatedTo(ChronoUnit.HOURS).toEpochSecond();
// Get resources // Get resources
var hourlyResources = getComfortResources(player); var hourlyResources = getComfortResources(player);
@ -194,42 +207,42 @@ public class GameHome {
// Outdoors avatars // Outdoors avatars
sceneMap sceneMap
.get(player.getCurrentRealmId() + 2000) .get(player.getCurrentRealmId() + 2000)
.getBlockItems() .getBlockItems()
.forEach( .forEach(
(i, e) -> { (i, e) -> {
e.getDeployNPCList() e.getDeployNPCList()
.forEach( .forEach(
id -> { id -> {
invitedAvatars.add(id.getAvatarId()); invitedAvatars.add(id.getAvatarId());
}); });
}); });
// Check as realm 5 inside is not in defaults and will be null // Check as realm 5 inside is not in defaults and will be null
if (Objects.nonNull(sceneMap.get(player.getCurrentRealmId() + 2200))) { if (Objects.nonNull(sceneMap.get(player.getCurrentRealmId() + 2200))) {
// Indoors avatars // Indoors avatars
sceneMap sceneMap
.get(player.getCurrentRealmId() + 2200) .get(player.getCurrentRealmId() + 2200)
.getBlockItems() .getBlockItems()
.forEach( .forEach(
(i, e) -> { (i, e) -> {
e.getDeployNPCList() e.getDeployNPCList()
.forEach( .forEach(
id -> { id -> {
invitedAvatars.add(id.getAvatarId()); invitedAvatars.add(id.getAvatarId());
}); });
}); });
} }
// Add exp to all avatars // Add exp to all avatars
invitedAvatars.forEach( invitedAvatars.forEach(
id -> { id -> {
var avatar = player.getAvatars().getAvatarById(id); var avatar = player.getAvatars().getAvatarById(id);
player player
.getServer() .getServer()
.getInventorySystem() .getInventorySystem()
.upgradeAvatarFetterLevel(player, avatar, storedFetterExp); .upgradeAvatarFetterLevel(player, avatar, storedFetterExp);
}); });
storedFetterExp = 0; storedFetterExp = 0;
save(); save();
@ -253,7 +266,7 @@ public class GameHome {
storeResources(player, 0, 0); storeResources(player, 0, 0);
lastUpdatedTime = clientTime; lastUpdatedTime = clientTime;
nextUpdateTime = nextUpdateTime =
(int) ZonedDateTime.now().plusHours(1).truncatedTo(ChronoUnit.HOURS).toEpochSecond(); (int) ZonedDateTime.now().plusHours(1).truncatedTo(ChronoUnit.HOURS).toEpochSecond();
save(); save();
// Send packet // Send packet

View File

@ -0,0 +1,162 @@
package emu.grasscutter.game.home;
import emu.grasscutter.game.entity.EntityTeam;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.ChatInfoOuterClass;
import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.packet.send.PacketDelTeamEntityNotify;
import emu.grasscutter.server.packet.send.PacketPlayerChatNotify;
import lombok.Getter;
import java.util.List;
public class HomeWorld extends World {
@Getter
private final GameHome home;
public HomeWorld(GameServer server, Player owner) {
super(server, owner);
this.home = owner.isOnline() ? owner.getHome() : GameHome.getByUid(owner.getUid());
server.registerHomeWorld(this);
}
@Override
public synchronized void addPlayer(Player player) {
// Check if player already in
if (this.getPlayers().contains(player)) {
return;
}
// Remove player from prev world
if (player.getWorld() != null) {
player.getWorld().removePlayer(player);
}
// Register
player.setWorld(this);
this.getPlayers().add(player);
// Set player variables
if (this.getHost().equals(player)) {
player.setPeerId(1);
this.getGuests().forEach(player1 -> player1.setPeerId(player1.getPeerId() + 1));
} else {
player.setPeerId(this.getNextPeerId());
}
player.getTeamManager().setEntity(new EntityTeam(player));
// Copy main team to multiplayer team
if (this.isMultiplayer()) {
player
.getTeamManager()
.getMpTeam()
.copyFrom(
player.getTeamManager().getCurrentSinglePlayerTeamInfo(),
player.getTeamManager().getMaxTeamSize());
player.getTeamManager().setCurrentCharacterIndex(0);
if (!player.equals(this.getHost())) {
this.broadcastPacket(
new PacketPlayerChatNotify(
player,
0,
ChatInfoOuterClass.ChatInfo.SystemHint.newBuilder()
.setType(ChatInfoOuterClass.ChatInfo.SystemHintType.SYSTEM_HINT_TYPE_CHAT_ENTER_WORLD.getNumber())
.build()));
}
}
// Add to scene
var scene = this.getSceneById(player.getSceneId());
scene.addPlayer(player);
// Info packet for other players
if (this.getPlayers().size() > 1) {
this.updatePlayerInfos(player);
}
}
@Override
public synchronized void removePlayer(Player player) {
// Remove team entities
this.broadcastPacket(
new PacketDelTeamEntityNotify(
player.getSceneId(),
this.getPlayers().stream()
.map(
p ->
p.getTeamManager().getEntity() == null
? 0
: p.getTeamManager().getEntity().getId())
.toList()));
// Deregister
this.getPlayers().remove(player);
player.setWorld(null);
// Remove from scene
Scene scene = this.getSceneById(player.getSceneId());
scene.removePlayer(player);
// Info packet for other players
if (this.getPlayers().size() > 0) {
this.updatePlayerInfos(player);
}
this.broadcastPacket(
new PacketPlayerChatNotify(
player,
0,
ChatInfoOuterClass.ChatInfo.SystemHint.newBuilder()
.setType(ChatInfoOuterClass.ChatInfo.SystemHintType.SYSTEM_HINT_TYPE_CHAT_LEAVE_WORLD.getNumber())
.build()));
}
@Override
public int getNextPeerId() {
return this.getPlayers().size() + 1;
}
@Override
public synchronized void setHost(Player host) {
super.setHost(host);
}
@Override
public final boolean isMultiplayer() {
return true;
}
@Override
public final boolean isPaused() {
return false;
}
@Override
public final boolean isTimeLocked() {
return false;
}
public int getOwnerUid() {
return this.getHost().getUid();
}
public List<Player> getGuests() {
return this.getPlayers().stream().filter(player -> !player.equals(this.getHost())).toList();
}
public boolean isInHome(Player player) {
return this.getPlayers().contains(player);
}
public void sendPacketToHostIfOnline(BasePacket basePacket) {
if (this.getHost().isOnline()) {
this.getHost().sendPacket(basePacket);
}
}
}

View File

@ -0,0 +1,187 @@
package emu.grasscutter.game.home;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.world.Position;
import emu.grasscutter.game.world.World;
import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.net.proto.EnterTypeOuterClass;
import emu.grasscutter.net.proto.OtherPlayerEnterHomeNotifyOuterClass;
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.*;
public class HomeWorldMPSystem extends BaseGameSystem {
public HomeWorldMPSystem(GameServer server) {
super(server);
}
public void sendEnterHomeRequest(Player requester, int ownerUid) {
var owner = getServer().getPlayerByUid(ownerUid);
if (owner == null) {
requester.sendPacket(new PacketPlayerApplyEnterHomeResultNotify(ownerUid, "", false, PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason.OPEN_STATE_NOT_OPEN));
requester.sendPacket(new PacketTryEnterHomeRsp());
return;
}
if (owner.getRealmList() == null) {
requester.sendPacket(new PacketPlayerApplyEnterHomeResultNotify(ownerUid, "", false, PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason.OPEN_STATE_NOT_OPEN));
requester.sendPacket(new PacketTryEnterHomeRsp());
return;
}
var request = owner.getEnterHomeRequests().get(requester.getUid());
if (request != null && !request.isExpired()) {
return;
}
if (owner.isInEditMode()) {
requester.sendPacket(new PacketPlayerApplyEnterHomeResultNotify(ownerUid, owner.getNickname(), false, PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason.HOST_IN_EDIT_MODE));
requester.sendPacket(new PacketTryEnterHomeRsp());
return;
}
request = new EnterHomeRequest(requester);
owner.getEnterHomeRequests().put(requester.getUid(), request);
owner.sendPacket(new PacketPlayerApplyEnterHomeNotify(requester));
}
public void acceptEnterHomeRequest(Player owner, int requesterUid, boolean isAgreed) {
var request = owner.getEnterHomeRequests().get(requesterUid);
if (request == null || request.isExpired()) {
return;
}
var requester = request.getRequester();
owner.getEnterHomeRequests().remove(requesterUid);
if (requester.getWorld().isMultiplayer()) {
requester.sendPacket(new PacketPlayerApplyEnterHomeResultNotify(owner.getUid(), owner.getNickname(), false, PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason.SYSTEM_JUDGE));
requester.sendPacket(new PacketTryEnterHomeRsp());
return;
}
requester.sendPacket(new PacketPlayerApplyEnterHomeResultNotify(owner.getUid(), owner.getNickname(), isAgreed, PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason.PLAYER_JUDGE));
if (!isAgreed) {
requester.sendPacket(new PacketTryEnterHomeRsp());
return;
}
this.enterHome(requester, owner);
}
public void enterHome(Player requester, Player owner) {
if (requester.getWorld().isMultiplayer()) {
return;
}
if (owner.getRealmList() == null) {
// should never happen
requester.sendPacket(new PacketTryEnterHomeRsp(RetcodeOuterClass.Retcode.RET_HOME_NOT_FOUND_IN_MEM_VALUE, owner.getUid()));
return;
}
var world = this.server.getHomeWorldOrCreate(owner);
var targetHome = world.getHome();
var event = new PlayerEnterHomeEvent(requester, owner, targetHome);
event.call();
if (event.isCanceled()) {
requester.sendPacket(new PacketTryEnterHomeRsp(RetcodeOuterClass.Retcode.RET_HOME_OWNER_REFUSE_TO_ENTER_HOME_VALUE, owner.getUid()));
return;
}
if (owner.isInEditMode()) {
requester.sendPacket(new PacketTryEnterHomeRsp(RetcodeOuterClass.Retcode.RET_HOME_CANT_ENTER_BY_IN_EDIT_MODE_VALUE, owner.getUid()));
return;
}
int realmId = 2000 + owner.getCurrentRealmId();
targetHome.getHomeSceneItem(realmId);
targetHome.save();
var pos = world.getSceneById(realmId).getScriptManager().getConfig().born_pos;
requester.getPrevPosForHome().set(requester.getPosition());
requester.setCurHomeWorld(world);
requester.setPrevScene(requester.getSceneId());
world.addPlayer(requester, realmId);
requester.setSceneId(realmId);
requester.getPosition().set(pos);
requester.sendPacket(new PacketPlayerEnterSceneNotify(requester, owner.getUid(), TeleportProperties.builder().sceneId(realmId).enterReason(EnterReason.EnterHome).teleportTo(pos).teleportType(PlayerTeleportEvent.TeleportType.INTERNAL).build(), !requester.equals(owner)));
requester.sendPacket(new PacketTryEnterHomeRsp(owner.getUid()));
requester.setHasSentInitPacketInHome(false);
world.getPlayers().stream()
.filter(player -> !player.equals(requester))
.forEach(player -> player.sendPacket(new PacketPlayerPreEnterMpNotify(requester)));
}
public boolean leaveCoop(Player player, int prevScene) {
return this.leaveCoop(player, prevScene, player.getPrevPosForHome());
}
public boolean leaveCoop(Player player, int prevScene, Position pos) {
// Make sure everyone's scene is loaded
for (var p : player.getWorld().getPlayers()) {
if (p.getSceneLoadState() != Player.SceneLoadState.LOADED) {
return false;
}
}
// Event
var event = new PlayerLeaveHomeEvent(player, player.getCurHomeWorld().getHost(), player.getCurHomeWorld().getHome(), PlayerLeaveHomeEvent.Reason.PLAYER_LEAVE);
event.call();
player.getPosition().set(pos);
var world = new World(player);
world.addPlayer(player, prevScene);
player.getCurHomeWorld().sendPacketToHostIfOnline(new PacketOtherPlayerEnterOrLeaveHomeNotify(player, OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.LEAVE));
player.setCurHomeWorld(this.server.getHomeWorldOrCreate(player));
player.sendPacket(new PacketPlayerEnterSceneNotify(player, EnterTypeOuterClass.EnterType.ENTER_TYPE_BACK, EnterReason.TeamBack, prevScene, pos));
return true;
}
public boolean kickPlayerFromHome(Player owner, int targetUid) {
// Make sure player's world is multiplayer and that player is owner
if (!owner.getCurHomeWorld().getHost().equals(owner)) {
return false;
}
// Get victim and sanity checks
var victim = owner.getServer().getPlayerByUid(targetUid);
if (victim == null || owner.equals(victim)) {
return false;
}
// Make sure victim's scene has loaded
if (victim.getSceneLoadState() != Player.SceneLoadState.LOADED) {
return false;
}
// Event
var event = new PlayerLeaveHomeEvent(victim, owner, victim.getCurHomeWorld().getHome(), PlayerLeaveHomeEvent.Reason.KICKED);
event.call();
// Kick
victim.getPosition().set(victim.getPrevPosForHome());
var world = new World(victim);
world.addPlayer(victim, 3);
victim.getCurHomeWorld().sendPacketToHostIfOnline(new PacketOtherPlayerEnterOrLeaveHomeNotify(victim, OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.LEAVE));
victim.setCurHomeWorld(this.server.getHomeWorldOrCreate(victim));
victim.sendPacket(new PacketPlayerEnterSceneNotify(victim, EnterTypeOuterClass.EnterType.ENTER_TYPE_BACK, EnterReason.TeamKick, victim.getScene().getId(), victim.getPrevPosForHome()));
return true;
}
}

View File

@ -21,7 +21,9 @@ import emu.grasscutter.game.expedition.ExpeditionInfo;
import emu.grasscutter.game.friends.FriendsList; import emu.grasscutter.game.friends.FriendsList;
import emu.grasscutter.game.friends.PlayerProfile; import emu.grasscutter.game.friends.PlayerProfile;
import emu.grasscutter.game.gacha.PlayerGachaInfo; import emu.grasscutter.game.gacha.PlayerGachaInfo;
import emu.grasscutter.game.home.EnterHomeRequest;
import emu.grasscutter.game.home.GameHome; import emu.grasscutter.game.home.GameHome;
import emu.grasscutter.game.home.HomeWorld;
import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.Inventory; import emu.grasscutter.game.inventory.Inventory;
import emu.grasscutter.game.mail.Mail; import emu.grasscutter.game.mail.Mail;
@ -29,6 +31,7 @@ import emu.grasscutter.game.mail.MailHandler;
import emu.grasscutter.game.managers.FurnitureManager; import emu.grasscutter.game.managers.FurnitureManager;
import emu.grasscutter.game.managers.ResinManager; import emu.grasscutter.game.managers.ResinManager;
import emu.grasscutter.game.managers.SatiationManager; import emu.grasscutter.game.managers.SatiationManager;
import emu.grasscutter.game.managers.SotSManager;
import emu.grasscutter.game.managers.cooking.ActiveCookCompoundData; import emu.grasscutter.game.managers.cooking.ActiveCookCompoundData;
import emu.grasscutter.game.managers.cooking.CookingCompoundManager; import emu.grasscutter.game.managers.cooking.CookingCompoundManager;
import emu.grasscutter.game.managers.cooking.CookingManager; import emu.grasscutter.game.managers.cooking.CookingManager;
@ -38,7 +41,6 @@ import emu.grasscutter.game.managers.forging.ActiveForgeData;
import emu.grasscutter.game.managers.forging.ForgingManager; import emu.grasscutter.game.managers.forging.ForgingManager;
import emu.grasscutter.game.managers.mapmark.MapMark; import emu.grasscutter.game.managers.mapmark.MapMark;
import emu.grasscutter.game.managers.mapmark.MapMarksManager; import emu.grasscutter.game.managers.mapmark.MapMarksManager;
import emu.grasscutter.game.managers.SotSManager;
import emu.grasscutter.game.managers.stamina.StaminaManager; import emu.grasscutter.game.managers.stamina.StaminaManager;
import emu.grasscutter.game.props.*; import emu.grasscutter.game.props.*;
import emu.grasscutter.game.quest.QuestManager; import emu.grasscutter.game.quest.QuestManager;
@ -58,15 +60,13 @@ import emu.grasscutter.net.proto.CombatInvokeEntryOuterClass.CombatInvokeEntry;
import emu.grasscutter.net.proto.GadgetInteractReqOuterClass.GadgetInteractReq; import emu.grasscutter.net.proto.GadgetInteractReqOuterClass.GadgetInteractReq;
import emu.grasscutter.net.proto.MpSettingTypeOuterClass.MpSettingType; import emu.grasscutter.net.proto.MpSettingTypeOuterClass.MpSettingType;
import emu.grasscutter.net.proto.OnlinePlayerInfoOuterClass.OnlinePlayerInfo; import emu.grasscutter.net.proto.OnlinePlayerInfoOuterClass.OnlinePlayerInfo;
import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass; import emu.grasscutter.net.proto.*;
import emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo; import emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo;
import emu.grasscutter.net.proto.PlayerWorldLocationInfoOuterClass;
import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture; import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture;
import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason; import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason;
import emu.grasscutter.net.proto.ShowAvatarInfoOuterClass;
import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail;
import emu.grasscutter.net.proto.SocialShowAvatarInfoOuterClass;
import emu.grasscutter.plugin.api.PlayerHook; import emu.grasscutter.plugin.api.PlayerHook;
import emu.grasscutter.scripts.ScriptLoader;
import emu.grasscutter.scripts.data.SceneRegion; import emu.grasscutter.scripts.data.SceneRegion;
import emu.grasscutter.server.event.player.PlayerEnterAreaEvent; import emu.grasscutter.server.event.player.PlayerEnterAreaEvent;
import emu.grasscutter.server.event.player.PlayerJoinEvent; import emu.grasscutter.server.event.player.PlayerJoinEvent;
@ -75,7 +75,8 @@ import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.game.GameSession.SessionState; import emu.grasscutter.server.game.GameSession.SessionState;
import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.*; import emu.grasscutter.utils.DispatchUtils;
import emu.grasscutter.utils.Utils;
import emu.grasscutter.utils.helpers.DateHelper; import emu.grasscutter.utils.helpers.DateHelper;
import emu.grasscutter.utils.objects.FieldFetch; import emu.grasscutter.utils.objects.FieldFetch;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
@ -108,6 +109,8 @@ public class Player implements PlayerHook, FieldFetch {
@Getter private int nameCardId = 210001; @Getter private int nameCardId = 210001;
@Getter private Position position; @Getter private Position position;
@Getter @Setter private Position prevPos; @Getter @Setter private Position prevPos;
@Getter @Setter private Position prevPosForHome;
@Getter @Setter private int prevScene;
@Getter private Position rotation; @Getter private Position rotation;
@Getter private PlayerBirthday birthday; @Getter private PlayerBirthday birthday;
@Getter private PlayerCodex codex; @Getter private PlayerCodex codex;
@ -116,6 +119,7 @@ public class Player implements PlayerHook, FieldFetch {
@Getter @Setter private List<Integer> showNameCardList; @Getter @Setter private List<Integer> showNameCardList;
@Getter private Map<Integer, Integer> properties; @Getter private Map<Integer, Integer> properties;
@Getter @Setter private int currentRealmId; @Getter @Setter private int currentRealmId;
@Getter @Setter private transient boolean isInEditMode;
@Getter @Setter private int widgetId; @Getter @Setter private int widgetId;
@Getter @Setter private int sceneId; @Getter @Setter private int sceneId;
@Getter @Setter private int regionId; @Getter @Setter private int regionId;
@ -148,6 +152,8 @@ public class Player implements PlayerHook, FieldFetch {
@Transient private long nextGuid = 0; @Transient private long nextGuid = 0;
@Transient @Getter @Setter private int peerId; @Transient @Getter @Setter private int peerId;
@Transient private World world; // Synchronized getter and setter @Transient private World world; // Synchronized getter and setter
@Transient @Getter @Setter private HomeWorld curHomeWorld;
@Transient @Getter @Setter private boolean hasSentInitPacketInHome;
@Transient private Scene scene; // Synchronized getter and setter @Transient private Scene scene; // Synchronized getter and setter
@Transient @Getter private int weatherId = 0; @Transient @Getter private int weatherId = 0;
@Transient @Getter private ClimateType climate = ClimateType.CLIMATE_SUNNY; @Transient @Getter private ClimateType climate = ClimateType.CLIMATE_SUNNY;
@ -202,6 +208,7 @@ public class Player implements PlayerHook, FieldFetch {
@Transient @Getter @Setter private SceneLoadState sceneLoadState = SceneLoadState.NONE; @Transient @Getter @Setter private SceneLoadState sceneLoadState = SceneLoadState.NONE;
@Transient private boolean hasSentLoginPackets; @Transient private boolean hasSentLoginPackets;
@Transient private long nextSendPlayerLocTime = 0; @Transient private long nextSendPlayerLocTime = 0;
@Getter private transient final Int2ObjectMap<EnterHomeRequest> enterHomeRequests;
private transient final Int2ObjectMap<CoopRequest> coopRequests; // Synchronized getter private transient final Int2ObjectMap<CoopRequest> coopRequests; // Synchronized getter
@Getter private transient final Queue<AttackResult> attackResults; @Getter private transient final Queue<AttackResult> attackResults;
@ -238,6 +245,7 @@ public class Player implements PlayerHook, FieldFetch {
this.buffManager = new PlayerBuffManager(this); this.buffManager = new PlayerBuffManager(this);
this.position = new Position(GameConstants.START_POSITION); this.position = new Position(GameConstants.START_POSITION);
this.prevPos = new Position(); this.prevPos = new Position();
this.prevPosForHome = Position.ZERO;
this.rotation = new Position(0, 307, 0); this.rotation = new Position(0, 307, 0);
this.sceneId = 3; this.sceneId = 3;
this.regionId = 1; this.regionId = 1;
@ -274,6 +282,7 @@ public class Player implements PlayerHook, FieldFetch {
this.attackResults = new LinkedBlockingQueue<>(); this.attackResults = new LinkedBlockingQueue<>();
this.coopRequests = new Int2ObjectOpenHashMap<>(); this.coopRequests = new Int2ObjectOpenHashMap<>();
this.enterHomeRequests = new Int2ObjectOpenHashMap<>();
this.combatInvokeHandler = new InvokeHandler(PacketCombatInvocationsNotify.class); this.combatInvokeHandler = new InvokeHandler(PacketCombatInvocationsNotify.class);
this.abilityInvokeHandler = new InvokeHandler(PacketAbilityInvocationsNotify.class); this.abilityInvokeHandler = new InvokeHandler(PacketAbilityInvocationsNotify.class);
this.clientAbilityInitFinishHandler = new InvokeHandler(PacketClientAbilityInitFinishNotify.class); this.clientAbilityInitFinishHandler = new InvokeHandler(PacketClientAbilityInitFinishNotify.class);
@ -494,6 +503,18 @@ public class Player implements PlayerHook, FieldFetch {
this.seenRealmList.add(seenId); this.seenRealmList.add(seenId);
} }
public Optional<GameHome> tryGetHome() {
if (this.isOnline()) {
return Optional.ofNullable(this.home);
}
if (GameHome.doesHomeExist(this.getUid())) {
this.home = GameHome.getByUid(this.getUid());
}
return Optional.ofNullable(this.home);
}
public int getExpeditionLimit() { public int getExpeditionLimit() {
final int CONST_VALUE_EXPEDITION_INIT_LIMIT = 2; // TODO: pull from ConstValueExcelConfigData.json final int CONST_VALUE_EXPEDITION_INIT_LIMIT = 2; // TODO: pull from ConstValueExcelConfigData.json
int expeditionLimit = CONST_VALUE_EXPEDITION_INIT_LIMIT; int expeditionLimit = CONST_VALUE_EXPEDITION_INIT_LIMIT;
@ -716,7 +737,7 @@ public class Player implements PlayerHook, FieldFetch {
this.getQuestManager().forEachActiveQuest(quest -> { this.getQuestManager().forEachActiveQuest(quest -> {
if (quest.getTriggerData() != null && if (quest.getTriggerData() != null &&
quest.getTriggers().containsKey(enterRegionName) && quest.getTriggers().containsKey(enterRegionName) &&
region.getGroupId() == quest.getTriggerData().get(enterRegionName).getGroupId()) { region.getGroupId() == quest.getTriggerData().get(enterRegionName).getGroupId()) {
// If trigger hasn't been fired yet // If trigger hasn't been fired yet
if (!Boolean.TRUE.equals(quest.getTriggers().put(enterRegionName, true))) { if (!Boolean.TRUE.equals(quest.getTriggers().put(enterRegionName, true))) {
this.getSession().send(new PacketServerCondMeetQuestListUpdateNotify()); this.getSession().send(new PacketServerCondMeetQuestListUpdateNotify());
@ -1201,6 +1222,21 @@ public class Player implements PlayerHook, FieldFetch {
return true; return true;
} }
private boolean expireEnterHomeRequest(EnterHomeRequest req) {
return this.expireEnterHomeRequest(req, false);
}
private boolean expireEnterHomeRequest(EnterHomeRequest req, boolean force) {
if (!req.isExpired() && !force) return false;
req.getRequester().sendPacket(new PacketPlayerApplyEnterHomeResultNotify(
this.getUid(),
this.getNickname(),
false,
PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason.SYSTEM_JUDGE));
req.getRequester().sendPacket(new PacketTryEnterHomeRsp());
return true;
}
public synchronized void onTick() { public synchronized void onTick() {
// Check ping // Check ping
if (this.getLastPingTime() > System.currentTimeMillis() + 60000) { if (this.getLastPingTime() > System.currentTimeMillis() + 60000) {
@ -1209,6 +1245,8 @@ public class Player implements PlayerHook, FieldFetch {
} }
// Check co-op requests // Check co-op requests
this.getCoopRequests().values().removeIf(this::expireCoopRequest); this.getCoopRequests().values().removeIf(this::expireCoopRequest);
// Check enter-home requests
this.getEnterHomeRequests().values().removeIf(this::expireEnterHomeRequest);
// Handle buff // Handle buff
this.getBuffManager().onTick(); this.getBuffManager().onTick();
// Ping // Ping
@ -1322,9 +1360,9 @@ public class Player implements PlayerHook, FieldFetch {
} }
// Load from db // Load from db
var runner = Grasscutter.getThreadPool(); this.achievements = Achievements.getByPlayer(this);
runner.submit(() -> this.achievements = Achievements.getByPlayer(this));
var runner = Grasscutter.getThreadPool();
runner.submit(this.getAvatars()::loadFromDatabase); runner.submit(this.getAvatars()::loadFromDatabase);
runner.submit(this.getInventory()::loadFromDatabase); runner.submit(this.getInventory()::loadFromDatabase);
@ -1365,6 +1403,16 @@ public class Player implements PlayerHook, FieldFetch {
} }
*/ */
if (GameHome.HOME_SCENE_IDS.contains(this.getSceneId())) {
this.setSceneId(this.prevScene <= 0 ? 3 : this.prevScene); // if the player in home, make the player go back.
var pos = this.getPrevPosForHome();
if (pos.equals(Position.ZERO)) {
pos = ScriptLoader.getSceneMeta(this.getSceneId()).config.born_pos;
}
this.position.set(pos);
}
// Create world // Create world
World world = new World(this); World world = new World(this);
world.addPlayer(this); world.addPlayer(this);
@ -1413,7 +1461,10 @@ public class Player implements PlayerHook, FieldFetch {
this.furnitureManager.onLogin(); this.furnitureManager.onLogin();
// Home // Home
home = GameHome.getByUid(getUid()); var homeWorld = this.getServer().getHomeWorldOrCreate(this);
homeWorld.setHost(this); // synchronize player object if homeWorld already exists in the server.
this.home = homeWorld.getHome();
this.setCurHomeWorld(homeWorld);
home.onOwnerLogin(this); home.onOwnerLogin(this);
// Activity // Activity
this.activityManager = new ActivityManager(this); this.activityManager = new ActivityManager(this);
@ -1461,6 +1512,8 @@ public class Player implements PlayerHook, FieldFetch {
this.getProfile().setPlayer(null); // Set offline this.getProfile().setPlayer(null); // Set offline
this.getCoopRequests().clear(); this.getCoopRequests().clear();
this.getEnterHomeRequests().values().forEach(req -> this.expireEnterHomeRequest(req, true));
this.getEnterHomeRequests().clear();
// Save to db // Save to db
this.save(); this.save();

View File

@ -14,6 +14,7 @@ public class ItemUseUnlockHomeModule extends ItemUseInt {
@Override @Override
public boolean useItem(UseItemParams params) { public boolean useItem(UseItemParams params) {
return false; params.player.addRealmList(this.i);
return true;
} }
} }

View File

@ -104,6 +104,11 @@ public class MultiplayerSystem extends BaseGameSystem {
} }
public boolean leaveCoop(Player player) { public boolean leaveCoop(Player player) {
// Make sure player is not in home
if (player.getCurHomeWorld().isInHome(player)) {
return false;
}
// Make sure player's world is multiplayer // Make sure player's world is multiplayer
if (!player.getWorld().isMultiplayer()) { if (!player.getWorld().isMultiplayer()) {
return false; return false;

View File

@ -1,7 +1,8 @@
package emu.grasscutter.game.world; package emu.grasscutter.game.world;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.*; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GameDepot;
import emu.grasscutter.data.binout.SceneNpcBornEntry; import emu.grasscutter.data.binout.SceneNpcBornEntry;
import emu.grasscutter.data.binout.routes.Route; import emu.grasscutter.data.binout.routes.Route;
import emu.grasscutter.data.excels.ItemData; import emu.grasscutter.data.excels.ItemData;
@ -11,35 +12,44 @@ import emu.grasscutter.data.excels.scene.SceneData;
import emu.grasscutter.data.excels.world.WorldLevelData; import emu.grasscutter.data.excels.world.WorldLevelData;
import emu.grasscutter.data.server.Grid; import emu.grasscutter.data.server.Grid;
import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.dungeons.*; import emu.grasscutter.game.dungeons.DungeonManager;
import emu.grasscutter.game.dungeons.DungeonSettleListener;
import emu.grasscutter.game.dungeons.challenge.WorldChallenge; import emu.grasscutter.game.dungeons.challenge.WorldChallenge;
import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType; import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
import emu.grasscutter.game.entity.*; import emu.grasscutter.game.entity.*;
import emu.grasscutter.game.entity.gadget.GadgetWorktop; import emu.grasscutter.game.entity.gadget.GadgetWorktop;
import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.managers.blossom.BlossomManager; import emu.grasscutter.game.managers.blossom.BlossomManager;
import emu.grasscutter.game.player.*; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.TeamInfo;
import emu.grasscutter.game.props.*; import emu.grasscutter.game.props.*;
import emu.grasscutter.game.quest.QuestGroupSuite; import emu.grasscutter.game.quest.QuestGroupSuite;
import emu.grasscutter.game.world.data.TeleportProperties; import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult; import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
import emu.grasscutter.net.proto.*; import emu.grasscutter.net.proto.EnterTypeOuterClass;
import emu.grasscutter.net.proto.SelectWorktopOptionReqOuterClass;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType; import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import emu.grasscutter.scripts.*; import emu.grasscutter.scripts.SceneIndexManager;
import emu.grasscutter.scripts.SceneScriptManager;
import emu.grasscutter.scripts.constants.EventType; import emu.grasscutter.scripts.constants.EventType;
import emu.grasscutter.scripts.data.*; import emu.grasscutter.scripts.data.SceneBlock;
import emu.grasscutter.scripts.data.SceneGroup;
import emu.grasscutter.scripts.data.ScriptArgs;
import emu.grasscutter.server.event.entity.EntityCreationEvent; import emu.grasscutter.server.event.entity.EntityCreationEvent;
import emu.grasscutter.server.event.player.PlayerTeleportEvent; import emu.grasscutter.server.event.player.PlayerTeleportEvent;
import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.server.scheduler.ServerTaskScheduler; import emu.grasscutter.server.scheduler.ServerTaskScheduler;
import emu.grasscutter.utils.objects.KahnsSort; import emu.grasscutter.utils.objects.KahnsSort;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import lombok.*; import lombok.Getter;
import lombok.Setter;
import lombok.val;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public final class Scene { public final class Scene {
@ -260,6 +270,13 @@ public final class Scene {
this.removeEntity(gadget); this.removeEntity(gadget);
} }
// Remove player widget gadgets
this.getEntities().values().stream()
.filter(gameEntity -> gameEntity instanceof EntityVehicle)
.map(gameEntity -> (EntityVehicle) gameEntity)
.filter(entityVehicle -> entityVehicle.getOwner().equals(player))
.forEach(entityVehicle -> this.removeEntity(entityVehicle, VisionType.VISION_TYPE_REMOVE));
// Deregister scene if not in use // Deregister scene if not in use
if (this.getPlayerCount() <= 0 && !this.dontDestroyWhenEmpty) { if (this.getPlayerCount() <= 0 && !this.dontDestroyWhenEmpty) {
this.getScriptManager().onDestroy(); this.getScriptManager().onDestroy();

View File

@ -1,17 +1,20 @@
package emu.grasscutter.game.world; package emu.grasscutter.game.world;
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.dungeon.DungeonData; import emu.grasscutter.data.excels.dungeon.DungeonData;
import emu.grasscutter.game.entity.*; import emu.grasscutter.game.entity.EntityTeam;
import emu.grasscutter.game.entity.EntityWorld;
import emu.grasscutter.game.player.Player; 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.*; import emu.grasscutter.game.props.EnterReason;
import emu.grasscutter.game.props.EntityIdType;
import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.game.quest.enums.QuestContent; import emu.grasscutter.game.quest.enums.QuestContent;
import emu.grasscutter.game.world.data.TeleportProperties; import emu.grasscutter.game.world.data.TeleportProperties;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo.*; import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo.SystemHint;
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo.SystemHintType;
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType; import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
import emu.grasscutter.scripts.data.SceneConfig; import emu.grasscutter.scripts.data.SceneConfig;
import emu.grasscutter.server.event.player.PlayerTeleportEvent; import emu.grasscutter.server.event.player.PlayerTeleportEvent;
@ -19,14 +22,23 @@ import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.packet.send.*; import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.ConversionUtils; import emu.grasscutter.utils.ConversionUtils;
import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import java.util.*; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import lombok.*; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter;
import lombok.val;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
public class World implements Iterable<Player> { public class World implements Iterable<Player> {
@Getter private final GameServer server; @Getter private final GameServer server;
@Getter private final Player host; @Getter private Player host;
@Getter private final List<Player> players; @Getter private final List<Player> players;
@Getter private final Int2ObjectMap<Scene> scenes; @Getter private final Int2ObjectMap<Scene> scenes;
@ -65,6 +77,15 @@ public class World implements Iterable<Player> {
this.host.getServer().registerWorld(this); this.host.getServer().registerWorld(this);
} }
public World(GameServer server, Player owner) {
this.server = server;
this.host = owner;
this.players = Collections.synchronizedList(new ArrayList<>());
this.scenes = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
this.entity = new EntityWorld(this);
this.lastUpdateTime = System.currentTimeMillis();
}
public int getLevelEntityId() { public int getLevelEntityId() {
return entity.getId(); return entity.getId();
} }
@ -90,6 +111,10 @@ public class World implements Iterable<Player> {
this.worldLevel = worldLevel; this.worldLevel = worldLevel;
} }
protected synchronized void setHost(Player host) {
this.host = host;
}
/** /**
* Gets an associated scene by ID. Creates a new instance of the scene if it doesn't exist. * Gets an associated scene by ID. Creates a new instance of the scene if it doesn't exist.
* *
@ -179,6 +204,58 @@ public class World implements Iterable<Player> {
} }
} }
public synchronized void addPlayer(Player player, int newSceneId) {
// Check if player already in
if (this.getPlayers().contains(player)) {
return;
}
// Remove player from prev world
if (player.getWorld() != null) {
player.getWorld().removePlayer(player);
}
// Register
player.setWorld(this);
this.getPlayers().add(player);
// Set player variables
player.setPeerId(this.getNextPeerId());
player.getTeamManager().setEntity(new EntityTeam(player));
// player.getTeamManager().setEntityId(this.getNextEntityId(EntityIdType.TEAM));
// Copy main team to multiplayer team
if (this.isMultiplayer()) {
player
.getTeamManager()
.getMpTeam()
.copyFrom(
player.getTeamManager().getCurrentSinglePlayerTeamInfo(),
player.getTeamManager().getMaxTeamSize());
player.getTeamManager().setCurrentCharacterIndex(0);
if (player != this.getHost()) {
this.broadcastPacket(
new PacketPlayerChatNotify(
player,
0,
SystemHint.newBuilder()
.setType(SystemHintType.SYSTEM_HINT_TYPE_CHAT_ENTER_WORLD.getNumber())
.build()));
}
}
// Add to scene
player.setSceneId(newSceneId);
Scene scene = this.getSceneById(player.getSceneId());
scene.addPlayer(player);
// Info packet for other players
if (this.getPlayers().size() > 1) {
this.updatePlayerInfos(player);
}
}
public synchronized void removePlayer(Player player) { public synchronized void removePlayer(Player player) {
// Remove team entities // Remove team entities
player.sendPacket( player.sendPacket(
@ -389,7 +466,7 @@ public class World implements Iterable<Player> {
return true; return true;
} }
private void updatePlayerInfos(Player paramPlayer) { protected void updatePlayerInfos(Player paramPlayer) {
for (Player player : this.getPlayers()) { for (Player player : this.getPlayers()) {
// Dont send packets if player is logging in and filter out joining player // Dont send packets if player is logging in and filter out joining player
if (!player.hasSentLoginPackets() || player == paramPlayer) { if (!player.hasSentLoginPackets() || player == paramPlayer) {
@ -408,7 +485,7 @@ public class World implements Iterable<Player> {
} }
// Dont send packets if player is loading into the scene // Dont send packets if player is loading into the scene
if (player.getSceneLoadState().getValue() < SceneLoadState.INIT.getValue()) { if (player.getSceneLoadState().getValue() >= SceneLoadState.INIT.getValue()) {
// World player info packets // World player info packets
player.getSession().send(new PacketWorldPlayerInfoNotify(this)); player.getSession().send(new PacketWorldPlayerInfoNotify(this));
player.getSession().send(new PacketScenePlayerInfoNotify(this)); player.getSession().send(new PacketScenePlayerInfoNotify(this));

View File

@ -0,0 +1,22 @@
package emu.grasscutter.server.event.player;
import emu.grasscutter.game.home.GameHome;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.event.Cancellable;
import emu.grasscutter.server.event.types.PlayerEvent;
import lombok.Getter;
@Getter
public final class PlayerEnterHomeEvent extends PlayerEvent implements Cancellable {
private final GameHome home;
private final Player homeOwner;
private final boolean isOtherHome;
public PlayerEnterHomeEvent(Player player, Player homeOwner, GameHome home) {
super(player);
this.home = home;
this.homeOwner = homeOwner;
this.isOtherHome = this.getPlayer().equals(this.homeOwner);
}
}

View File

@ -0,0 +1,26 @@
package emu.grasscutter.server.event.player;
import emu.grasscutter.game.home.GameHome;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.event.types.PlayerEvent;
public class PlayerLeaveHomeEvent extends PlayerEvent {
private final GameHome home;
private final Player homeOwner;
private final boolean isOtherHome;
private final Reason reason;
public PlayerLeaveHomeEvent(Player player, Player homeOwner, GameHome home, Reason reason) {
super(player);
this.homeOwner = homeOwner;
this.home = home;
this.reason = reason;
this.isOtherHome = !this.getPlayer().equals(this.homeOwner);
}
public enum Reason {
PLAYER_LEAVE,
KICKED
}
}

View File

@ -1,45 +1,67 @@
package emu.grasscutter.server.game; package emu.grasscutter.server.game;
import static emu.grasscutter.config.Configuration.*; import emu.grasscutter.GameConstants;
import static emu.grasscutter.utils.lang.Language.translate; import emu.grasscutter.Grasscutter;
import emu.grasscutter.*;
import emu.grasscutter.Grasscutter.ServerRunMode; import emu.grasscutter.Grasscutter.ServerRunMode;
import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.Account; import emu.grasscutter.game.Account;
import emu.grasscutter.game.battlepass.BattlePassSystem; import emu.grasscutter.game.battlepass.BattlePassSystem;
import emu.grasscutter.game.chat.*; import emu.grasscutter.game.chat.ChatSystem;
import emu.grasscutter.game.chat.ChatSystemHandler;
import emu.grasscutter.game.combine.CombineManger; import emu.grasscutter.game.combine.CombineManger;
import emu.grasscutter.game.drop.*; import emu.grasscutter.game.drop.DropSystem;
import emu.grasscutter.game.drop.DropSystemLegacy;
import emu.grasscutter.game.dungeons.DungeonSystem; import emu.grasscutter.game.dungeons.DungeonSystem;
import emu.grasscutter.game.expedition.ExpeditionSystem; import emu.grasscutter.game.expedition.ExpeditionSystem;
import emu.grasscutter.game.gacha.GachaSystem; import emu.grasscutter.game.gacha.GachaSystem;
import emu.grasscutter.game.managers.cooking.*; import emu.grasscutter.game.home.HomeWorld;
import emu.grasscutter.game.home.HomeWorldMPSystem;
import emu.grasscutter.game.managers.cooking.CookingCompoundManager;
import emu.grasscutter.game.managers.cooking.CookingManager;
import emu.grasscutter.game.managers.energy.EnergyManager; import emu.grasscutter.game.managers.energy.EnergyManager;
import emu.grasscutter.game.managers.stamina.StaminaManager; import emu.grasscutter.game.managers.stamina.StaminaManager;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.quest.QuestSystem; import emu.grasscutter.game.quest.QuestSystem;
import emu.grasscutter.game.shop.ShopSystem; import emu.grasscutter.game.shop.ShopSystem;
import emu.grasscutter.game.systems.*; import emu.grasscutter.game.systems.AnnouncementSystem;
import emu.grasscutter.game.systems.InventorySystem;
import emu.grasscutter.game.systems.MultiplayerSystem;
import emu.grasscutter.game.talk.TalkSystem; import emu.grasscutter.game.talk.TalkSystem;
import emu.grasscutter.game.tower.TowerSystem; import emu.grasscutter.game.tower.TowerSystem;
import emu.grasscutter.game.world.*; import emu.grasscutter.game.world.World;
import emu.grasscutter.game.world.WorldDataSystem;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail;
import emu.grasscutter.server.dispatch.DispatchClient; import emu.grasscutter.server.dispatch.DispatchClient;
import emu.grasscutter.server.event.game.ServerTickEvent; import emu.grasscutter.server.event.game.ServerTickEvent;
import emu.grasscutter.server.event.internal.*; import emu.grasscutter.server.event.internal.ServerStartEvent;
import emu.grasscutter.server.event.internal.ServerStopEvent;
import emu.grasscutter.server.event.types.ServerEvent; import emu.grasscutter.server.event.types.ServerEvent;
import emu.grasscutter.server.scheduler.ServerTaskScheduler; import emu.grasscutter.server.scheduler.ServerTaskScheduler;
import emu.grasscutter.task.TaskMap; import emu.grasscutter.task.TaskMap;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
import java.net.*; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import java.time.*; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import java.util.*; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.concurrent.*; import kcp.highway.ChannelConfig;
import kcp.highway.*; import kcp.highway.KcpServer;
import lombok.*; import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.net.InetSocketAddress;
import java.net.URI;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import static emu.grasscutter.config.Configuration.DISPATCH_INFO;
import static emu.grasscutter.config.Configuration.GAME_INFO;
import static emu.grasscutter.utils.lang.Language.translate;
@Getter @Getter
public final class GameServer extends KcpServer implements Iterable<Player> { public final class GameServer extends KcpServer implements Iterable<Player> {
@ -48,6 +70,7 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
private final GameServerPacketHandler packetHandler; private final GameServerPacketHandler packetHandler;
private final Map<Integer, Player> players; private final Map<Integer, Player> players;
private final Set<World> worlds; private final Set<World> worlds;
private final Int2ObjectMap<HomeWorld> homeWorlds;
@Setter private DispatchClient dispatchClient; @Setter private DispatchClient dispatchClient;
@ -56,6 +79,7 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
private final GachaSystem gachaSystem; private final GachaSystem gachaSystem;
private final ShopSystem shopSystem; private final ShopSystem shopSystem;
private final MultiplayerSystem multiplayerSystem; private final MultiplayerSystem multiplayerSystem;
private final HomeWorldMPSystem homeWorldMPSystem;
private final DungeonSystem dungeonSystem; private final DungeonSystem dungeonSystem;
private final ExpeditionSystem expeditionSystem; private final ExpeditionSystem expeditionSystem;
private final DropSystem dropSystem; private final DropSystem dropSystem;
@ -98,11 +122,13 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
this.dispatchClient = null; this.dispatchClient = null;
this.players = null; this.players = null;
this.worlds = null; this.worlds = null;
this.homeWorlds = null;
this.inventorySystem = null; this.inventorySystem = null;
this.gachaSystem = null; this.gachaSystem = null;
this.shopSystem = null; this.shopSystem = null;
this.multiplayerSystem = null; this.multiplayerSystem = null;
this.homeWorldMPSystem = null;
this.dungeonSystem = null; this.dungeonSystem = null;
this.expeditionSystem = null; this.expeditionSystem = null;
this.dropSystem = null; this.dropSystem = null;
@ -140,6 +166,7 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
this.dispatchClient = new DispatchClient(GameServer.getDispatchUrl()); this.dispatchClient = new DispatchClient(GameServer.getDispatchUrl());
this.players = new ConcurrentHashMap<>(); this.players = new ConcurrentHashMap<>();
this.worlds = Collections.synchronizedSet(new HashSet<>()); this.worlds = Collections.synchronizedSet(new HashSet<>());
this.homeWorlds = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<>());
// Extra // Extra
this.scheduler = new ServerTaskScheduler(); this.scheduler = new ServerTaskScheduler();
@ -150,6 +177,7 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
this.gachaSystem = new GachaSystem(this); this.gachaSystem = new GachaSystem(this);
this.shopSystem = new ShopSystem(this); this.shopSystem = new ShopSystem(this);
this.multiplayerSystem = new MultiplayerSystem(this); this.multiplayerSystem = new MultiplayerSystem(this);
this.homeWorldMPSystem = new HomeWorldMPSystem(this);
this.dungeonSystem = new DungeonSystem(this); this.dungeonSystem = new DungeonSystem(this);
this.dropSystem = new DropSystem(this); this.dropSystem = new DropSystem(this);
this.dropSystemLegacy = new DropSystemLegacy(this); this.dropSystemLegacy = new DropSystemLegacy(this);
@ -198,10 +226,12 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
getPlayers().put(player.getUid(), player); getPlayers().put(player.getUid(), player);
} }
@Nullable
public Player getPlayerByUid(int id) { public Player getPlayerByUid(int id) {
return this.getPlayerByUid(id, false); return this.getPlayerByUid(id, false);
} }
@Nullable
public Player getPlayerByUid(int id, boolean allowOfflinePlayers) { public Player getPlayerByUid(int id, boolean allowOfflinePlayers) {
// Console check // Console check
if (id == GameConstants.SERVER_CONSOLE_UID) { if (id == GameConstants.SERVER_CONSOLE_UID) {
@ -295,6 +325,15 @@ public final class GameServer extends KcpServer implements Iterable<Player> {
world.save(); // Save the player's world world.save(); // Save the player's world
} }
public void registerHomeWorld(HomeWorld homeWorld) {
this.getHomeWorlds().put(homeWorld.getOwnerUid(), homeWorld);
this.registerWorld(homeWorld);
}
public HomeWorld getHomeWorldOrCreate(Player owner) {
return this.getHomeWorlds().computeIfAbsent(owner.getUid(), (uid) -> new HomeWorld(this, owner));
}
public void start() { public void start() {
if (Grasscutter.getRunMode() == ServerRunMode.GAME_ONLY) { if (Grasscutter.getRunMode() == ServerRunMode.GAME_ONLY) {
// Connect to dispatch server. // Connect to dispatch server.

View File

@ -1,10 +1,9 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType; import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketBackMyWorldRsp; import emu.grasscutter.server.packet.send.PacketBackMyWorldRsp;
@ -13,23 +12,15 @@ public class HandlerBackMyWorldReq 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 {
Scene scene = session.getPlayer().getScene(); int prevScene = session.getPlayer().getPrevScene();
int prevScene = scene.getPrevScene();
// Sanity check for switching between teapot realms // Sanity check for switching between teapot realms
if (prevScene >= 2000 && prevScene <= 2400) { if (prevScene >= 2000 && prevScene <= 2400) {
prevScene = 3; prevScene = 3;
} }
session boolean result = session.getServer().getHomeWorldMPSystem().leaveCoop(session.getPlayer(), prevScene);
.getPlayer()
.getWorld()
.transferPlayerToScene(
session.getPlayer(),
prevScene,
TeleportType.WAYPOINT,
session.getPlayer().getPrevPos());
session.send(new PacketBackMyWorldRsp()); session.send(new PacketBackMyWorldRsp(result ? 0 : RetcodeOuterClass.Retcode.RET_FAIL_VALUE));
} }
} }

View File

@ -52,7 +52,7 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
// Handle movement // Handle movement
EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData()); EntityMoveInfo moveInfo = EntityMoveInfo.parseFrom(entry.getCombatData());
GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId()); GameEntity entity = session.getPlayer().getScene().getEntityById(moveInfo.getEntityId());
if (entity != null) { if (entity != null && session.getPlayer().getSceneLoadState() != Player.SceneLoadState.LOADING) {
// Move player // Move player
MotionInfo motionInfo = moveInfo.getMotionInfo(); MotionInfo motionInfo = moveInfo.getMotionInfo();
MotionState motionState = motionInfo.getState(); MotionState motionState = motionInfo.getState();

View File

@ -20,7 +20,7 @@ public class HandlerHomeChangeBgmReq extends PacketHandler {
home.getHomeSceneItem(session.getPlayer().getSceneId()).setHomeBgmId(homeBgmId); home.getHomeSceneItem(session.getPlayer().getSceneId()).setHomeBgmId(homeBgmId);
home.save(); home.save();
session.send(new PacketHomeChangeBgmNotify(homeBgmId)); session.getPlayer().getScene().broadcastPacket(new PacketHomeChangeBgmNotify(homeBgmId));
session.send(new PacketHomeChangeBgmRsp()); session.send(new PacketHomeChangeBgmRsp());
} }
} }

View File

@ -4,6 +4,7 @@ import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeChangeEditModeReqOuterClass; import emu.grasscutter.net.proto.HomeChangeEditModeReqOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify; import emu.grasscutter.server.packet.send.PacketHomeBasicInfoNotify;
import emu.grasscutter.server.packet.send.PacketHomeChangeEditModeRsp; import emu.grasscutter.server.packet.send.PacketHomeChangeEditModeRsp;
@ -17,6 +18,13 @@ public class HandlerHomeChangeEditModeReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = HomeChangeEditModeReqOuterClass.HomeChangeEditModeReq.parseFrom(payload); var req = HomeChangeEditModeReqOuterClass.HomeChangeEditModeReq.parseFrom(payload);
if (req.getIsEnterEditMode() && !session.getPlayer().getCurHomeWorld().getGuests().isEmpty()) {
session.send(new PacketHomeChangeEditModeRsp(RetcodeOuterClass.Retcode.RET_HOME_HAS_GUEST_VALUE));
return;
}
session.getPlayer().setInEditMode(req.getIsEnterEditMode());
session.getPlayer().getCurHomeWorld().getHome().save();
session.send(new PacketHomePreChangeEditModeNotify(req.getIsEnterEditMode())); session.send(new PacketHomePreChangeEditModeNotify(req.getIsEnterEditMode()));
session.send(new PacketHomeBasicInfoNotify(session.getPlayer(), req.getIsEnterEditMode())); session.send(new PacketHomeBasicInfoNotify(session.getPlayer(), req.getIsEnterEditMode()));
session.send(new PacketHomeComfortInfoNotify(session.getPlayer())); session.send(new PacketHomeComfortInfoNotify(session.getPlayer()));

View File

@ -0,0 +1,15 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeGetOnlineStatusRsp;
@Opcodes(PacketOpcodes.HomeGetOnlineStatusReq)
public class HandlerHomeGetOnlineStatusReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
session.send(new PacketHomeGetOnlineStatusRsp(session.getPlayer().getCurHomeWorld().getGuests()));
}
}

View File

@ -0,0 +1,29 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeKickPlayerReqOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeKickPlayerRsp;
import java.util.concurrent.atomic.AtomicBoolean;
@Opcodes(PacketOpcodes.HomeKickPlayerReq)
public class HandlerHomeKickPlayerReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = HomeKickPlayerReqOuterClass.HomeKickPlayerReq.parseFrom(payload);
var success = new AtomicBoolean();
session.getPlayer().getCurHomeWorld().getGuests().stream()
.filter(player -> player.getUid() == req.getTargetUid())
.findFirst()
.ifPresent(player -> {
success.set(session.getServer().getHomeWorldMPSystem().kickPlayerFromHome(session.getPlayer(), player.getUid()));
});
session.send(new PacketHomeKickPlayerRsp(success.get() ? 0 : RetcodeOuterClass.Retcode.RET_FAIL_VALUE, req));
}
}

View File

@ -0,0 +1,16 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeSaveArrangementNoChangeReqOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeSaveArrangementNoChangeRsp;
@Opcodes(PacketOpcodes.HomeSaveArrangementNoChangeReq)
public class HandlerHomeSaveArrangementNoChangeReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
session.send(new PacketHomeSaveArrangementNoChangeRsp(HomeSaveArrangementNoChangeReqOuterClass.HomeSaveArrangementNoChangeReq.parseFrom(payload).getSceneId()));
}
}

View File

@ -3,14 +3,29 @@ package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.OtherPlayerEnterHomeNotifyOuterClass;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeMarkPointNotify;
import emu.grasscutter.server.packet.send.PacketHomeSceneInitFinishRsp; import emu.grasscutter.server.packet.send.PacketHomeSceneInitFinishRsp;
import emu.grasscutter.server.packet.send.PacketOtherPlayerEnterOrLeaveHomeNotify;
@Opcodes(PacketOpcodes.HomeSceneInitFinishReq) @Opcodes(PacketOpcodes.HomeSceneInitFinishReq)
public class HandlerHomeSceneInitFinishReq extends PacketHandler { public class HandlerHomeSceneInitFinishReq 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 {
var curHomeWorld = session.getPlayer().getCurHomeWorld();
if (!session.getPlayer().isHasSentInitPacketInHome()) {
session.getPlayer().setHasSentInitPacketInHome(true);
if (curHomeWorld.getHost().isOnline() && !curHomeWorld.getHost().equals(session.getPlayer())) {
curHomeWorld.getHost().sendPacket(new PacketOtherPlayerEnterOrLeaveHomeNotify(session.getPlayer(), OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason.ENTER));
}
}
session.send(new PacketHomeMarkPointNotify(session.getPlayer()));
session.send(new PacketHomeSceneInitFinishRsp()); session.send(new PacketHomeSceneInitFinishRsp());
} }
} }

View File

@ -1,7 +1,5 @@
package emu.grasscutter.server.packet.recv; package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.world.Position;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
@ -16,19 +14,16 @@ public class HandlerHomeSceneJumpReq extends PacketHandler {
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = HomeSceneJumpReqOuterClass.HomeSceneJumpReq.parseFrom(payload); var req = HomeSceneJumpReqOuterClass.HomeSceneJumpReq.parseFrom(payload);
int realmId = 2000 + session.getPlayer().getCurrentRealmId(); var world = session.getPlayer().getCurHomeWorld();
var home = world.getHome();
var home = session.getPlayer().getHome(); var owner = world.getHost();
int realmId = 2000 + owner.getCurrentRealmId();
var homeScene = home.getHomeSceneItem(realmId); var homeScene = home.getHomeSceneItem(realmId);
home.save(); home.save();
Scene scene = var scene = world.getSceneById(req.getIsEnterRoomScene() ? homeScene.getRoomSceneId() : realmId);
session var pos = scene.getScriptManager().getConfig().born_pos;
.getPlayer() var rot = home.getSceneMap().get(scene.getId()).getBornRot();
.getWorld()
.getSceneById(req.getIsEnterRoomScene() ? homeScene.getRoomSceneId() : realmId);
Position pos = scene.getScriptManager().getConfig().born_pos;
Position rot = home.getSceneMap().get(scene.getId()).getBornRot();
// Make player face correct direction when entering or exiting // Make player face correct direction when entering or exiting
session.getPlayer().getRotation().set(rot); session.getPlayer().getRotation().set(rot);
@ -38,13 +33,7 @@ public class HandlerHomeSceneJumpReq extends PacketHandler {
pos = home.getSceneMap().get(realmId).getBornPos(); pos = home.getSceneMap().get(realmId).getBornPos();
} }
session world.transferPlayerToScene(session.getPlayer(), req.getIsEnterRoomScene() ? homeScene.getRoomSceneId() : realmId, pos);
.getPlayer()
.getWorld()
.transferPlayerToScene(
session.getPlayer(),
req.getIsEnterRoomScene() ? homeScene.getRoomSceneId() : realmId,
pos);
session.send(new PacketHomeSceneJumpRsp(req.getIsEnterRoomScene())); session.send(new PacketHomeSceneJumpRsp(req.getIsEnterRoomScene()));
} }

View File

@ -0,0 +1,41 @@
package emu.grasscutter.server.packet.recv;
import com.github.davidmoten.guavamini.Lists;
import emu.grasscutter.game.home.HomeFurnitureItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeTransferReqOuterClass;
import emu.grasscutter.server.game.GameSession;
import java.util.List;
@Opcodes(PacketOpcodes.HomeTransferReq)
public class HandlerHomeTransferReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = HomeTransferReqOuterClass.HomeTransferReq.parseFrom(payload);
var player = session.getPlayer();
var home = player.getCurHomeWorld().getHome();
var item = home.getHomeSceneItem(player.getSceneId());
if (req.getIsTransferToSafePoint()) {
player.getCurHomeWorld().transferPlayerToScene(player, player.getSceneId(), item.getBornPos());
} else {
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());
});
}
}
session.send(new BasePacket(PacketOpcodes.HomeTransferRsp));
}
}

View File

@ -5,6 +5,7 @@ import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeUpdateArrangementInfoReqOuterClass; import emu.grasscutter.net.proto.HomeUpdateArrangementInfoReqOuterClass;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketHomeMarkPointNotify;
import emu.grasscutter.server.packet.send.PacketHomeUpdateArrangementInfoRsp; import emu.grasscutter.server.packet.send.PacketHomeUpdateArrangementInfoRsp;
@Opcodes(PacketOpcodes.HomeUpdateArrangementInfoReq) @Opcodes(PacketOpcodes.HomeUpdateArrangementInfoReq)
@ -20,6 +21,8 @@ public class HandlerHomeUpdateArrangementInfoReq extends PacketHandler {
homeScene.update(req.getSceneArrangementInfo()); homeScene.update(req.getSceneArrangementInfo());
session.send(new PacketHomeMarkPointNotify(session.getPlayer()));
session.getPlayer().getHome().save(); session.getPlayer().getHome().save();
session.send(new PacketHomeUpdateArrangementInfoRsp()); session.send(new PacketHomeUpdateArrangementInfoRsp());

View File

@ -0,0 +1,19 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerApplyEnterHomeResultReqOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketPlayerApplyEnterHomeResultRsp;
@Opcodes(PacketOpcodes.PlayerApplyEnterHomeResultReq)
public class HandlerPlayerApplyEnterHomeResultReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = PlayerApplyEnterHomeResultReqOuterClass.PlayerApplyEnterHomeResultReq.parseFrom(payload);
session.getServer().getHomeWorldMPSystem().acceptEnterHomeRequest(session.getPlayer(), req.getApplyUid(), req.getIsAgreed());
session.send(new PacketPlayerApplyEnterHomeResultRsp(req.getApplyUid(), req.getIsAgreed()));
}
}

View File

@ -19,16 +19,20 @@ public class HandlerSceneTransToPointReq extends PacketHandler {
var player = session.getPlayer(); var player = session.getPlayer();
ScenePointEntry scenePointEntry = ScenePointEntry scenePointEntry =
GameData.getScenePointEntryById(req.getSceneId(), req.getPointId()); GameData.getScenePointEntryById(req.getSceneId(), req.getPointId());
if (scenePointEntry != null) { if (scenePointEntry != null) {
if (player if (player.getCurHomeWorld().isInHome(player)) { // if the player is in home, make the player go back
.getWorld() session.getServer().getHomeWorldMPSystem().leaveCoop(player, req.getSceneId(), scenePointEntry.getPointData().getTranPos().clone());
.transferPlayerToScene( session.send(new PacketSceneTransToPointRsp(player, req.getPointId(), req.getSceneId()));
player, return;
req.getSceneId(), } else if (player
TeleportType.WAYPOINT, .getWorld()
scenePointEntry.getPointData().getTranPos().clone())) { .transferPlayerToScene(
player,
req.getSceneId(),
TeleportType.WAYPOINT,
scenePointEntry.getPointData().getTranPos().clone())) {
session.send(new PacketSceneTransToPointRsp(player, req.getPointId(), req.getSceneId())); session.send(new PacketSceneTransToPointRsp(player, req.getPointId(), req.getSceneId()));
return; return;
} }

View File

@ -1,72 +1,52 @@
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.game.world.Position;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass; import emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.TryEnterHomeReqOuterClass; import emu.grasscutter.net.proto.TryEnterHomeReqOuterClass;
import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
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;
@Opcodes(PacketOpcodes.TryEnterHomeReq) @Opcodes(PacketOpcodes.TryEnterHomeReq)
public class HandlerTryEnterHomeReq extends PacketHandler { public class HandlerTryEnterHomeReq 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 {
var req = TryEnterHomeReqOuterClass.TryEnterHomeReq.parseFrom(payload); var req = TryEnterHomeReqOuterClass.TryEnterHomeReq.parseFrom(payload);
var targetPlayer = session.getServer().getPlayerByUid(req.getTargetUid(), true); var targetPlayer = session.getServer().getPlayerByUid(req.getTargetUid(), true);
if (req.getTargetUid() != session.getPlayer().getUid()) { if (targetPlayer == null || !GameHome.doesHomeExist(targetPlayer.getUid())) {
// I hope that tomorrow there will be a hero who can support multiplayer mode and write code
// like a poem
var targetHome = GameHome.getByUid(req.getTargetUid());
switch (targetHome.getEnterHomeOption()) {
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
.FRIEND_ENTER_HOME_OPTION_NEED_CONFIRM_VALUE:
if (!targetPlayer.isOnline()) {
session.send(
new PacketTryEnterHomeRsp(
RetcodeOuterClass.Retcode.RET_HOME_OWNER_OFFLINE_VALUE, req.getTargetUid()));
return;
}
break;
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
.FRIEND_ENTER_HOME_OPTION_REFUSE_VALUE:
session.send(
new PacketTryEnterHomeRsp(
RetcodeOuterClass.Retcode.RET_HOME_HOME_REFUSE_GUEST_ENTER_VALUE,
req.getTargetUid()));
return;
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
.FRIEND_ENTER_HOME_OPTION_DIRECT_VALUE:
break;
}
session.send(new PacketTryEnterHomeRsp()); session.send(new PacketTryEnterHomeRsp());
return; return;
} }
int realmId = 2000 + session.getPlayer().getCurrentRealmId(); var targetHome = session.getServer().getHomeWorldOrCreate(targetPlayer).getHome();
var home = session.getPlayer().getHome(); if (req.getTargetUid() != session.getPlayer().getUid()) {
// I hope that tomorrow there will be a hero who can support multiplayer mode and write code
// like a poem
// A person who rote this comment, I DID IT!!!!!! by hamusuke.
switch (targetHome.getEnterHomeOption()) {
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_NEED_CONFIRM_VALUE -> {
if (!targetPlayer.isOnline()) {
session.send(new PacketTryEnterHomeRsp(RetcodeOuterClass.Retcode.RET_HOME_OWNER_OFFLINE_VALUE, req.getTargetUid()));
} else {
session.getServer().getHomeWorldMPSystem().sendEnterHomeRequest(session.getPlayer(), req.getTargetUid());
}
}
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_REFUSE_VALUE -> {
session.send(new PacketTryEnterHomeRsp(RetcodeOuterClass.Retcode.RET_HOME_HOME_REFUSE_GUEST_ENTER_VALUE, req.getTargetUid()));
}
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_DIRECT_VALUE -> {
session.getServer().getHomeWorldMPSystem().enterHome(session.getPlayer(), targetPlayer);
}
}
// prepare the default arrangement for first come in return;
var homeScene = home.getHomeSceneItem(realmId); }
home.save();
Scene scene = session.getPlayer().getWorld().getSceneById(realmId); session.getServer().getHomeWorldMPSystem().enterHome(session.getPlayer(), targetPlayer);
Position pos = scene.getScriptManager().getConfig().born_pos;
boolean result =
session
.getPlayer()
.getWorld()
.transferPlayerToScene(session.getPlayer(), realmId, TeleportType.WAYPOINT, pos);
if (result) session.send(new PacketTryEnterHomeRsp(req.getTargetUid()));
} }
} }

View File

@ -6,10 +6,10 @@ import emu.grasscutter.net.proto.BackMyWorldRspOuterClass;
public class PacketBackMyWorldRsp extends BasePacket { public class PacketBackMyWorldRsp extends BasePacket {
public PacketBackMyWorldRsp() { public PacketBackMyWorldRsp(int retcode) {
super(PacketOpcodes.BackMyWorldRsp); super(PacketOpcodes.BackMyWorldRsp);
var proto = BackMyWorldRspOuterClass.BackMyWorldRsp.newBuilder(); var proto = BackMyWorldRspOuterClass.BackMyWorldRsp.newBuilder().setRetcode(retcode);
this.setData(proto.build()); this.setData(proto.build());
} }

View File

@ -1,18 +1,19 @@
package emu.grasscutter.server.packet.send; package emu.grasscutter.server.packet.send;
import static emu.grasscutter.config.Configuration.GAME_INFO;
import emu.grasscutter.GameConstants; import emu.grasscutter.GameConstants;
import emu.grasscutter.game.friends.Friendship; import emu.grasscutter.game.friends.Friendship;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief; import emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief;
import emu.grasscutter.net.proto.FriendEnterHomeOptionOuterClass;
import emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState; import emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState;
import emu.grasscutter.net.proto.GetPlayerFriendListRspOuterClass.GetPlayerFriendListRsp; import emu.grasscutter.net.proto.GetPlayerFriendListRspOuterClass.GetPlayerFriendListRsp;
import emu.grasscutter.net.proto.PlatformTypeOuterClass; import emu.grasscutter.net.proto.PlatformTypeOuterClass;
import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture; import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture;
import static emu.grasscutter.config.Configuration.GAME_INFO;
public class PacketGetPlayerFriendListRsp extends BasePacket { public class PacketGetPlayerFriendListRsp extends BasePacket {
public PacketGetPlayerFriendListRsp(Player player) { public PacketGetPlayerFriendListRsp(Player player) {
@ -33,6 +34,7 @@ public class PacketGetPlayerFriendListRsp extends BasePacket {
.setParam(1) .setParam(1)
.setIsGameSource(true) .setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC) .setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.setFriendEnterHomeOptionValue(FriendEnterHomeOptionOuterClass.FriendEnterHomeOption.FRIEND_ENTER_HOME_OPTION_REFUSE_VALUE)
.build(); .build();
GetPlayerFriendListRsp.Builder proto = GetPlayerFriendListRsp.Builder proto =

View File

@ -11,26 +11,27 @@ public class PacketHomeBasicInfoNotify extends BasePacket {
public PacketHomeBasicInfoNotify(Player player, boolean editMode) { public PacketHomeBasicInfoNotify(Player player, boolean editMode) {
super(PacketOpcodes.HomeBasicInfoNotify); super(PacketOpcodes.HomeBasicInfoNotify);
if (player.getCurrentRealmId() <= 0) { if (player.getCurrentRealmId() <= 0 && player.getCurHomeWorld() == null) {
return; return;
} }
var proto = HomeBasicInfoNotifyOuterClass.HomeBasicInfoNotify.newBuilder(); var proto = HomeBasicInfoNotifyOuterClass.HomeBasicInfoNotify.newBuilder();
var home = player.getCurHomeWorld().getHome();
var sceneId = player.getCurrentRealmId() + 2000; var owner = home.getPlayer();
var homeScene = player.getHome().getHomeSceneItem(sceneId); var sceneId = owner.getCurrentRealmId() + 2000;
var homeScene = home.getHomeSceneItem(sceneId);
proto.setBasicInfo( proto.setBasicInfo(
HomeBasicInfoOuterClass.HomeBasicInfo.newBuilder() HomeBasicInfoOuterClass.HomeBasicInfo.newBuilder()
.setCurModuleId(player.getCurrentRealmId()) .setCurModuleId(owner.getCurrentRealmId())
.setCurRoomSceneId(homeScene.getRoomSceneId()) .setCurRoomSceneId(homeScene.getRoomSceneId())
.setIsInEditMode(editMode) .setIsInEditMode(editMode)
.setHomeOwnerUid(player.getUid()) .setHomeOwnerUid(owner.getUid())
.setExp(player.getHome().getExp()) .setExp(home.getExp())
.setLevel(player.getHome().getLevel()) .setLevel(home.getLevel())
.setOwnerNickName(player.getNickname()) .setOwnerNickName(owner.getNickname())
// TODO limit shop // TODO limit shop
.build()); .build());
this.setData(proto); this.setData(proto);
} }

View File

@ -15,4 +15,11 @@ public class PacketHomeChangeEditModeRsp extends BasePacket {
this.setData(proto); this.setData(proto);
} }
public PacketHomeChangeEditModeRsp(int retcode) {
super(PacketOpcodes.HomeChangeEditModeRsp);
this.setData(HomeChangeEditModeRspOuterClass.HomeChangeEditModeRsp.newBuilder()
.setRetcode(retcode));
}
} }

View File

@ -5,6 +5,7 @@ import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeGetArrangementInfoRspOuterClass; import emu.grasscutter.net.proto.HomeGetArrangementInfoRspOuterClass;
import java.util.List; import java.util.List;
public class PacketHomeGetArrangementInfoRsp extends BasePacket { public class PacketHomeGetArrangementInfoRsp extends BasePacket {
@ -12,16 +13,12 @@ public class PacketHomeGetArrangementInfoRsp extends BasePacket {
public PacketHomeGetArrangementInfoRsp(Player player, List<Integer> sceneIdList) { public PacketHomeGetArrangementInfoRsp(Player player, List<Integer> sceneIdList) {
super(PacketOpcodes.HomeGetArrangementInfoRsp); super(PacketOpcodes.HomeGetArrangementInfoRsp);
var home = player.getHome();
var homeScenes =
sceneIdList.stream().map(home::getHomeSceneItem).map(HomeSceneItem::toProto).toList();
home.save();
var proto = HomeGetArrangementInfoRspOuterClass.HomeGetArrangementInfoRsp.newBuilder(); var proto = HomeGetArrangementInfoRspOuterClass.HomeGetArrangementInfoRsp.newBuilder();
var home = player.getCurHomeWorld().getHome();
var homeScenes =
sceneIdList.stream().map(home::getHomeSceneItem).map(HomeSceneItem::toProto).toList();
proto.addAllSceneArrangementInfoList(homeScenes); proto.addAllSceneArrangementInfoList(homeScenes);
home.save();
this.setData(proto); this.setData(proto);
} }

View File

@ -0,0 +1,17 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeGetOnlineStatusRspOuterClass;
import java.util.List;
public class PacketHomeGetOnlineStatusRsp extends BasePacket {
public PacketHomeGetOnlineStatusRsp(List<Player> guests) {
super(PacketOpcodes.HomeGetOnlineStatusRsp);
this.setData(HomeGetOnlineStatusRspOuterClass.HomeGetOnlineStatusRsp.newBuilder()
.addAllPlayerInfoList(guests.stream().map(Player::getOnlinePlayerInfo).toList()));
}
}

View File

@ -0,0 +1,17 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeKickPlayerReqOuterClass;
import emu.grasscutter.net.proto.HomeKickPlayerRspOuterClass;
public class PacketHomeKickPlayerRsp extends BasePacket {
public PacketHomeKickPlayerRsp(int retcode, HomeKickPlayerReqOuterClass.HomeKickPlayerReq req) {
super(PacketOpcodes.HomeKickPlayerRsp);
this.setData(HomeKickPlayerRspOuterClass.HomeKickPlayerRsp.newBuilder()
.setIsKickAll(req.getIsKickAll())
.setTargetUid(req.getTargetUid())
.setRetcode(retcode));
}
}

View File

@ -6,6 +6,7 @@ import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeMarkPointNotifyOuterClass; import emu.grasscutter.net.proto.HomeMarkPointNotifyOuterClass;
import emu.grasscutter.net.proto.HomeMarkPointSceneDataOuterClass; import emu.grasscutter.net.proto.HomeMarkPointSceneDataOuterClass;
import java.util.Collection; import java.util.Collection;
public class PacketHomeMarkPointNotify extends BasePacket { public class PacketHomeMarkPointNotify extends BasePacket {
@ -14,28 +15,32 @@ public class PacketHomeMarkPointNotify extends BasePacket {
super(PacketOpcodes.HomeMarkPointNotify); super(PacketOpcodes.HomeMarkPointNotify);
var proto = HomeMarkPointNotifyOuterClass.HomeMarkPointNotify.newBuilder(); var proto = HomeMarkPointNotifyOuterClass.HomeMarkPointNotify.newBuilder();
var owner = player.getCurHomeWorld().getHost();
var home = player.getCurHomeWorld().getHome();
if (player.getRealmList() == null) { if (owner.getRealmList() == null) {
return; return;
} }
for (var moduleId : player.getRealmList()) {
var homeScene = player.getHome().getHomeSceneItem(moduleId + 2000); for (var moduleId : owner.getRealmList()) {
var homeScene = home.getHomeSceneItem(moduleId + 2000);
var markPointData = var markPointData =
HomeMarkPointSceneDataOuterClass.HomeMarkPointSceneData.newBuilder() HomeMarkPointSceneDataOuterClass.HomeMarkPointSceneData.newBuilder()
.setModuleId(moduleId) .setModuleId(moduleId)
.setSceneId(moduleId + 2000) .setSceneId(moduleId + 2000)
.setTeapotSpiritPos(homeScene.getDjinnPos().toProto()); .setSafePointPos(homeScene.getBornPos().toProto())
.setTeapotSpiritPos(homeScene.getDjinnPos().toProto());
// Now it only supports the teleport point // Now it only supports the teleport point
// TODO add more types // TODO add more types
var marks = var marks =
homeScene.getBlockItems().values().stream() homeScene.getBlockItems().values().stream()
.map(HomeBlockItem::getDeployFurnitureList) .map(HomeBlockItem::getDeployFurnitureList)
.flatMap(Collection::stream) .flatMap(Collection::stream)
.filter(i -> i.getFurnitureId() == 373501) .filter(i -> i.getFurnitureId() == 373501)
.map(x -> x.toMarkPointProto(3)) .map(x -> x.toMarkPointProto(3))
.toList(); .toList();
markPointData.addAllFurnitureList(marks); markPointData.addAllFurnitureList(marks);
proto.addMarkPointDataList(markPointData); proto.addMarkPointDataList(markPointData);

View File

@ -0,0 +1,14 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.HomeSaveArrangementNoChangeRspOuterClass;
public class PacketHomeSaveArrangementNoChangeRsp extends BasePacket {
public PacketHomeSaveArrangementNoChangeRsp(int sceneId) {
super(PacketOpcodes.HomeSaveArrangementNoChangeRsp);
this.setData(HomeSaveArrangementNoChangeRspOuterClass.HomeSaveArrangementNoChangeRsp.newBuilder()
.setSceneId(sceneId));
}
}

View File

@ -0,0 +1,16 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.OtherPlayerEnterHomeNotifyOuterClass;
public class PacketOtherPlayerEnterOrLeaveHomeNotify extends BasePacket {
public PacketOtherPlayerEnterOrLeaveHomeNotify(Player enterer, OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.Reason reason) {
super(PacketOpcodes.OtherPlayerEnterHomeNotify);
this.setData(OtherPlayerEnterHomeNotifyOuterClass.OtherPlayerEnterHomeNotify.newBuilder()
.setNickname(enterer.getNickname())
.setReason(reason));
}
}

View File

@ -0,0 +1,15 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerApplyEnterHomeNotifyOuterClass;
public class PacketPlayerApplyEnterHomeNotify extends BasePacket {
public PacketPlayerApplyEnterHomeNotify(Player requester) {
super(PacketOpcodes.PlayerApplyEnterHomeNotify);
this.setData(PlayerApplyEnterHomeNotifyOuterClass.PlayerApplyEnterHomeNotify.newBuilder()
.setSrcPlayerInfo(requester.getOnlinePlayerInfo()));
}
}

View File

@ -0,0 +1,17 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerApplyEnterHomeResultNotifyOuterClass;
public class PacketPlayerApplyEnterHomeResultNotify extends BasePacket {
public PacketPlayerApplyEnterHomeResultNotify(int targetUid, String nickname, boolean agreed, PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.Reason reason) {
super(PacketOpcodes.PlayerApplyEnterHomeResultNotify);
this.setData(PlayerApplyEnterHomeResultNotifyOuterClass.PlayerApplyEnterHomeResultNotify.newBuilder()
.setTargetUid(targetUid)
.setTargetNickname(nickname)
.setIsAgreed(agreed)
.setReason(reason));
}
}

View File

@ -0,0 +1,15 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerApplyEnterHomeResultRspOuterClass;
public class PacketPlayerApplyEnterHomeResultRsp extends BasePacket {
public PacketPlayerApplyEnterHomeResultRsp(int uid, boolean agreed) {
super(PacketOpcodes.PlayerApplyEnterHomeResultRsp);
this.setData(PlayerApplyEnterHomeResultRspOuterClass.PlayerApplyEnterHomeResultRsp.newBuilder()
.setApplyUid(uid)
.setIsAgreed(agreed));
}
}

View File

@ -21,30 +21,30 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
player.setEnterSceneToken(Utils.randomRange(1000, 99999)); player.setEnterSceneToken(Utils.randomRange(1000, 99999));
var proto = var proto =
PlayerEnterSceneNotify.newBuilder() PlayerEnterSceneNotify.newBuilder()
.setSceneId(player.getSceneId()) .setSceneId(player.getSceneId())
.setPos(player.getPosition().toProto()) .setPos(player.getPosition().toProto())
.setSceneBeginTime(System.currentTimeMillis()) .setSceneBeginTime(System.currentTimeMillis())
.setType(EnterType.ENTER_TYPE_SELF) .setType(EnterType.ENTER_TYPE_SELF)
.setTargetUid(player.getUid()) .setTargetUid(player.getUid())
.setEnterSceneToken(player.getEnterSceneToken()) .setEnterSceneToken(player.getEnterSceneToken())
.setWorldLevel(player.getWorldLevel()) .setWorldLevel(player.getWorldLevel())
.setEnterReason(EnterReason.Login.getValue()) .setEnterReason(EnterReason.Login.getValue())
.setIsFirstLoginEnterScene(player.isFirstLoginEnterScene()) .setIsFirstLoginEnterScene(player.isFirstLoginEnterScene())
.setWorldType(1) .setWorldType(1)
.setSceneTransaction( .setSceneTransaction(
"3-" "3-"
+ player.getUid() + player.getUid()
+ "-" + "-"
+ (int) (System.currentTimeMillis() / 1000) + (int) (System.currentTimeMillis() / 1000)
+ "-" + "-"
+ 18402); + 18402);
this.setData(proto); this.setData(proto);
} }
public PacketPlayerEnterSceneNotify( public PacketPlayerEnterSceneNotify(
Player player, EnterType type, EnterReason reason, int newScene, Position newPos) { Player player, EnterType type, EnterReason reason, int newScene, Position newPos) {
this(player, player, type, reason, newScene, newPos); this(player, player, type, reason, newScene, newPos);
} }
@ -53,52 +53,52 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
} }
public PacketPlayerEnterSceneNotify( public PacketPlayerEnterSceneNotify(
Player player, Player player,
Player target, Player target,
EnterType type, EnterType type,
EnterReason reason, EnterReason reason,
int newScene, int newScene,
Position newPos) { Position newPos) {
this( this(
player, player,
target, target,
TeleportProperties.builder() TeleportProperties.builder()
.enterType(type) .enterType(type)
.enterReason(reason) .enterReason(reason)
.sceneId(newScene) .sceneId(newScene)
.teleportTo(newPos) .teleportTo(newPos)
.build()); .build());
} }
// Teleport or go somewhere // Teleport or go somewhere
public PacketPlayerEnterSceneNotify( public PacketPlayerEnterSceneNotify(
Player player, Player target, TeleportProperties teleportProperties) { Player player, Player target, TeleportProperties teleportProperties) {
super(PacketOpcodes.PlayerEnterSceneNotify); super(PacketOpcodes.PlayerEnterSceneNotify);
player.setSceneLoadState(SceneLoadState.LOADING); player.setSceneLoadState(SceneLoadState.LOADING);
player.setEnterSceneToken(Utils.randomRange(1000, 99999)); player.setEnterSceneToken(Utils.randomRange(1000, 99999));
var proto = var proto =
PlayerEnterSceneNotify.newBuilder() PlayerEnterSceneNotify.newBuilder()
.setPrevSceneId(player.getSceneId()) .setPrevSceneId(player.getSceneId())
.setPrevPos(player.getPosition().toProto()) .setPrevPos(player.getPosition().toProto())
.setSceneId(teleportProperties.getSceneId()) .setSceneId(teleportProperties.getSceneId())
.setPos(teleportProperties.getTeleportTo().toProto()) .setPos(teleportProperties.getTeleportTo().toProto())
.setSceneBeginTime(System.currentTimeMillis()) .setSceneBeginTime(System.currentTimeMillis())
.setType(teleportProperties.getEnterType()) .setType(teleportProperties.getEnterType())
.setTargetUid(target.getUid()) .setTargetUid(target.getUid())
.setEnterSceneToken(player.getEnterSceneToken()) .setEnterSceneToken(player.getEnterSceneToken())
.setWorldLevel(target.getWorld().getWorldLevel()) .setWorldLevel(target.getWorld().getWorldLevel())
.setEnterReason(teleportProperties.getEnterReason().getValue()) .setEnterReason(teleportProperties.getEnterReason().getValue())
.setWorldType(1) .setWorldType(1)
.setSceneTransaction( .setSceneTransaction(
teleportProperties.getSceneId() teleportProperties.getSceneId()
+ "-" + "-"
+ target.getUid() + target.getUid()
+ "-" + "-"
+ (int) (System.currentTimeMillis() / 1000) + (int) (System.currentTimeMillis() / 1000)
+ "-" + "-"
+ 18402); + 18402);
// Apply the dungeon ID to the packet if it's a dungeon. // Apply the dungeon ID to the packet if it's a dungeon.
if (teleportProperties.getDungeonId() != 0) { if (teleportProperties.getDungeonId() != 0) {
@ -107,4 +107,36 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
this.setData(proto); this.setData(proto);
} }
// Go home
public PacketPlayerEnterSceneNotify(
Player player, int targetUid, TeleportProperties teleportProperties, boolean other) {
super(PacketOpcodes.PlayerEnterSceneNotify);
player.setSceneLoadState(SceneLoadState.LOADING);
player.setEnterSceneToken(Utils.randomRange(1000, 99999));
var proto =
PlayerEnterSceneNotify.newBuilder()
.setPrevSceneId(player.getSceneId())
.setPrevPos(player.getPosition().toProto())
.setSceneId(teleportProperties.getSceneId())
.setPos(teleportProperties.getTeleportTo().toProto())
.setSceneBeginTime(System.currentTimeMillis())
.setType(other ? EnterType.ENTER_TYPE_OTHER_HOME : EnterType.ENTER_TYPE_SELF_HOME)
.setTargetUid(targetUid)
.setEnterSceneToken(player.getEnterSceneToken())
.setEnterReason(teleportProperties.getEnterReason().getValue())
.setWorldType(64)
.setSceneTransaction(
teleportProperties.getSceneId()
+ "-"
+ targetUid
+ "-"
+ (int) (System.currentTimeMillis() / 1000)
+ "-"
+ 27573);
this.setData(proto);
}
} }

View File

@ -5,7 +5,6 @@ import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerHomeCompInfoNotifyOuterClass; import emu.grasscutter.net.proto.PlayerHomeCompInfoNotifyOuterClass;
import emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass; import emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass;
import java.util.List;
public class PacketPlayerHomeCompInfoNotify extends BasePacket { public class PacketPlayerHomeCompInfoNotify extends BasePacket {
@ -22,7 +21,8 @@ public class PacketPlayerHomeCompInfoNotify extends BasePacket {
.setCompInfo( .setCompInfo(
PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.newBuilder() PlayerHomeCompInfoOuterClass.PlayerHomeCompInfo.newBuilder()
.addAllUnlockedModuleIdList(player.getRealmList()) .addAllUnlockedModuleIdList(player.getRealmList())
.addAllLevelupRewardGotLevelList(List.of(1)) // Hardcoded .addAllLevelupRewardGotLevelList(player.getHomeRewardedLevels())
.addAllSeenModuleIdList(player.getSeenRealmList())
.setFriendEnterHomeOptionValue(player.getHome().getEnterHomeOption()) .setFriendEnterHomeOptionValue(player.getHome().getEnterHomeOption())
.build()) .build())
.build(); .build();

View File

@ -0,0 +1,17 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerPreEnterMpNotifyOuterClass;
public class PacketPlayerPreEnterMpNotify extends BasePacket {
public PacketPlayerPreEnterMpNotify(Player player) {
super(PacketOpcodes.PlayerPreEnterMpNotify);
this.setData(PlayerPreEnterMpNotifyOuterClass.PlayerPreEnterMpNotify.newBuilder()
.setUid(player.getUid())
.setNickname(player.getNickname())
.setState(PlayerPreEnterMpNotifyOuterClass.PlayerPreEnterMpNotify.State.START));
}
}

View File

@ -12,7 +12,7 @@ public class PacketTryEnterHomeRsp extends BasePacket {
TryEnterHomeRspOuterClass.TryEnterHomeRsp proto = TryEnterHomeRspOuterClass.TryEnterHomeRsp proto =
TryEnterHomeRspOuterClass.TryEnterHomeRsp.newBuilder() TryEnterHomeRspOuterClass.TryEnterHomeRsp.newBuilder()
.setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE) .setRetcode(RetcodeOuterClass.Retcode.RET_HOME_APPLY_ENTER_OTHER_HOME_FAIL_VALUE)
.build(); .build();
this.setData(proto); this.setData(proto);
@ -23,7 +23,6 @@ public class PacketTryEnterHomeRsp extends BasePacket {
TryEnterHomeRspOuterClass.TryEnterHomeRsp proto = TryEnterHomeRspOuterClass.TryEnterHomeRsp proto =
TryEnterHomeRspOuterClass.TryEnterHomeRsp.newBuilder() TryEnterHomeRspOuterClass.TryEnterHomeRsp.newBuilder()
.setRetcode(0)
.setTargetUid(uid) .setTargetUid(uid)
.build(); .build();