Merge pull request #120 from StartForKiller/quests

Added Weather System
This commit is contained in:
Alexander Hartmann 2024-03-28 20:07:48 +01:00 committed by GitHub
commit 5139f6e472
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 972 additions and 2538 deletions

View File

@ -1,676 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: CityInfo.proto
package emu.grasscutter.net.proto;
public final class CityInfoOuterClass {
private CityInfoOuterClass() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface CityInfoOrBuilder extends
// @@protoc_insertion_point(interface_extends:CityInfo)
com.google.protobuf.MessageOrBuilder {
/**
* <code>uint32 city_id = 15;</code>
* @return The cityId.
*/
int getCityId();
/**
* <code>uint32 crystal_num = 3;</code>
* @return The crystalNum.
*/
int getCrystalNum();
/**
* <code>uint32 level = 4;</code>
* @return The level.
*/
int getLevel();
}
/**
* Protobuf type {@code CityInfo}
*/
public static final class CityInfo extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:CityInfo)
CityInfoOrBuilder {
private static final long serialVersionUID = 0L;
// Use CityInfo.newBuilder() to construct.
private CityInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private CityInfo() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new CityInfo();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private CityInfo(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 24: {
crystalNum_ = input.readUInt32();
break;
}
case 32: {
level_ = input.readUInt32();
break;
}
case 120: {
cityId_ = input.readUInt32();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.CityInfoOuterClass.internal_static_CityInfo_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.CityInfoOuterClass.internal_static_CityInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.class, emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.Builder.class);
}
public static final int CITY_ID_FIELD_NUMBER = 15;
private int cityId_;
/**
* <code>uint32 city_id = 15;</code>
* @return The cityId.
*/
@java.lang.Override
public int getCityId() {
return cityId_;
}
public static final int CRYSTAL_NUM_FIELD_NUMBER = 3;
private int crystalNum_;
/**
* <code>uint32 crystal_num = 3;</code>
* @return The crystalNum.
*/
@java.lang.Override
public int getCrystalNum() {
return crystalNum_;
}
public static final int LEVEL_FIELD_NUMBER = 4;
private int level_;
/**
* <code>uint32 level = 4;</code>
* @return The level.
*/
@java.lang.Override
public int getLevel() {
return level_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (crystalNum_ != 0) {
output.writeUInt32(3, crystalNum_);
}
if (level_ != 0) {
output.writeUInt32(4, level_);
}
if (cityId_ != 0) {
output.writeUInt32(15, cityId_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (crystalNum_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, crystalNum_);
}
if (level_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(4, level_);
}
if (cityId_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(15, cityId_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo other = (emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo) obj;
if (getCityId()
!= other.getCityId()) return false;
if (getCrystalNum()
!= other.getCrystalNum()) return false;
if (getLevel()
!= other.getLevel()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + CITY_ID_FIELD_NUMBER;
hash = (53 * hash) + getCityId();
hash = (37 * hash) + CRYSTAL_NUM_FIELD_NUMBER;
hash = (53 * hash) + getCrystalNum();
hash = (37 * hash) + LEVEL_FIELD_NUMBER;
hash = (53 * hash) + getLevel();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code CityInfo}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:CityInfo)
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.CityInfoOuterClass.internal_static_CityInfo_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.CityInfoOuterClass.internal_static_CityInfo_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.class, emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.Builder.class);
}
// Construct using emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
cityId_ = 0;
crystalNum_ = 0;
level_ = 0;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.CityInfoOuterClass.internal_static_CityInfo_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo getDefaultInstanceForType() {
return emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo build() {
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo buildPartial() {
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo result = new emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo(this);
result.cityId_ = cityId_;
result.crystalNum_ = crystalNum_;
result.level_ = level_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo) {
return mergeFrom((emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo other) {
if (other == emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo.getDefaultInstance()) return this;
if (other.getCityId() != 0) {
setCityId(other.getCityId());
}
if (other.getCrystalNum() != 0) {
setCrystalNum(other.getCrystalNum());
}
if (other.getLevel() != 0) {
setLevel(other.getLevel());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int cityId_ ;
/**
* <code>uint32 city_id = 15;</code>
* @return The cityId.
*/
@java.lang.Override
public int getCityId() {
return cityId_;
}
/**
* <code>uint32 city_id = 15;</code>
* @param value The cityId to set.
* @return This builder for chaining.
*/
public Builder setCityId(int value) {
cityId_ = value;
onChanged();
return this;
}
/**
* <code>uint32 city_id = 15;</code>
* @return This builder for chaining.
*/
public Builder clearCityId() {
cityId_ = 0;
onChanged();
return this;
}
private int crystalNum_ ;
/**
* <code>uint32 crystal_num = 3;</code>
* @return The crystalNum.
*/
@java.lang.Override
public int getCrystalNum() {
return crystalNum_;
}
/**
* <code>uint32 crystal_num = 3;</code>
* @param value The crystalNum to set.
* @return This builder for chaining.
*/
public Builder setCrystalNum(int value) {
crystalNum_ = value;
onChanged();
return this;
}
/**
* <code>uint32 crystal_num = 3;</code>
* @return This builder for chaining.
*/
public Builder clearCrystalNum() {
crystalNum_ = 0;
onChanged();
return this;
}
private int level_ ;
/**
* <code>uint32 level = 4;</code>
* @return The level.
*/
@java.lang.Override
public int getLevel() {
return level_;
}
/**
* <code>uint32 level = 4;</code>
* @param value The level to set.
* @return This builder for chaining.
*/
public Builder setLevel(int value) {
level_ = value;
onChanged();
return this;
}
/**
* <code>uint32 level = 4;</code>
* @return This builder for chaining.
*/
public Builder clearLevel() {
level_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:CityInfo)
}
// @@protoc_insertion_point(class_scope:CityInfo)
private static final emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo();
}
public static emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<CityInfo>
PARSER = new com.google.protobuf.AbstractParser<CityInfo>() {
@java.lang.Override
public CityInfo parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new CityInfo(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<CityInfo> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<CityInfo> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_CityInfo_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_CityInfo_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\016CityInfo.proto\"?\n\010CityInfo\022\017\n\007city_id\030" +
"\017 \001(\r\022\023\n\013crystal_num\030\003 \001(\r\022\r\n\005level\030\004 \001(" +
"\rB\033\n\031emu.grasscutter.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_CityInfo_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_CityInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_CityInfo_descriptor,
new java.lang.String[] { "CityId", "CrystalNum", "Level", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -1,620 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: GetSceneAreaReq.proto
package emu.grasscutter.net.proto;
public final class GetSceneAreaReqOuterClass {
private GetSceneAreaReqOuterClass() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface GetSceneAreaReqOrBuilder extends
// @@protoc_insertion_point(interface_extends:GetSceneAreaReq)
com.google.protobuf.MessageOrBuilder {
/**
* <code>uint32 scene_id = 4;</code>
* @return The sceneId.
*/
int getSceneId();
/**
* <code>uint32 belong_uid = 7;</code>
* @return The belongUid.
*/
int getBelongUid();
}
/**
* <pre>
* CmdId: 265
* EnetChannelId: 0
* EnetIsReliable: false
* IsAllowClient: true
* </pre>
*
* Protobuf type {@code GetSceneAreaReq}
*/
public static final class GetSceneAreaReq extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:GetSceneAreaReq)
GetSceneAreaReqOrBuilder {
private static final long serialVersionUID = 0L;
// Use GetSceneAreaReq.newBuilder() to construct.
private GetSceneAreaReq(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private GetSceneAreaReq() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GetSceneAreaReq();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private GetSceneAreaReq(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 32: {
sceneId_ = input.readUInt32();
break;
}
case 56: {
belongUid_ = input.readUInt32();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.internal_static_GetSceneAreaReq_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.internal_static_GetSceneAreaReq_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.class, emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.Builder.class);
}
public static final int SCENE_ID_FIELD_NUMBER = 4;
private int sceneId_;
/**
* <code>uint32 scene_id = 4;</code>
* @return The sceneId.
*/
@java.lang.Override
public int getSceneId() {
return sceneId_;
}
public static final int BELONG_UID_FIELD_NUMBER = 7;
private int belongUid_;
/**
* <code>uint32 belong_uid = 7;</code>
* @return The belongUid.
*/
@java.lang.Override
public int getBelongUid() {
return belongUid_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (sceneId_ != 0) {
output.writeUInt32(4, sceneId_);
}
if (belongUid_ != 0) {
output.writeUInt32(7, belongUid_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (sceneId_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(4, sceneId_);
}
if (belongUid_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(7, belongUid_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq other = (emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq) obj;
if (getSceneId()
!= other.getSceneId()) return false;
if (getBelongUid()
!= other.getBelongUid()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + SCENE_ID_FIELD_NUMBER;
hash = (53 * hash) + getSceneId();
hash = (37 * hash) + BELONG_UID_FIELD_NUMBER;
hash = (53 * hash) + getBelongUid();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* CmdId: 265
* EnetChannelId: 0
* EnetIsReliable: false
* IsAllowClient: true
* </pre>
*
* Protobuf type {@code GetSceneAreaReq}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:GetSceneAreaReq)
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReqOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.internal_static_GetSceneAreaReq_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.internal_static_GetSceneAreaReq_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.class, emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.Builder.class);
}
// Construct using emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
sceneId_ = 0;
belongUid_ = 0;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.internal_static_GetSceneAreaReq_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq getDefaultInstanceForType() {
return emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq build() {
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq buildPartial() {
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq result = new emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq(this);
result.sceneId_ = sceneId_;
result.belongUid_ = belongUid_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq) {
return mergeFrom((emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq other) {
if (other == emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq.getDefaultInstance()) return this;
if (other.getSceneId() != 0) {
setSceneId(other.getSceneId());
}
if (other.getBelongUid() != 0) {
setBelongUid(other.getBelongUid());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int sceneId_ ;
/**
* <code>uint32 scene_id = 4;</code>
* @return The sceneId.
*/
@java.lang.Override
public int getSceneId() {
return sceneId_;
}
/**
* <code>uint32 scene_id = 4;</code>
* @param value The sceneId to set.
* @return This builder for chaining.
*/
public Builder setSceneId(int value) {
sceneId_ = value;
onChanged();
return this;
}
/**
* <code>uint32 scene_id = 4;</code>
* @return This builder for chaining.
*/
public Builder clearSceneId() {
sceneId_ = 0;
onChanged();
return this;
}
private int belongUid_ ;
/**
* <code>uint32 belong_uid = 7;</code>
* @return The belongUid.
*/
@java.lang.Override
public int getBelongUid() {
return belongUid_;
}
/**
* <code>uint32 belong_uid = 7;</code>
* @param value The belongUid to set.
* @return This builder for chaining.
*/
public Builder setBelongUid(int value) {
belongUid_ = value;
onChanged();
return this;
}
/**
* <code>uint32 belong_uid = 7;</code>
* @return This builder for chaining.
*/
public Builder clearBelongUid() {
belongUid_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:GetSceneAreaReq)
}
// @@protoc_insertion_point(class_scope:GetSceneAreaReq)
private static final emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq();
}
public static emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<GetSceneAreaReq>
PARSER = new com.google.protobuf.AbstractParser<GetSceneAreaReq>() {
@java.lang.Override
public GetSceneAreaReq parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new GetSceneAreaReq(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<GetSceneAreaReq> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<GetSceneAreaReq> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_GetSceneAreaReq_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_GetSceneAreaReq_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\025GetSceneAreaReq.proto\"7\n\017GetSceneAreaR" +
"eq\022\020\n\010scene_id\030\004 \001(\r\022\022\n\nbelong_uid\030\007 \001(\r" +
"B\033\n\031emu.grasscutter.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_GetSceneAreaReq_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_GetSceneAreaReq_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_GetSceneAreaReq_descriptor,
new java.lang.String[] { "SceneId", "BelongUid", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -4,6 +4,7 @@ import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.game.world.WeatherArea;
import java.util.List;
@ -15,8 +16,11 @@ public final class WeatherCommand implements CommandHandler {
int weatherId = targetPlayer.getWeatherId();
ClimateType climate = ClimateType.CLIMATE_NONE; // Sending ClimateType.CLIMATE_NONE to Scene.setWeather will use the default climate for that weather
WeatherArea area = targetPlayer.getScene().getWeatherArea(targetPlayer.getPosition());
if (args.isEmpty()) {
climate = targetPlayer.getClimate();
if(area != null)
climate = area.getCurrentClimateType();
CommandHandler.sendTranslatedMessage(sender, "commands.weather.status", weatherId, climate.getShortName());
return;
}
@ -36,8 +40,10 @@ public final class WeatherCommand implements CommandHandler {
}
}
targetPlayer.setWeather(weatherId, climate);
climate = targetPlayer.getClimate(); // Might be different to what we set
if(area != null) {
area.setClimateType(climate);
climate = area.getCurrentClimateType();
}
CommandHandler.sendTranslatedMessage(sender, "commands.weather.success", weatherId, climate.getShortName());
}
}

View File

@ -15,6 +15,7 @@ import emu.grasscutter.data.binout.config.ConfigEntityMonster;
import emu.grasscutter.data.binout.config.ConfigGlobalCombat;
import emu.grasscutter.data.binout.config.ConfigLevelEntity;
import emu.grasscutter.game.dungeons.dungeon_entry.DungeonEntries;
import emu.grasscutter.data.common.WeatherAreaPointData;
import emu.grasscutter.data.common.quest.MainQuestData;
import emu.grasscutter.data.common.quest.SubQuestData;
import emu.grasscutter.data.binout.routes.Route;
@ -25,6 +26,7 @@ import emu.grasscutter.data.server.DropTableExcelConfigData;
import emu.grasscutter.data.server.GadgetMapping;
import emu.grasscutter.data.server.MonsterMapping;
import emu.grasscutter.data.server.SubfieldMapping;
import emu.grasscutter.data.server.WeatherMapping;
import emu.grasscutter.game.dungeons.DungeonDropEntry;
import emu.grasscutter.game.quest.QuestEncryptionKey;
import emu.grasscutter.game.quest.enums.QuestCond;
@ -160,7 +162,10 @@ public class GameData {
@Getter private static final Int2ObjectMap<WeaponCurveData> weaponCurveDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeaponLevelData> weaponLevelDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeaponPromoteData> weaponPromoteDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<StatuePromoteData> statuePromoteDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeatherData> weatherDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeatherTemplateData> weatherTemplateDataMap = new Int2ObjectOpenHashMap<>(); //Unused
@Getter private static final Map<String, WeatherTemplateData> weatherTemplateDataByNameMap = new HashMap<>();
@Getter private static final Int2ObjectMap<WorldAreaData> worldAreaDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<AvatarPromoteData> avatarPromoteDataMap = new Int2ObjectOpenHashMap<>();
@ -189,6 +194,7 @@ public class GameData {
@Getter private static final Int2ObjectMap<MonsterMapping> monsterMappingMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<ActivityCondGroup> activityCondGroupMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<SceneGroupReplacement> groupReplacements = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeatherMapping> weatherMappingMap = new Int2ObjectOpenHashMap<>();
// Cache
@Getter private static final IntList scenePointIdList = new IntArrayList();
@ -208,6 +214,7 @@ public class GameData {
@Getter private static final Map<Integer, TrialAvatarActivityCustomData> trialAvatarActivityCustomData = new HashMap<>();
@Getter private static final Map<Integer, TrialAvatarActivityDataData> trialAvatarActivityDataCustomData = new HashMap<>();
@Getter private static final Int2IntMap trialAvatarIndexIdTrialActivityDataDataMap = new Int2IntOpenHashMap();
@Getter private static final Map<Integer, List<WeatherAreaPointData>> weatherAreaPointData = new HashMap<>();
// Getters with wrong names, remove later
@Deprecated(forRemoval = true) public static Int2ObjectMap<CodexReliquaryData> getcodexReliquaryIdMap() {return codexReliquaryDataIdMap;}
@ -239,6 +246,10 @@ public class GameData {
return weaponPromoteDataMap.get((promoteId << 8) + promoteLevel);
}
public static StatuePromoteData getStatuePromoteData(int cityId, int promoteLevel) {
return statuePromoteDataMap.get((cityId << 8) + promoteLevel);
}
public static ReliquaryLevelData getRelicLevelData(int rankLevel, int level) {
return reliquaryLevelDataMap.get((rankLevel << 8) + level);
}

View File

@ -13,6 +13,7 @@ import emu.grasscutter.data.common.quest.MainQuestData;
import emu.grasscutter.data.common.quest.SubQuestData;
import emu.grasscutter.data.binout.routes.SceneRoutes;
import emu.grasscutter.data.common.PointData;
import emu.grasscutter.data.common.WeatherAreaPointData;
import emu.grasscutter.data.custom.*;
import emu.grasscutter.data.excels.TrialAvatarActivityDataData;
import emu.grasscutter.data.server.ActivityCondGroup;
@ -21,6 +22,7 @@ import emu.grasscutter.data.server.DropTableExcelConfigData;
import emu.grasscutter.data.server.GadgetMapping;
import emu.grasscutter.data.server.MonsterMapping;
import emu.grasscutter.data.server.SubfieldMapping;
import emu.grasscutter.data.server.WeatherMapping;
import emu.grasscutter.game.ability.Ability;
import emu.grasscutter.game.dungeons.DungeonDrop;
import emu.grasscutter.game.dungeons.enums.DungeonType;
@ -130,6 +132,7 @@ public class ResourceLoader {
loadDungeonDrops();
// Load scene points - must be done AFTER resources are loaded
loadScenePoints();
loadSceneWeatherAreas();
loadDungeonEntryAndExitPoints();
// Load default home layout
loadHomeworldDefaultSaveData();
@ -141,6 +144,7 @@ public class ResourceLoader {
loadScriptData();
loadGadgetMappings();
loadSubfieldMappings();
loadWeatherMappings();
loadMonsterMappings();
loadActivityCondGroups();
loadTrialAvatarCustomData();
@ -267,6 +271,39 @@ public class ResourceLoader {
}
}
private static void loadSceneWeatherAreas() {
val pattern = Pattern.compile("scene([0-9]+)_weather_areas\\.json");
try (val dirStream = Files.newDirectoryStream(getResourcePath("Scripts/Scene"))) {
dirStream.forEach(dirPath -> {
try (val stream = Files.newDirectoryStream(dirPath, "scene*_weather_areas.json")){
stream.forEach(path -> {
val matcher = pattern.matcher(path.getFileName().toString());
if (!matcher.find()) return;
int sceneId = Integer.parseInt(matcher.group(1));
List<WeatherAreaPointData> config;
try {
config = JsonUtils.loadToList(path, WeatherAreaPointData.class);
} catch (Exception e) {
logger.error("Error loading weather area file: {}", path, e);
return;
}
if (config == null) return;
config.forEach((area) -> {
GameData.getWeatherAreaPointData().put(sceneId, config);
});
});
} catch (IOException e) {
logger.error("Weather area files cannot be found");
}
});
} catch (IOException e) {
logger.error("Weather area files cannot be found");
}
}
/**
* Pre-make dungeon entries and exits using existing map for easier information retrieve
* Some dungeon exits not included like trial avatar activity and mist trial activity, player
@ -830,6 +867,18 @@ public class ResourceLoader {
}
}
private static void loadWeatherMappings() {
try {
val weatherMap = GameData.getWeatherMappingMap();
try {
JsonUtils.loadToList(getResourcePath("Server/WeatherMapping.json"), WeatherMapping.class).forEach(entry -> weatherMap.put(entry.getAreaId(), entry));;
} catch (IOException | NullPointerException ignored) {}
logger.debug("Loaded {} weather mappings.", weatherMap.size());
} catch (Exception e) {
logger.error("Unable to load weather mappings.", e);
}
}
private static void loadMonsterMappings() {
try {
val monsterMap = GameData.getMonsterMappingMap();

View File

@ -0,0 +1,35 @@
package emu.grasscutter.data.common;
import emu.grasscutter.utils.Position;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@SuppressWarnings(value = "SpellCheckingInspection")
public class WeatherAreaPointData {
public int area_id;
public boolean isAccurateBorder = false;
public PolygonPoint[] points;
@Data
@EqualsAndHashCode(callSuper = false)
@SuppressWarnings(value = "SpellCheckingInspection")
public class PolygonPoint {
public float x;
public float y;
}
public boolean isInside(Position position) {
float posX = position.getX();
float posZ = position.getZ();
boolean result = false;
for(int i = 0, j = points.length - 1; i < points.length; j = i++) {
if((points[i].y > posZ) != (points[j].y > posZ) &&
(posX < (points[j].x - points[i].x) * (posZ - points[i].y) / (points[j].y-points[i].y) + points[i].x)) {
result = !result;
}
}
return result;
}
}

View File

@ -0,0 +1,21 @@
package emu.grasscutter.data.excels;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.data.common.ItemParamData;
import lombok.Getter;
import lombok.Setter;
@ResourceType(name = "StatuePromoteExcelConfigData.json")
public class StatuePromoteData extends GameResource {
@Getter @Setter private int level;
@Getter @Setter private int cityId;
@Getter @Setter private ItemParamData[] costItems;
@Getter @Setter private int[] rewardIdList;
@Getter @Setter private int stamina;
@Override
public int getId() {
return (cityId << 8) + level;
}
}

View File

@ -0,0 +1,25 @@
package emu.grasscutter.data.excels;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.ClimateType;
import lombok.Getter;
@ResourceType(name = "WeatherTemplateExcelConfigData.json") @Getter
public class WeatherTemplateData extends GameResource {
@Getter private String templateName;
@Getter private ClimateType weatherType;
@Getter private float sunnyProb = 0.0f;
@Getter private float cloudyProb = 0.0f;
@Getter private float rainProb = 0.0f;
@Getter private float thunderstormProb = 0.0f;
@Getter private float snowProb = 0.0f;
@Getter private float mistProb = 0.0f;
@Override
public void onLoad() {
super.onLoad();
GameData.getWeatherTemplateDataByNameMap().put(templateName + weatherType.getValue(), this);
}
}

View File

@ -0,0 +1,9 @@
package emu.grasscutter.data.server;
import lombok.Data;
@Data
public class WeatherMapping {
private int areaId;
private String template;
}

View File

@ -23,6 +23,7 @@ import emu.grasscutter.game.mail.Mail;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.quest.GameMainQuest;
import emu.grasscutter.game.world.SceneGroupInstance;
import emu.grasscutter.game.world.SceneInstanceData;
import static com.mongodb.client.model.Filters.eq;
@ -375,4 +376,13 @@ public final class DatabaseHelper {
SceneGroupInstance instance = DatabaseManager.getGameDatastore().find(SceneGroupInstance.class).filter(Filters.and(Filters.eq("ownerUid", owner.getUid()), Filters.eq("groupId", groupId))).first();
return instance;
}
public static void saveSceneInstanceData(SceneInstanceData instance) {
DatabaseManager.getGameDatastore().save(instance);
}
public static SceneInstanceData loadSceneInstanceData(int sceneId, Player owner) {
SceneInstanceData instance = DatabaseManager.getGameDatastore().find(SceneInstanceData.class).filter(Filters.and(Filters.eq("ownerUid", owner.getUid()), Filters.eq("sceneId", sceneId))).first();
return instance;
}
}

View File

@ -126,10 +126,10 @@ public final class AbilityManager extends BasePlayerManager {
logger.debug("Ability invoke: " + invoke + " " + invoke.getArgumentType() + " (" + invoke.getArgumentTypeValue() + "): " + this.player.getScene().getEntityById(invoke.getEntityId()));
var entity = this.player.getScene().getEntityById(invoke.getEntityId());
if(entity != null) {
logger.info("Entity group id {} config id {}", entity.getGroupId(), entity.getConfigId());
logger.debug("Entity group id {} config id {}", entity.getGroupId(), entity.getConfigId());
}
if(invoke.getHead() != null && invoke.getHead().getTargetId() != 0) {
logger.info("Target: " + this.player.getScene().getEntityById(invoke.getHead().getTargetId()));
logger.debug("Target: " + this.player.getScene().getEntityById(invoke.getHead().getTargetId()));
}
if(invoke.getHead() != null && invoke.getHead().getLocalId() != 0) {
@ -266,7 +266,7 @@ public final class AbilityManager extends BasePlayerManager {
}
ability.getAbilitySpecials().put(valueChange.getKey().getStr(), valueChange.getFloatValue());
logger.info("Ability {} changed {} to {}", ability.getData().abilityName, valueChange.getKey().getStr(), valueChange.getFloatValue());
logger.debug("Ability {} changed {} to {}", ability.getData().abilityName, valueChange.getKey().getStr(), valueChange.getFloatValue());
}
private void handleOverrideParam(AbilityInvokeEntry invoke) throws Exception {
@ -377,9 +377,9 @@ public final class AbilityManager extends BasePlayerManager {
}
var modifierData = (AbilityModifier)modifierArray[modChange.getModifierLocalId()];
if(entity.getInstancedModifiers().containsKey(head.getInstancedModifierId())) {
logger.info("Replacing entity {} modifier id {} with ability {} modifier {}", invoke.getEntityId(), head.getInstancedModifierId(), instancedAbilityData.abilityName, modifierData);
logger.debug("Replacing entity {} modifier id {} with ability {} modifier {}", invoke.getEntityId(), head.getInstancedModifierId(), instancedAbilityData.abilityName, modifierData);
} else {
logger.info("Adding entity {} modifier id {} with ability {} modifier {}", invoke.getEntityId(), head.getInstancedModifierId(), instancedAbilityData.abilityName, modifierData);
logger.debug("Adding entity {} modifier id {} with ability {} modifier {}", invoke.getEntityId(), head.getInstancedModifierId(), instancedAbilityData.abilityName, modifierData);
}
AbilityModifierController modifier = new AbilityModifierController(instancedAbility, instancedAbilityData, modifierData);
@ -388,7 +388,7 @@ public final class AbilityManager extends BasePlayerManager {
//TODO: Add all the ability modifier property change
} else if(modChange.getAction() == ModifierAction.REMOVED) {
logger.info("Removed on entity {} modifier id {}: {}", invoke.getEntityId(), head.getInstancedModifierId(), entity.getInstancedModifiers().get(head.getInstancedModifierId()));
logger.debug("Removed on entity {} modifier id {}: {}", invoke.getEntityId(), head.getInstancedModifierId(), entity.getInstancedModifiers().get(head.getInstancedModifierId()));
//TODO: Add debug log
@ -463,7 +463,7 @@ public final class AbilityManager extends BasePlayerManager {
entity.getInstancedAbilities().add(new Ability(ability, entity, player));
logger.info("Ability added to entity {} at index {}", entity.getId(), entity.getInstancedAbilities().size());
logger.debug("Ability added to entity {} at index {}", entity.getId(), entity.getInstancedAbilities().size());
}
/**

View File

@ -0,0 +1,24 @@
package emu.grasscutter.game.city;
import messages.scene.CityInfo;
import dev.morphia.annotations.Entity;
import lombok.Getter;
import lombok.Setter;
@Entity
public class CityInfoData {
@Getter @Setter private int cityId;
@Getter @Setter
private int level = 1; // level of the city (include level SotS, level Frostbearing Trees, etc.)
@Getter @Setter private int numCrystal = 0; // number of crystals in the city
public CityInfoData(int cityId) {
this.cityId = cityId;
}
public CityInfo toProto() {
return new CityInfo(cityId, numCrystal, level);
}
}

View File

@ -434,6 +434,20 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
return removeItem(item, count);
}
/**
* Removes an item by its item ID.
*
* @param itemId The ID of the item to remove.
* @param count The amount of items to remove.
* @return True if the item was removed, false otherwise.
*/
public synchronized boolean removeItemById(int itemId, int count) {
var item = this.getItems().values().stream().filter(i -> i.getItemId() == itemId).findFirst();
// Check if the item is in the player's inventory.
return item.filter(gameItem -> this.removeItem(gameItem, count)).isPresent();
}
public synchronized boolean removeItem(GameItem item) {
return removeItem(item, item.getCount());
}

View File

@ -1,17 +1,27 @@
package emu.grasscutter.game.managers;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.CityData;
import emu.grasscutter.game.city.CityInfoData;
import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.player.BasePlayerManager;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.quest.enums.QuestContent;
import emu.grasscutter.net.proto.ChangeHpReasonOuterClass.ChangeHpReason;
import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason;
import emu.grasscutter.server.packet.send.PacketEntityFightPropChangeReasonNotify;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import emu.grasscutter.server.packet.send.PacketSceneForceUnlockNotify;
import lombok.val;
import emu.grasscutter.server.packet.send.PacketLevelupCityRsp;
import org.slf4j.Logger;
import java.util.HashMap;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
@ -188,4 +198,91 @@ public class SotSManager extends BasePlayerManager {
setCurrentVolume(currentVolume);
}
}
public CityData getCityByAreaId(int areaId) {
return GameData.getCityDataMap().values().stream()
.filter(city -> city.getAreaIdVec().contains(areaId))
.findFirst()
.orElse(null);
}
public CityInfoData getCityInfo(int cityId) {
if (player.getCityInfoData() == null) player.setCityInfoData(new HashMap<>());
var cityInfo = player.getCityInfoData().get(cityId);
if (cityInfo == null) {
cityInfo = new CityInfoData(cityId);
player.getCityInfoData().put(cityId, cityInfo);
}
return cityInfo;
}
public void addCityInfo(CityInfoData cityInfoData) {
if (player.getCityInfoData() == null) player.setCityInfoData(new HashMap<>());
player.getCityInfoData().put(cityInfoData.getCityId(), cityInfoData);
}
public void levelUpSotS(int areaId, int sceneId, int itemNum) {
if (itemNum <= 0) return;
// search city by areaId
var city = this.getCityByAreaId(areaId);
if (city == null) return;
var cityId = city.getCityId();
// check data level up
var cityInfo = this.getCityInfo(cityId);
var nextStatuePromoteData = GameData.getStatuePromoteData(cityId, cityInfo.getLevel() + 1);
if (nextStatuePromoteData == null) return;
var nextLevelCrystal = nextStatuePromoteData.getCostItems()[0].getCount();
// delete item from inventory
var itemNumrequired = Math.min(itemNum, nextLevelCrystal - cityInfo.getNumCrystal());
player
.getInventory()
.removeItemById(nextStatuePromoteData.getCostItems()[0].getId(), itemNumrequired);
// update number oculi
cityInfo.setNumCrystal(cityInfo.getNumCrystal() + itemNumrequired);
// hanble quest
if (itemNumrequired >= 1)
player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_CITY_LEVEL_UP, cityId, areaId);
// handle oculi overflow
if (cityInfo.getNumCrystal() >= nextLevelCrystal) {
cityInfo.setNumCrystal(cityInfo.getNumCrystal() - nextLevelCrystal);
cityInfo.setLevel(cityInfo.getLevel() + 1);
// update max stamina and notify client
player.setProperty(
PlayerProperty.PROP_MAX_STAMINA,
player.getProperty(PlayerProperty.PROP_MAX_STAMINA)
+ nextStatuePromoteData.getStamina() * 100,
true);
// Add items to inventory
if (nextStatuePromoteData.getRewardIdList() != null) {
for (var rewardId : nextStatuePromoteData.getRewardIdList()) {
val rewardData = GameData.getRewardDataMap().get(rewardId);
if (rewardData == null) continue;
player
.getInventory()
.addItemParamDatas(rewardData.getRewardItemList(), ActionReason.CityLevelupReward);
}
}
// unlock forcescene
player.sendPacket(new PacketSceneForceUnlockNotify(1, true));
}
// update data
this.addCityInfo(cityInfo);
// Packets
player.sendPacket(
new PacketLevelupCityRsp(
sceneId, cityInfo.getLevel(), cityId, cityInfo.getNumCrystal(), areaId, 0));
}
}

View File

@ -16,6 +16,7 @@ import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.avatar.AvatarStorage;
import emu.grasscutter.game.avatar.TrialAvatar;
import emu.grasscutter.game.battlepass.BattlePassManager;
import emu.grasscutter.game.city.CityInfoData;
import emu.grasscutter.game.dungeons.dungeon_entry.DungeonEntryItem;
import emu.grasscutter.game.dungeons.dungeon_entry.DungeonEntryManager;
import emu.grasscutter.game.dungeons.dungeon_entry.PlayerDungeonExitInfo;
@ -177,6 +178,9 @@ public class Player {
@Getter private transient PlayerProgressManager progressManager;
@Getter private transient DungeonEntryManager dungeonEntryManager;
@Getter private transient int lastWeatherAreaId = 0;
@Getter @Setter private transient int weatherAreaId = 0;
@Getter @Setter private transient Position lastCheckedPosition = null;
private transient PlayerDungeonExitInfo dungeonExitInfo;
@ -221,6 +225,8 @@ public class Player {
@Getter private final DungeonEntryItem dungeonEntryItem;
@Getter private Set<Integer> activeQuestTimers;
@Getter @Setter private Map<Integer, CityInfoData> cityInfoData; // cityId -> CityData
@Deprecated
@SuppressWarnings({"rawtypes", "unchecked"}) // Morphia only!
public Player() {
@ -267,6 +273,7 @@ public class Player {
this.playerProgress = new PlayerProgress();
this.dungeonEntryItem = new DungeonEntryItem();
this.activeQuestTimers = new HashSet<>();
this.cityInfoData = new HashMap<>();
this.attackResults = new LinkedBlockingQueue<>();
this.coopRequests = new Int2ObjectOpenHashMap<>();
@ -1517,9 +1524,34 @@ public class Player {
// Make the Adventure EXP pop-up show on screen.
if (prop == PlayerProperty.PROP_PLAYER_EXP) {
this.sendPacket(new PacketPlayerPropChangeReasonNotify(this, prop, currentValue, value, PropChangeReason.PROP_CHANGE_REASON_PLAYER_ADD_EXP));
} else if(prop == PlayerProperty.PROP_MAX_STAMINA) {
this.sendPacket(new PacketPlayerPropChangeReasonNotify(this, prop, currentValue, value, PropChangeReason.PROP_CHANGE_REASON_CITY_LEVELUP));
}
}
return true;
}
public void updateWeather(Scene scene) {
val aVal = scene.getWeatherArea(getPosition());
if(aVal != null) {
if(getWeatherAreaId() != aVal.getConfig().getAreaID()) {
aVal.enterArea(this);
val lastArea = scene.getWeatherAreas().get(getWeatherAreaId());
if(lastArea != null) lastArea.leaveArea(this);
}
setWeatherAreaId(aVal.getConfig().getAreaID());
if(sceneLoadState.getValue() >= SceneLoadState.INIT.getValue())
sendPacket(new PacketSceneAreaWeatherNotify(aVal.getConfig().getAreaID(), aVal.getCurrentClimateType(), aVal.getTransDuration()));
} else {
val lastArea = scene.getWeatherAreas().get(getWeatherAreaId());
if(lastArea != null) {
lastArea.leaveArea(this);
}
if(sceneLoadState.getValue() >= SceneLoadState.INIT.getValue())
sendPacket(new PacketSceneAreaWeatherNotify(0, ClimateType.CLIMATE_NONE, 0));
}
}
}

View File

@ -264,6 +264,19 @@ public class PlayerProgressManager extends BasePlayerDataManager {
return true;
}
public boolean lockTransPoint(int sceneId, int pointId) {
val scenePointEntry = GameData.getScenePointEntryById(sceneId, pointId);
if (scenePointEntry == null || !this.player.getUnlockedScenePoints(sceneId).contains(pointId)) {
return false;
}
this.player.getUnlockedScenePoints(sceneId).remove(pointId);
this.player.sendPacket(new PacketScenePointUnlockNotify(sceneId, pointId, true));
return true;
}
public void unlockSceneArea(int sceneId, int areaId) {
// Add the area to the list of unlocked areas in its scene.
this.player.getUnlockedSceneAreas(sceneId).add(areaId);

View File

@ -0,0 +1,10 @@
package emu.grasscutter.game.quest.content;
import emu.grasscutter.game.quest.QuestValueContent;
import emu.grasscutter.game.quest.enums.QuestContent;
@QuestValueContent(QuestContent.QUEST_CONTENT_CITY_LEVEL_UP)
public class ContentCityLevelUp extends BaseContent {
}

View File

@ -17,7 +17,7 @@ public enum QuestExec implements QuestTrigger {
QUEST_EXEC_CHANGE_AVATAR_ELEMET (6),
QUEST_EXEC_REFRESH_GROUP_MONSTER (7),
QUEST_EXEC_SET_IS_FLYABLE (8), // missing, maybe gives glider
QUEST_EXEC_SET_IS_WEATHER_LOCKED (9), // missing
QUEST_EXEC_SET_IS_WEATHER_LOCKED (9),
QUEST_EXEC_SET_IS_GAME_TIME_LOCKED (10), // missing
QUEST_EXEC_SET_IS_TRANSFERABLE (11), // missing, currently unused
QUEST_EXEC_GRANT_TRIAL_AVATAR (12),
@ -25,12 +25,12 @@ public enum QuestExec implements QuestTrigger {
QUEST_EXEC_ROLLBACK_QUEST (14),
QUEST_EXEC_NOTIFY_GROUP_LUA (15),
QUEST_EXEC_SET_OPEN_STATE (16),
QUEST_EXEC_LOCK_POINT (17), // missing
QUEST_EXEC_LOCK_POINT (17),
QUEST_EXEC_DEL_PACK_ITEM_BATCH (18),
QUEST_EXEC_REFRESH_GROUP_SUITE (19),
QUEST_EXEC_REMOVE_TRIAL_AVATAR (20),
QUEST_EXEC_SET_GAME_TIME (21), // missing
QUEST_EXEC_SET_WEATHER_GADGET (22), // missing
QUEST_EXEC_SET_GAME_TIME (21),
QUEST_EXEC_SET_WEATHER_GADGET (22),
QUEST_EXEC_ADD_QUEST_PROGRESS (23),
QUEST_EXEC_NOTIFY_DAILY_TASK (24), // missing
QUEST_EXEC_CREATE_PATTERN_GROUP (25), // missing, used for random quests
@ -75,7 +75,7 @@ public enum QuestExec implements QuestTrigger {
QUEST_EXEC_UNLOCK_PLAYER_WORLD_SCENE (65), // missing
QUEST_EXEC_LOCK_PLAYER_WORLD_SCENE (66), // missing
QUEST_EXEC_FAIL_MAINCOOP (67), // missing
QUEST_EXEC_MODIFY_WEATHER_AREA (68), // missing
QUEST_EXEC_MODIFY_WEATHER_AREA (68),
QUEST_EXEC_MODIFY_ARANARA_COLLECTION_STATE (69), // missing
QUEST_EXEC_GRANT_TRIAL_AVATAR_BATCH_AND_LOCK_TEAM (70), // missing
QUEST_EXEC_UNKNOWN (9999);

View File

@ -0,0 +1,20 @@
package emu.grasscutter.game.quest.exec;
import emu.grasscutter.game.quest.GameQuest;
import emu.grasscutter.game.quest.QuestValueExec;
import emu.grasscutter.game.quest.enums.QuestExec;
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
import emu.grasscutter.data.common.quest.SubQuestData.QuestExecParam;
@QuestValueExec(QuestExec.QUEST_EXEC_LOCK_POINT)
public class ExecLockPoint extends QuestExecHandler {
@Override
public boolean execute(GameQuest quest, QuestExecParam condition, String... paramStr) {
// Lock the trans point for the player.
int sceneId = Integer.parseInt(paramStr[0]);
int pointId = Integer.parseInt(paramStr[1]);
// Done.
return quest.getOwner().getProgressManager().lockTransPoint(sceneId, pointId);
}
}

View File

@ -0,0 +1,35 @@
package emu.grasscutter.game.quest.exec;
import emu.grasscutter.data.common.quest.SubQuestData.QuestExecParam;
import emu.grasscutter.game.quest.GameQuest;
import emu.grasscutter.game.quest.QuestValueExec;
import emu.grasscutter.game.quest.enums.QuestExec;
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
import lombok.val;
@QuestValueExec(QuestExec.QUEST_EXEC_MODIFY_WEATHER_AREA)
public class ExecModifyWeatherArea extends QuestExecHandler {
@Override
public boolean execute(GameQuest quest, QuestExecParam condition, String... paramStr) {
var weatherAreaIds = paramStr[0].split(";");
var openWeathers = paramStr[1].split(";");
if(weatherAreaIds.length != openWeathers.length) return false;
boolean success = true;
for(int i = 0; i < weatherAreaIds.length; i++) {
val weatherAreaId = Integer.parseInt(weatherAreaIds[i]);
val openWeather = Integer.parseInt(openWeathers[i]) == 1 ? true : false;
if(openWeather) {
success = quest.getOwner().getScene().addWeatherArea(weatherAreaId);
} else {
success = quest.getOwner().getScene().removeWeatherArea(weatherAreaId);
}
}
return success;
}
}

View File

@ -0,0 +1,18 @@
package emu.grasscutter.game.quest.exec;
import emu.grasscutter.game.quest.GameQuest;
import emu.grasscutter.game.quest.QuestValueExec;
import emu.grasscutter.game.quest.enums.QuestExec;
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
import emu.grasscutter.data.common.quest.SubQuestData.QuestExecParam;
import lombok.val;
@QuestValueExec(QuestExec.QUEST_EXEC_SET_IS_WEATHER_LOCKED)
public class ExecSetIsWeatherLocked extends QuestExecHandler {
@Override
public boolean execute(GameQuest quest, QuestExecParam condition, String... paramStr) {
val lock = Integer.parseInt(paramStr[0]);
return quest.getOwner().getWorld().setWeatherIsLocked(lock != 0);
}
}

View File

@ -0,0 +1,24 @@
package emu.grasscutter.game.quest.exec;
import emu.grasscutter.data.common.quest.SubQuestData.QuestExecParam;
import emu.grasscutter.game.quest.GameQuest;
import emu.grasscutter.game.quest.QuestValueExec;
import emu.grasscutter.game.quest.enums.QuestExec;
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
import lombok.val;
@QuestValueExec(QuestExec.QUEST_EXEC_SET_WEATHER_GADGET)
public class ExecSetWeatherGadget extends QuestExecHandler {
@Override
public boolean execute(GameQuest quest, QuestExecParam condition, String... paramStr) {
val weatherAreaId = Integer.parseInt(paramStr[0]);
val openWeather = Integer.parseInt(paramStr[1]) == 1 ? true : false; //0 -> remove weather area, 1-> add weather area
if(openWeather) {
return quest.getOwner().getScene().addWeatherArea(weatherAreaId);
} else {
return quest.getOwner().getScene().removeWeatherArea(weatherAreaId);
}
}
}

View File

@ -6,6 +6,7 @@ import emu.grasscutter.data.GameDepot;
import emu.grasscutter.data.binout.SceneNpcBornEntry;
import emu.grasscutter.data.binout.routes.Route;
import emu.grasscutter.data.excels.*;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.dungeons.DungeonManager;
import emu.grasscutter.game.dungeons.settle_listeners.DungeonSettleListener;
@ -57,6 +58,7 @@ import java.util.stream.IntStream;
public class Scene {
@Getter private final World world;
@Getter private final SceneData sceneData;
@Getter private final SceneInstanceData sceneInstanceData;
@Getter private final List<Player> players = new CopyOnWriteArrayList<>();
@Getter private final Map<Integer, GameEntity> entities = new ConcurrentHashMap<>();
@Getter private final Map<Integer, GameEntity> weaponEntities = new ConcurrentHashMap<>();
@ -83,12 +85,20 @@ public class Scene {
@Getter private boolean finishedLoading = false;
@Getter private int tickCount = 0;
@Getter private boolean isPaused = false;
@Getter private final Map<Integer, WeatherArea> weatherAreas = new ConcurrentHashMap<>();
private boolean weatherLoaded = false;
@Getter private final GameEntity sceneEntity;
public Scene(World world, SceneData sceneData) {
this.world = world;
this.sceneData = sceneData;
SceneInstanceData data = DatabaseHelper.loadSceneInstanceData(sceneData.getId(), world.getOwner());
if(data != null)
this.sceneInstanceData = data;
else
this.sceneInstanceData = new SceneInstanceData(this, world.getOwner());
this.prevScene = 3;
this.sceneRoutes = GameData.getSceneRoutes(getId());
@ -188,6 +198,9 @@ public class Scene {
player.setScene(this);
setupPlayerAvatars(player);
//update weathers
player.updateWeather(this);
}
public synchronized void removePlayer(Player player) {
@ -210,6 +223,7 @@ public class Scene {
this.world.deregisterScene(this);
}
saveGroups();
saveSceneInstanceData();
}
private void setupPlayerAvatars(@NotNull Player player) {
@ -691,7 +705,7 @@ public class Scene {
public void onRegisterGroups() {
// Create the graph
val groupList = new HashSet<Integer>();
val groupIds = this.loadedGroups.stream().map(SceneGroup::getGroupInfo).map(SceneGroupInfo::getId).toList();
//val groupIds = this.loadedGroups.stream().map(SceneGroup::getGroupInfo).map(SceneGroupInfo::getId).toList();
val replacements = GameData.getGroupReplacements().values().stream()
.filter(replacement -> this.loadedGroups.stream()
.filter(g-> g.getGroupInfo().isDynamicLoad())
@ -922,7 +936,87 @@ public class Scene {
this.scriptManager.getCachedGroupInstances().values().forEach(SceneGroupInstance::save);
}
public void saveSceneInstanceData() {
this.sceneInstanceData.save();
}
public int getCurDungeonId(){
return dungeonManager != null ? dungeonManager.getDungeonData().getId() : 0;
}
public WeatherArea getWeatherArea(Position position) {
val data = GameData.getWeatherAreaPointData().get(getId());
if(data == null) return null;
int areaId = 0;
int maxPriority = -1;
for (val points : data) {
if(points.isInside(position)) {
val area = weatherAreas.get(points.getArea_id());
if(area == null) continue;
int priority = area.getConfig().getPriority();
if(priority > maxPriority) {
areaId = points.area_id;
maxPriority = priority;
}
}
}
if(areaId == 0) return null;
return weatherAreas.get(areaId);
}
//TODO: notify(recalculate current player weather) and save the current weather to database
public boolean removeWeatherArea(int areaId) {
if(!weatherAreas.containsKey(areaId)) return true;
val area = weatherAreas.get(areaId);
Grasscutter.getLogger().error("Removing Weather Area {}({})", areaId, area.getConfig().getProfileName());
area.remove();
weatherAreas.remove(areaId);
this.sceneInstanceData.removeWeather(areaId);
return true;
}
public boolean addWeatherArea(int areaId) {
if(weatherAreas.containsKey(areaId)) return false;
val w = GameData.getWeatherDataMap().get(areaId);
if (w == null) {
return false;
}
WeatherArea area = new WeatherArea(this, w);
area.init();
weatherAreas.put(areaId, area);
this.sceneInstanceData.addWeather(areaId);
//update all weather areas affected by players on this scene
this.players.forEach(p -> p.updateWeather(this));
Grasscutter.getLogger().error("Added Weather Area {}({}), climateType {}", areaId, area.getConfig().getProfileName(), area.getCurrentClimateType().name());
return true;
}
public void reloadWeathers() {
if(weatherLoaded) return;
this.sceneInstanceData.getWeatherAreas().entrySet().forEach(e -> {
val w = GameData.getWeatherDataMap().get((int)e.getKey());
if(w != null && !this.weatherAreas.containsKey(e.getKey())) {
WeatherArea area = new WeatherArea(this, w);
area.setClimateType(ClimateType.getTypeByValue((int)e.getValue()));
weatherAreas.put((int)e.getKey(), area);
}
});
weatherLoaded = true;
}
}

View File

@ -0,0 +1,55 @@
package emu.grasscutter.game.world;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bson.types.ObjectId;
import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Id;
import dev.morphia.annotations.Indexed;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ClimateType;
import lombok.Getter;
@Entity(value = "scene_datas", useDiscriminator = false)
public class SceneInstanceData {
@Id private ObjectId id;
@Indexed private int ownerUid;
@Getter private int sceneId;
@Getter private Map<Integer, Integer> weatherAreas;
public SceneInstanceData(Scene scene, Player owner) {
this.sceneId = scene.getId();
this.ownerUid = owner.getUid();
this.weatherAreas = new ConcurrentHashMap<>();
}
@Deprecated // Morphia only!
SceneInstanceData(){
this.weatherAreas = new ConcurrentHashMap<>();
}
public void save() {
DatabaseHelper.saveSceneInstanceData(this);
}
public void addWeather(int areaId) {
if(!weatherAreas.containsKey(areaId))
weatherAreas.put(areaId, ClimateType.CLIMATE_NONE.getValue());
}
public void updateWeather(int areaId, ClimateType type) {
if(weatherAreas.containsKey(areaId))
weatherAreas.replace(areaId, type.getValue());
}
public void removeWeather(int areaId) {
if(weatherAreas.containsKey(areaId))
weatherAreas.remove(areaId);
}
}

View File

@ -0,0 +1,196 @@
package emu.grasscutter.game.world;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.WeatherData;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.Player.SceneLoadState;
import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify;
import lombok.Getter;
import lombok.val;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.CopyOnWriteArrayList;
import com.mongodb.lang.Nullable;
public class WeatherArea {
@Getter private final Scene scene;
@Getter private WeatherData config;
@Getter private ClimateType climateType;
@Getter private float transDuration = 0;
@Nullable
private ClimateType currentClimateType = null; //TODO: Related to abilities
public static float WeatherChangeInterval = 4;
public static int WeatherForcastNum = 0xC;
public static int GameHourSeconds = 10000;
@Getter private int currentTime = 0;
@Getter private final List<Integer> forcastList = new ArrayList<>();
@Getter private final List<Player> players = new CopyOnWriteArrayList<>();
public enum WeatherRefreshType {
REFRESH_WEATHER_NONE(0),
REFRESH_WEATHER_HOUR(1),
REFRESH_WEATHER_ENTER(2),
REFRESH_WEATHER_QUERY(3),
REFRESH_WEATHER_FORCAST(4),
REFRESH_WEATHER_INIT(5)
;
private final int value;
WeatherRefreshType(int id) {
this.value = id;
}
public int getValue() {
return value;
}
}
public WeatherArea(Scene scene, WeatherData config) {
this.scene = scene;
this.config = config;
}
public ClimateType getCurrentClimateType() {
if(currentClimateType == null)
return climateType;
return currentClimateType;
}
public void setClimateType(ClimateType type) {
this.scene.getSceneInstanceData().updateWeather(config.getAreaID(), type);
this.climateType = type;
}
public void init() {
refresh(WeatherRefreshType.REFRESH_WEATHER_INIT);
}
public boolean enterArea(Player player) {
if(players.contains(player)) return false;
players.add(player);
refresh(WeatherRefreshType.REFRESH_WEATHER_ENTER);
return true;
}
public boolean leaveArea(Player player) {
if(!players.contains(player)) return false;
players.remove(player);
return true;
}
public void remove() {
for (Player player : this.players) {
//Remove player from this area and notify it
if(player.getSceneLoadState().getValue() >= SceneLoadState.INIT.getValue())
player.sendPacket(new PacketSceneAreaWeatherNotify(0, ClimateType.CLIMATE_NONE, 0));
}
}
public ClimateType randWeather(ClimateType initClimateType) {
val mapping = GameData.getWeatherMappingMap().get(config.getAreaID());
if(mapping == null) return ClimateType.CLIMATE_SUNNY;
var searchType = climateType;
if(searchType == ClimateType.CLIMATE_NONE) searchType = config.getDefaultClimate();
val templateData = GameData.getWeatherTemplateDataByNameMap().get(mapping.getTemplate()+searchType.getValue());
if(templateData == null) return ClimateType.CLIMATE_SUNNY;
float maxNumber = templateData.getSunnyProb() +
templateData.getCloudyProb() +
templateData.getRainProb() +
templateData.getThunderstormProb() +
templateData.getSnowProb() +
templateData.getMistProb();
if(maxNumber == 0.0) return config.getDefaultClimate();
float randomNumber = (float)Math.random() * maxNumber;
if(randomNumber < templateData.getSunnyProb())
return ClimateType.CLIMATE_SUNNY;
else if(randomNumber < templateData.getCloudyProb())
return ClimateType.CLIMATE_CLOUDY;
else if(randomNumber < templateData.getRainProb())
return ClimateType.CLIMATE_RAIN;
else if(randomNumber < templateData.getThunderstormProb())
return ClimateType.CLIMATE_THUNDERSTORM;
else if(randomNumber < templateData.getSnowProb())
return ClimateType.CLIMATE_SNOW;
else if(randomNumber < templateData.getMistProb())
return ClimateType.CLIMATE_MIST;
return ClimateType.CLIMATE_SUNNY;
}
public ClimateType randWeather() {
return randWeather(config.getDefaultClimate());
}
public void refresh(WeatherRefreshType type) {
if(config.isDefaultValid()) {
//Easy part
setClimateType(config.getDefaultClimate());
} else {
if(scene.getWorld().isWeatherLocked()) return;
int refreshInterval = (int)(WeatherChangeInterval * GameHourSeconds);
ClimateType oldClimateType = climateType;
//here do nothing if weather is locked
int sceneTime = scene.getSceneTimeSeconds();
int nextTime = sceneTime + (refreshInterval - sceneTime % refreshInterval);
if(currentTime <= sceneTime) {
if(/*forcastList.isEmpty() || */(nextTime <= currentTime)) return;
ClimateType cType = ClimateType.CLIMATE_NONE;
if(currentTime < nextTime) {
if(currentTime == 0) {
cType = config.getDefaultClimate();
} else {
cType = randWeather();
}
setClimateType(cType);
currentTime = nextTime;
}
for(int i = forcastList.size(); i < WeatherForcastNum; i++) {
int forcastId = 0;
if(forcastList.isEmpty()) {
forcastId = climateType.getValue();
} else {
forcastId = forcastList.get(forcastList.size() - 1);
}
int newForcastId = randWeather(ClimateType.getTypeByValue(forcastId)).getValue();
forcastList.add(newForcastId);
}
if(oldClimateType != climateType) {
if(type == WeatherRefreshType.REFRESH_WEATHER_HOUR) {
for (Player player : this.players) {
if(player.getSceneLoadState().getValue() >= SceneLoadState.INIT.getValue())
player.sendPacket(new PacketSceneAreaWeatherNotify(this.config.getAreaID(), climateType, transDuration));
}
}
if(type == WeatherRefreshType.REFRESH_WEATHER_NONE ||
type == WeatherRefreshType.REFRESH_WEATHER_HOUR ||
type == WeatherRefreshType.REFRESH_WEATHER_ENTER) {
//TODO: scene.onWeatherChange
//TODO: envanimal -> VISION_GATHER_ESCAPE related
}
}
}
if(nextTime < currentTime) {
//Rollback
currentTime = nextTime;
}
}
}
}

View File

@ -47,6 +47,7 @@ public class World implements Iterable<Player> {
@Getter private int tickCount = 0;
@Getter private boolean isPaused = false;
@Getter private boolean isGameTimeLocked = false;
@Getter private boolean isWeatherLocked = false;
private long lastUpdateTime;
@Getter private long currentWorldTime = 0;
@Getter private long currentGameTime = 540;
@ -70,6 +71,7 @@ public class World implements Iterable<Player> {
this.lastUpdateTime = System.currentTimeMillis();
this.currentGameTime = owner.getPlayerGameTime();
this.isGameTimeLocked = owner.getBoolProperty(PlayerProperty.PROP_IS_GAME_TIME_LOCKED);
this.isWeatherLocked = owner.getBoolProperty(PlayerProperty.PROP_IS_WEATHER_LOCKED);
this.worldRandomGenerator = new Random();
@ -86,6 +88,12 @@ public class World implements Iterable<Player> {
return true;
}
public boolean setWeatherIsLocked(boolean weatherLocked) {
isWeatherLocked = weatherLocked;
getPlayers().forEach(p -> p.setProperty(PlayerProperty.PROP_IS_WEATHER_LOCKED, isWeatherLocked));
return true;
}
public Player getHost() {
return owner;
}
@ -383,6 +391,7 @@ public class World implements Iterable<Player> {
if(tickCount%10 == 0){
players.forEach(p -> p.sendPacket(new PacketPlayerGameTimeNotify(p)));
isGameTimeLocked = getHost().getBoolProperty(PlayerProperty.PROP_IS_GAME_TIME_LOCKED);
isWeatherLocked = getHost().getBoolProperty(PlayerProperty.PROP_IS_WEATHER_LOCKED);
}
// store updated world time every 60 seconds (ingame hour)
if(tickCount%60 == 0){

View File

@ -18,6 +18,7 @@ import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.game.quest.enums.QuestCond;
import emu.grasscutter.game.quest.enums.QuestContent;
import emu.grasscutter.game.world.SceneGroupInstance;
import emu.grasscutter.game.world.WeatherArea;
import emu.grasscutter.scripts.lua_engine.GroupEventLuaContext;
import emu.grasscutter.scripts.scriptlib_handlers.BaseHandler;
import emu.grasscutter.server.packet.send.*;
@ -1397,13 +1398,20 @@ public class ScriptLibHandler extends BaseHandler implements org.anime_game_serv
@Override
public int SetWeatherAreaState(GroupEventLuaContext context, int var1, int var2) {
logger.warn("[LUA] Call unimplemented SetWeatherAreaState with {} {}", var1, var2);
context.getSceneScriptManager().getScene().getPlayers().forEach(p -> p.setWeather(var1, ClimateType.getTypeByValue(var2)));
return 0;
if(var2 != 0) {
return context.getSceneScriptManager().getScene().addWeatherArea(var1) ? 0 : 1;
} else {
return context.getSceneScriptManager().getScene().removeWeatherArea(var1) ? 0 : 1;
}
}
@Override
public int EnterWeatherArea(GroupEventLuaContext context, int weatherAreaId) {
return handleUnimplemented(weatherAreaId);
context.getSceneScriptManager().getScene().getPlayers().forEach(p -> {
if(p.getWeatherAreaId() != weatherAreaId) p.updateWeather(p.getScene());
});
return 0;
}
@Override

View File

@ -1,19 +1,14 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.GetSceneAreaReqOuterClass.GetSceneAreaReq;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.TypedPacketHandler;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketGetSceneAreaRsp;
import messages.scene.GetSceneAreaReq;
@Opcodes(PacketOpcodes.GetSceneAreaReq)
public class HandlerGetSceneAreaReq extends PacketHandler {
public class HandlerGetSceneAreaReq extends TypedPacketHandler<GetSceneAreaReq> {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
GetSceneAreaReq req = GetSceneAreaReq.parseFrom(payload);
public void handle(GameSession session, byte[] header, GetSceneAreaReq req) throws Exception {
session.send(new PacketGetSceneAreaRsp(session.getPlayer(), req.getSceneId()));
}

View File

@ -0,0 +1,17 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.game.GameSession;
import messages.scene.LevelupCityReq;
public class HandlerLevelupCityReq extends TypedPacketHandler<LevelupCityReq> {
@Override
public void handle(GameSession session, byte[] header, LevelupCityReq req) throws Exception {
// Level up city
session
.getPlayer()
.getSotsManager()
.levelUpSotS(req.getAreaId(), req.getSceneId(), req.getItemNum());
}
}

View File

@ -2,9 +2,11 @@ package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.dungeons.DungeonManager;
import emu.grasscutter.game.player.Player.SceneLoadState;
import emu.grasscutter.game.world.WeatherArea;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.*;
import lombok.val;
import messages.scene.SceneInitFinishReq;
import java.util.Optional;
@ -28,7 +30,14 @@ public class HandlerSceneInitFinishReq extends TypedPacketHandler<SceneInitFinis
session.send(new PacketSceneTimeNotify(session.getPlayer()));
session.send(new PacketPlayerGameTimeNotify(session.getPlayer()));
session.send(new PacketPlayerEnterSceneInfoNotify(session.getPlayer()));
session.send(new PacketSceneAreaWeatherNotify(session.getPlayer()));
session.getPlayer().getScene().reloadWeathers();
session.getPlayer().updateWeather(session.getPlayer().getScene());
val area = session.getPlayer().getScene().getWeatherAreas().get(session.getPlayer().getWeatherAreaId());
if(area != null)
session.send(new PacketSceneAreaWeatherNotify(area.getConfig().getAreaID(), area.getCurrentClimateType(), area.getTransDuration()));
else //TODO: Remove old climate implementation, you can use areaId 0 and climate type none, but needs testing
session.send(new PacketSceneAreaWeatherNotify(session.getPlayer()));
session.send(new PacketScenePlayerInfoNotify(session.getPlayer().getWorld()));
session.send(new PacketSceneTeamUpdateNotify(session.getPlayer()));

View File

@ -0,0 +1,30 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.game.world.WeatherArea.WeatherRefreshType;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.packet.TypedPacketHandler;
import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketSceneWeatherForcastRsp;
import lombok.val;
import messages.scene.weather.SceneWeatherForecastReq;
@Opcodes(PacketOpcodes.SceneWeatherForcastReq)
public class HandlerSceneWeatherForcastReq extends TypedPacketHandler<SceneWeatherForecastReq> {
@Override
public void handle(GameSession session, byte[] header, SceneWeatherForecastReq req) throws Exception {
val areaId = req.getWeatherAreaId();
val player = session.getPlayer();
val area = player.getScene().getWeatherAreas().get(areaId);
if(area != null) {
area.refresh(WeatherRefreshType.REFRESH_WEATHER_FORCAST);
val forcast = area.getForcastList();
session.getPlayer().sendPacket(new PacketSceneWeatherForcastRsp(forcast));
} else {
session.getPlayer().sendPacket(new PacketSceneWeatherForcastRsp(Retcode.RET_FAIL_VALUE));
}
}
}

View File

@ -1,31 +1,25 @@
package emu.grasscutter.server.packet.send;
import java.util.ArrayList;
import emu.grasscutter.data.GameData;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.CityInfoOuterClass.CityInfo;
import emu.grasscutter.net.proto.GetSceneAreaRspOuterClass.GetSceneAreaRsp;
import lombok.val;
import emu.grasscutter.net.packet.BaseTypedPacket;
import messages.scene.GetSceneAreaRsp;
public class PacketGetSceneAreaRsp extends BasePacket {
public class PacketGetSceneAreaRsp extends BaseTypedPacket<GetSceneAreaRsp> {
public PacketGetSceneAreaRsp(Player player, int sceneId) {
super(PacketOpcodes.GetSceneAreaRsp);
super(new GetSceneAreaRsp());
this.buildHeader(0);
val p = GetSceneAreaRsp.newBuilder()
.setSceneId(sceneId)
.addAllAreaIdList(player.getUnlockedSceneAreas(sceneId));
proto.setSceneId(sceneId);
proto.setAreaIdList(new ArrayList<>(player.getUnlockedSceneAreas(sceneId)));
proto.setCityInfoList(new ArrayList<>());
GameData.getCityDataMap().values().stream().filter(cityData -> cityData.getSceneId() == sceneId).forEach(cityData -> {
p.addCityInfoList(CityInfo.newBuilder()
.setCityId(cityData.getCityId())
.setLevel(1)
.build());
proto.getCityInfoList().add(player.getSotsManager().getCityInfo(cityData.getCityId()).toProto());
});
this.setData(p);
}
}

View File

@ -0,0 +1,18 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BaseTypedPacket;
import messages.scene.CityInfo;
import messages.scene.LevelupCityRsp;
public class PacketLevelupCityRsp extends BaseTypedPacket<LevelupCityRsp> {
public PacketLevelupCityRsp(
int sceneId, int level, int cityId, int crystalNum, int areaId, int retcode) {
super(new LevelupCityRsp());
proto.setSceneId(sceneId);
proto.setCityInfo(new CityInfo(cityId, crystalNum, level));
proto.setAreaId(areaId);
proto.setRetcode(retcode);
}
}

View File

@ -1,6 +1,7 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.net.packet.BaseTypedPacket;
import messages.scene.weather.SceneAreaWeatherNotify;
@ -12,4 +13,12 @@ public class PacketSceneAreaWeatherNotify extends BaseTypedPacket<SceneAreaWeath
proto.setWeatherAreaId(player.getWeatherId());
proto.setClimateType(player.getClimate().getValue());
}
public PacketSceneAreaWeatherNotify(int areaId, ClimateType type, float transDuration) {
super(new SceneAreaWeatherNotify());
proto.setWeatherAreaId(areaId);
proto.setClimateType(type.getValue());
proto.setTransDuration(transDuration);
}
}

View File

@ -6,23 +6,37 @@ import emu.grasscutter.net.proto.ScenePointUnlockNotifyOuterClass.ScenePointUnlo
public class PacketScenePointUnlockNotify extends BasePacket {
public PacketScenePointUnlockNotify(int sceneId, int pointId) {
this(sceneId, pointId, false);
}
public PacketScenePointUnlockNotify(int sceneId, int pointId, boolean lock) {
super(PacketOpcodes.ScenePointUnlockNotify);
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId)
.addPointList(pointId)
.addUnhidePointList(pointId);
.addPointList(pointId);
if(lock)
p.addLockedPointList(pointId);
else
p.addUnhidePointList(pointId);
this.setData(p);
}
public PacketScenePointUnlockNotify(int sceneId, Iterable<Integer> pointIds) {
this(sceneId, pointIds, false);
}
public PacketScenePointUnlockNotify(int sceneId, Iterable<Integer> pointIds, boolean lock) {
super(PacketOpcodes.ScenePointUnlockNotify);
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId)
.addAllPointList(pointIds)
.addAllUnhidePointList(pointIds);
.addAllPointList(pointIds);
if(lock)
p.addAllLockedPointList(pointIds);
else
p.addAllUnhidePointList(pointIds);
this.setData(p);
}

View File

@ -0,0 +1,22 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BaseTypedPacket;
import messages.scene.weather.SceneWeatherForecastRsp;
import java.util.List;
public class PacketSceneWeatherForcastRsp extends BaseTypedPacket<SceneWeatherForecastRsp> {
public PacketSceneWeatherForcastRsp(List<Integer> forcastList) {
super(new SceneWeatherForecastRsp());
proto.setForecastClimateList(forcastList);
}
public PacketSceneWeatherForcastRsp(int retcode) {
super(new SceneWeatherForecastRsp());
proto.setRetcode(retcode);
}
}