mirror of
https://github.com/Anime-Game-Servers/Grasscutter-Quests.git
synced 2024-12-03 10:10:42 +00:00
Merge branch 'new-drop' of github.com:eternalcomet/ys into drops
# Conflicts: # src/main/java/emu/grasscutter/game/world/Scene.java # src/main/java/emu/grasscutter/scripts/SceneScriptManager.java # src/main/java/emu/grasscutter/scripts/data/SceneMonster.java
This commit is contained in:
commit
f27d481f6d
@ -0,0 +1,689 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: WorldChestOpenNotify.proto
|
||||
|
||||
package emu.grasscutter.net.proto;
|
||||
|
||||
public final class WorldChestOpenNotifyOuterClass {
|
||||
private WorldChestOpenNotifyOuterClass() {}
|
||||
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 WorldChestOpenNotifyOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:WorldChestOpenNotify)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>uint32 group_id = 6;</code>
|
||||
* @return The groupId.
|
||||
*/
|
||||
int getGroupId();
|
||||
|
||||
/**
|
||||
* <code>uint32 scene_id = 9;</code>
|
||||
* @return The sceneId.
|
||||
*/
|
||||
int getSceneId();
|
||||
|
||||
/**
|
||||
* <code>uint32 config_id = 12;</code>
|
||||
* @return The configId.
|
||||
*/
|
||||
int getConfigId();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* CmdId: 3295
|
||||
* EnetChannelId: 0
|
||||
* EnetIsReliable: true
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf type {@code WorldChestOpenNotify}
|
||||
*/
|
||||
public static final class WorldChestOpenNotify extends
|
||||
com.google.protobuf.GeneratedMessageV3 implements
|
||||
// @@protoc_insertion_point(message_implements:WorldChestOpenNotify)
|
||||
WorldChestOpenNotifyOrBuilder {
|
||||
private static final long serialVersionUID = 0L;
|
||||
// Use WorldChestOpenNotify.newBuilder() to construct.
|
||||
private WorldChestOpenNotify(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private WorldChestOpenNotify() {
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@SuppressWarnings({"unused"})
|
||||
protected java.lang.Object newInstance(
|
||||
UnusedPrivateParameter unused) {
|
||||
return new WorldChestOpenNotify();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return this.unknownFields;
|
||||
}
|
||||
private WorldChestOpenNotify(
|
||||
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 48: {
|
||||
|
||||
groupId_ = input.readUInt32();
|
||||
break;
|
||||
}
|
||||
case 72: {
|
||||
|
||||
sceneId_ = input.readUInt32();
|
||||
break;
|
||||
}
|
||||
case 96: {
|
||||
|
||||
configId_ = 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.WorldChestOpenNotifyOuterClass.internal_static_WorldChestOpenNotify_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.internal_static_WorldChestOpenNotify_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.class, emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.Builder.class);
|
||||
}
|
||||
|
||||
public static final int GROUP_ID_FIELD_NUMBER = 6;
|
||||
private int groupId_;
|
||||
/**
|
||||
* <code>uint32 group_id = 6;</code>
|
||||
* @return The groupId.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getGroupId() {
|
||||
return groupId_;
|
||||
}
|
||||
|
||||
public static final int SCENE_ID_FIELD_NUMBER = 9;
|
||||
private int sceneId_;
|
||||
/**
|
||||
* <code>uint32 scene_id = 9;</code>
|
||||
* @return The sceneId.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getSceneId() {
|
||||
return sceneId_;
|
||||
}
|
||||
|
||||
public static final int CONFIG_ID_FIELD_NUMBER = 12;
|
||||
private int configId_;
|
||||
/**
|
||||
* <code>uint32 config_id = 12;</code>
|
||||
* @return The configId.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getConfigId() {
|
||||
return configId_;
|
||||
}
|
||||
|
||||
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 (groupId_ != 0) {
|
||||
output.writeUInt32(6, groupId_);
|
||||
}
|
||||
if (sceneId_ != 0) {
|
||||
output.writeUInt32(9, sceneId_);
|
||||
}
|
||||
if (configId_ != 0) {
|
||||
output.writeUInt32(12, configId_);
|
||||
}
|
||||
unknownFields.writeTo(output);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (groupId_ != 0) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(6, groupId_);
|
||||
}
|
||||
if (sceneId_ != 0) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(9, sceneId_);
|
||||
}
|
||||
if (configId_ != 0) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(12, configId_);
|
||||
}
|
||||
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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify other = (emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify) obj;
|
||||
|
||||
if (getGroupId()
|
||||
!= other.getGroupId()) return false;
|
||||
if (getSceneId()
|
||||
!= other.getSceneId()) return false;
|
||||
if (getConfigId()
|
||||
!= other.getConfigId()) 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) + GROUP_ID_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getGroupId();
|
||||
hash = (37 * hash) + SCENE_ID_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getSceneId();
|
||||
hash = (37 * hash) + CONFIG_ID_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getConfigId();
|
||||
hash = (29 * hash) + unknownFields.hashCode();
|
||||
memoizedHashCode = hash;
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseFrom(
|
||||
java.nio.ByteBuffer data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify 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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify 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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify 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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify 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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify 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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify 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: 3295
|
||||
* EnetChannelId: 0
|
||||
* EnetIsReliable: true
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf type {@code WorldChestOpenNotify}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:WorldChestOpenNotify)
|
||||
emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotifyOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.internal_static_WorldChestOpenNotify_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.internal_static_WorldChestOpenNotify_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.class, emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.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();
|
||||
groupId_ = 0;
|
||||
|
||||
sceneId_ = 0;
|
||||
|
||||
configId_ = 0;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.internal_static_WorldChestOpenNotify_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify getDefaultInstanceForType() {
|
||||
return emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.getDefaultInstance();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify build() {
|
||||
emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify buildPartial() {
|
||||
emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify result = new emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify(this);
|
||||
result.groupId_ = groupId_;
|
||||
result.sceneId_ = sceneId_;
|
||||
result.configId_ = configId_;
|
||||
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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify) {
|
||||
return mergeFrom((emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify other) {
|
||||
if (other == emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify.getDefaultInstance()) return this;
|
||||
if (other.getGroupId() != 0) {
|
||||
setGroupId(other.getGroupId());
|
||||
}
|
||||
if (other.getSceneId() != 0) {
|
||||
setSceneId(other.getSceneId());
|
||||
}
|
||||
if (other.getConfigId() != 0) {
|
||||
setConfigId(other.getConfigId());
|
||||
}
|
||||
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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify) e.getUnfinishedMessage();
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private int groupId_ ;
|
||||
/**
|
||||
* <code>uint32 group_id = 6;</code>
|
||||
* @return The groupId.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getGroupId() {
|
||||
return groupId_;
|
||||
}
|
||||
/**
|
||||
* <code>uint32 group_id = 6;</code>
|
||||
* @param value The groupId to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setGroupId(int value) {
|
||||
|
||||
groupId_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>uint32 group_id = 6;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearGroupId() {
|
||||
|
||||
groupId_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private int sceneId_ ;
|
||||
/**
|
||||
* <code>uint32 scene_id = 9;</code>
|
||||
* @return The sceneId.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getSceneId() {
|
||||
return sceneId_;
|
||||
}
|
||||
/**
|
||||
* <code>uint32 scene_id = 9;</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 = 9;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearSceneId() {
|
||||
|
||||
sceneId_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private int configId_ ;
|
||||
/**
|
||||
* <code>uint32 config_id = 12;</code>
|
||||
* @return The configId.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getConfigId() {
|
||||
return configId_;
|
||||
}
|
||||
/**
|
||||
* <code>uint32 config_id = 12;</code>
|
||||
* @param value The configId to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setConfigId(int value) {
|
||||
|
||||
configId_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>uint32 config_id = 12;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearConfigId() {
|
||||
|
||||
configId_ = 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:WorldChestOpenNotify)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:WorldChestOpenNotify)
|
||||
private static final emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify();
|
||||
}
|
||||
|
||||
public static emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<WorldChestOpenNotify>
|
||||
PARSER = new com.google.protobuf.AbstractParser<WorldChestOpenNotify>() {
|
||||
@java.lang.Override
|
||||
public WorldChestOpenNotify parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new WorldChestOpenNotify(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<WorldChestOpenNotify> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<WorldChestOpenNotify> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public emu.grasscutter.net.proto.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_WorldChestOpenNotify_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_WorldChestOpenNotify_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\032WorldChestOpenNotify.proto\"M\n\024WorldChe" +
|
||||
"stOpenNotify\022\020\n\010group_id\030\006 \001(\r\022\020\n\010scene_" +
|
||||
"id\030\t \001(\r\022\021\n\tconfig_id\030\014 \001(\rB\033\n\031emu.grass" +
|
||||
"cutter.net.protob\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
});
|
||||
internal_static_WorldChestOpenNotify_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_WorldChestOpenNotify_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_WorldChestOpenNotify_descriptor,
|
||||
new java.lang.String[] { "GroupId", "SceneId", "ConfigId", });
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
@ -19,7 +19,7 @@ public final class ReloadCommand implements CommandHandler {
|
||||
Grasscutter.loadConfig();
|
||||
Grasscutter.loadLanguage();
|
||||
Grasscutter.getGameServer().getGachaSystem().load();
|
||||
Grasscutter.getGameServer().getDropSystem().load();
|
||||
Grasscutter.getGameServer().getDropSystemLegacy().load();
|
||||
Grasscutter.getGameServer().getShopSystem().load();
|
||||
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.reload.reload_done"));
|
||||
|
@ -81,6 +81,8 @@ public class GameData {
|
||||
@Getter private static final Int2ObjectMap<CookRecipeData> cookRecipeDataMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<CompoundData> compoundDataMap=new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<DailyDungeonData> dailyDungeonDataMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<DropTableData> dropTableDataMap=new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<DropMaterialData> dropMaterialDataMap=new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<DungeonData> dungeonDataMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<DungeonEntryData> dungeonEntryDataMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static final Int2ObjectMap<EnvAnimalGatherConfigData> envAnimalGatherConfigDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
12
src/main/java/emu/grasscutter/data/common/DropItemData.java
Normal file
12
src/main/java/emu/grasscutter/data/common/DropItemData.java
Normal file
@ -0,0 +1,12 @@
|
||||
package emu.grasscutter.data.common;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class DropItemData {
|
||||
@SerializedName(value="itemId")
|
||||
private int id;
|
||||
private String countRange;
|
||||
private int weight;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import lombok.Getter;
|
||||
|
||||
@ResourceType(name = "DropMaterialExcelConfigData.json")
|
||||
@Getter
|
||||
public class DropMaterialData extends GameResource {
|
||||
@Getter(onMethod = @__(@Override))
|
||||
private int id;
|
||||
private boolean useOnGain;
|
||||
private boolean disableFirstGainHint;
|
||||
private boolean autoPick;
|
||||
private boolean dropSeparately;
|
||||
private int groupId;
|
||||
private boolean forceGainHint;
|
||||
}
|
25
src/main/java/emu/grasscutter/data/excels/DropTableData.java
Normal file
25
src/main/java/emu/grasscutter/data/excels/DropTableData.java
Normal file
@ -0,0 +1,25 @@
|
||||
package emu.grasscutter.data.excels;
|
||||
|
||||
import emu.grasscutter.data.GameResource;
|
||||
import emu.grasscutter.data.ResourceType;
|
||||
import emu.grasscutter.data.ResourceType.LoadPriority;
|
||||
import emu.grasscutter.data.common.DropItemData;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ResourceType(name ={"DropTableExcelConfigData.json","DropSubTableExcelConfigData.json"} , loadPriority = LoadPriority.HIGH)
|
||||
@Getter
|
||||
public class DropTableData extends GameResource {
|
||||
@Getter(onMethod = @__(@Override))
|
||||
private int id;
|
||||
private int randomType;
|
||||
private int dropLevel;
|
||||
private List<DropItemData> dropVec;
|
||||
private int nodeType;
|
||||
private boolean fallToGround;
|
||||
private int sourceType;
|
||||
private int everydayLimit;
|
||||
private int historyLimit;
|
||||
private int activityLimit;
|
||||
}
|
11
src/main/java/emu/grasscutter/game/drop/BaseDropData.java
Normal file
11
src/main/java/emu/grasscutter/game/drop/BaseDropData.java
Normal file
@ -0,0 +1,11 @@
|
||||
package emu.grasscutter.game.drop;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class BaseDropData {
|
||||
private int minLevel;
|
||||
private String index;
|
||||
private int dropId;
|
||||
private int dropCount;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package emu.grasscutter.game.drop;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ChestDropData extends BaseDropData {
|
||||
private int sourceType;
|
||||
private String type;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package emu.grasscutter.game.drop;
|
||||
|
||||
@Deprecated
|
||||
public class DropData {
|
||||
private int minWeight;
|
||||
private int maxWeight;
|
||||
|
@ -3,104 +3,257 @@ package emu.grasscutter.game.drop;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.DataLoader;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.ItemData;
|
||||
import emu.grasscutter.game.entity.EntityItem;
|
||||
import emu.grasscutter.data.common.DropItemData;
|
||||
import emu.grasscutter.data.excels.DropMaterialData;
|
||||
import emu.grasscutter.data.excels.DropTableData;
|
||||
import emu.grasscutter.game.entity.EntityMonster;
|
||||
import emu.grasscutter.game.entity.GameEntity;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.inventory.ItemType;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.ActionReason;
|
||||
import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.scripts.data.SceneMonster;
|
||||
import emu.grasscutter.server.game.BaseGameSystem;
|
||||
import emu.grasscutter.server.game.GameServer;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import emu.grasscutter.server.packet.send.PacketDropHintNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketGadgetAutoPickDropInfoNotify;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class DropSystem extends BaseGameSystem {
|
||||
private final Int2ObjectMap<List<DropData>> dropData;
|
||||
private final Int2ObjectMap<DropTableData> dropTable;
|
||||
private final Map<String, List<BaseDropData>> chestReward;
|
||||
private final Map<String, List<BaseDropData>> monsterDrop;
|
||||
private final Random rand;
|
||||
//TODO:don't know how to determine boss level.Have to hard-code the data from wiki.
|
||||
private final int[] bossLevel = {36, 37, 41, 50, 62, 72, 83, 91, 93};
|
||||
|
||||
public DropSystem(GameServer server) {
|
||||
super(server);
|
||||
this.dropData = new Int2ObjectOpenHashMap<>();
|
||||
this.load();
|
||||
}
|
||||
|
||||
public Int2ObjectMap<List<DropData>> getDropData() {
|
||||
return dropData;
|
||||
}
|
||||
|
||||
public synchronized void load() {
|
||||
getDropData().clear();
|
||||
rand = new Random();
|
||||
dropTable = GameData.getDropTableDataMap();
|
||||
chestReward = new HashMap<>();
|
||||
monsterDrop = new HashMap<>();
|
||||
try {
|
||||
List<DropInfo> banners = DataLoader.loadList("Drop.json", DropInfo.class);
|
||||
if (banners.size() > 0) {
|
||||
for (DropInfo di : banners) {
|
||||
getDropData().put(di.getMonsterId(), di.getDropDataList());
|
||||
List<ChestDropData> dataList = DataLoader.loadList("ChestDrop.json", ChestDropData.class);
|
||||
for (var i : dataList) {
|
||||
if (!chestReward.containsKey(i.getIndex())) {
|
||||
chestReward.put(i.getIndex(), new ArrayList<>());
|
||||
}
|
||||
Grasscutter.getLogger().debug("Drop data successfully loaded.");
|
||||
} else {
|
||||
Grasscutter.getLogger().error("Unable to load drop data. Drop data size is 0.");
|
||||
chestReward.get(i.getIndex()).add(i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Unable to load drop data.", e);
|
||||
Grasscutter.getLogger().error("Unable to load chest drop data.Please place ChestDrop.json in data folder.");
|
||||
}
|
||||
}
|
||||
private void addDropEntity(DropData dd, Scene dropScene, ItemData itemData, Position pos, int num, Player target) {
|
||||
if (!dd.isGive() && (itemData.getItemType() != ItemType.ITEM_VIRTUAL || itemData.getGadgetId() != 0)) {
|
||||
EntityItem entity = new EntityItem(dropScene, target, itemData, pos, num, dd.isShare());
|
||||
if (!dd.isShare())
|
||||
dropScene.addEntityToSingleClient(target, entity);
|
||||
else
|
||||
dropScene.addEntity(entity);
|
||||
} else {
|
||||
if (target != null) {
|
||||
target.getInventory().addItem(new GameItem(itemData, num), ActionReason.SubfieldDrop, true);
|
||||
} else {
|
||||
// target is null if items will be added are shared. no one could pick it up because of the combination(give + shared)
|
||||
// so it will be sent to all players' inventories directly.
|
||||
dropScene.getPlayers().forEach(x -> x.getInventory().addItem(new GameItem(itemData, num), ActionReason.SubfieldDrop, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processDrop(DropData dd, EntityMonster em, Player gp) {
|
||||
int target = Utils.randomRange(1, 10000);
|
||||
if (target >= dd.getMinWeight() && target < dd.getMaxWeight()) {
|
||||
ItemData itemData = GameData.getItemDataMap().get(dd.getItemId());
|
||||
int num = Utils.randomRange(dd.getMinCount(), dd.getMaxCount());
|
||||
|
||||
if (itemData == null) {
|
||||
return;
|
||||
}
|
||||
if (itemData.isEquip()) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
float range = (2.5f + (.05f * num));
|
||||
Position pos = em.getPosition().nearby2d(range).addY(3f);
|
||||
addDropEntity(dd, em.getScene(), itemData, pos, num, gp);
|
||||
try {
|
||||
List<BaseDropData> dataList = DataLoader.loadList("MonsterDrop.json", BaseDropData.class);
|
||||
for (var i : dataList) {
|
||||
if (!monsterDrop.containsKey(i.getIndex())) {
|
||||
monsterDrop.put(i.getIndex(), new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
Position pos = em.getPosition().clone().addY(3f);
|
||||
addDropEntity(dd, em.getScene(), itemData, pos, num, gp);
|
||||
monsterDrop.get(i.getIndex()).add(i);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Unable to load monster drop data.Please place MonsterDrop.json in data folder.");
|
||||
}
|
||||
}
|
||||
|
||||
public void callDrop(EntityMonster em) {
|
||||
int id = em.getMonsterData().getId();
|
||||
if (getDropData().containsKey(id)) {
|
||||
for (DropData dd : getDropData().get(id)) {
|
||||
if (dd.isShare())
|
||||
processDrop(dd, em, null);
|
||||
else {
|
||||
for (Player gp : em.getScene().getPlayers()) {
|
||||
processDrop(dd, em, gp);
|
||||
private int queryDropData(String dropTag, int level, Map<String, List<BaseDropData>> rewards) {
|
||||
if (!rewards.containsKey(dropTag)) return 0;
|
||||
var rewardList = rewards.get(dropTag);
|
||||
BaseDropData dropData = null;
|
||||
int minLevel = 0;
|
||||
for (var i : rewardList) {
|
||||
if (level >= i.getMinLevel() && i.getMinLevel() > minLevel) {
|
||||
minLevel = i.getMinLevel();
|
||||
dropData = i;
|
||||
}
|
||||
}
|
||||
if (dropData == null) return 0;
|
||||
return dropData.getDropId();
|
||||
}
|
||||
|
||||
public boolean handleMonsterDrop(EntityMonster monster) {
|
||||
int dropId;
|
||||
int level = monster.getLevel();
|
||||
SceneMonster sceneMonster = monster.getMetaMonster();
|
||||
if (sceneMonster != null) {
|
||||
if (sceneMonster.drop_tag != null) {
|
||||
dropId = queryDropData(sceneMonster.drop_tag, level, monsterDrop);
|
||||
} else {
|
||||
dropId = sceneMonster.drop_id;
|
||||
}
|
||||
} else {
|
||||
dropId = monster.getMonsterData().getKillDropId();
|
||||
}
|
||||
if (!dropTable.containsKey(dropId)) return false;
|
||||
var dropData = dropTable.get(dropId);
|
||||
List<GameItem> items = new ArrayList<>();
|
||||
processDrop(dropData, 1, items);
|
||||
if (dropData.isFallToGround()) {
|
||||
dropItems(items, ActionReason.MonsterDie, monster, monster.getScene().getPlayers().get(0), true);
|
||||
} else {
|
||||
for (Player p : monster.getScene().getPlayers()) {
|
||||
p.getInventory().addItems(items, ActionReason.MonsterDie);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean handleChestDrop(int chestDropId, int dropCount, GameEntity bornFrom) {
|
||||
if (!dropTable.containsKey(chestDropId)) return false;
|
||||
var dropData = dropTable.get(chestDropId);
|
||||
List<GameItem> items = new ArrayList<>();
|
||||
processDrop(dropData, dropCount, items);
|
||||
if (dropData.isFallToGround()) {
|
||||
dropItems(items, ActionReason.OpenChest, bornFrom, bornFrom.getWorld().getHost(), false);
|
||||
} else {
|
||||
bornFrom.getWorld().getHost().getInventory().addItems(items, ActionReason.OpenChest);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean handleChestDrop(String dropTag, int level, GameEntity bornFrom) {
|
||||
int dropId = queryDropData(dropTag, level, chestReward);
|
||||
if (dropId == 0) return false;
|
||||
return handleChestDrop(dropId, 1, bornFrom);
|
||||
}
|
||||
|
||||
public boolean handleBossChestDrop(String dropTag, Player player) {
|
||||
int dropId = queryDropData(dropTag, bossLevel[player.getWorldLevel()], chestReward);
|
||||
if (!dropTable.containsKey(dropId)) return false;
|
||||
var dropData = dropTable.get(dropId);
|
||||
List<GameItem> items = new ArrayList<>();
|
||||
processDrop(dropData, 1, items);
|
||||
player.getInventory().addItems(items, ActionReason.OpenWorldBossChest);
|
||||
player.sendPacket(new PacketGadgetAutoPickDropInfoNotify(items));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void processDrop(DropTableData dropData, int count, List<GameItem> items) {
|
||||
//TODO:Not clear on the meaning of some fields,like "dropLevel".Will ignore them.
|
||||
//TODO:solve drop limits,like everydayLimit.
|
||||
if (count > 1) {
|
||||
for (int i = 0; i < count; i++) processDrop(dropData, 1, items);
|
||||
return;
|
||||
}
|
||||
if (dropData.getRandomType() == 0) {
|
||||
int weightSum = 0;
|
||||
for (var i : dropData.getDropVec()) {
|
||||
int id = i.getId();
|
||||
if (id == 0) continue;
|
||||
weightSum += i.getWeight();
|
||||
}
|
||||
if (weightSum == 0) return;
|
||||
int weight = rand.nextInt(weightSum);
|
||||
int sum = 0;
|
||||
for (var i : dropData.getDropVec()) {
|
||||
int id = i.getId();
|
||||
if (id == 0) continue;
|
||||
sum += i.getWeight();
|
||||
if (weight < sum) {
|
||||
//win the item
|
||||
int amount = calculateDropAmount(i) * count;
|
||||
if (amount <= 0) break;
|
||||
if (dropTable.containsKey(id)) {
|
||||
processDrop(dropTable.get(id), amount, items);
|
||||
} else {
|
||||
boolean flag = true;
|
||||
for (var j : items) {
|
||||
if (j.getItemId() == id) {
|
||||
j.setCount(j.getCount() + amount);
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) items.add(new GameItem(id, amount));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (dropData.getRandomType() == 1) {
|
||||
for (var i : dropData.getDropVec()) {
|
||||
int id = i.getId();
|
||||
if (id == 0) continue;
|
||||
if (rand.nextInt(10000) < i.getWeight()) {
|
||||
int amount = calculateDropAmount(i) * count;
|
||||
if (amount <= 0) continue;
|
||||
if (dropTable.containsKey(id)) {
|
||||
processDrop(dropTable.get(id), amount, items);
|
||||
} else {
|
||||
boolean flag = true;
|
||||
for (var j : items) {
|
||||
if (j.getItemId() == id) {
|
||||
j.setCount(j.getCount() + amount);
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) items.add(new GameItem(id, amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateDropAmount(DropItemData i) {
|
||||
int amount;
|
||||
if (i.getCountRange().contains(";")) {
|
||||
String[] ranges = i.getCountRange().split(";");
|
||||
amount = rand.nextInt(Integer.parseInt(ranges[0]), Integer.parseInt(ranges[1]) + 1);
|
||||
} else if (i.getCountRange().contains(".")) {
|
||||
double expectAmount = Double.parseDouble(i.getCountRange());
|
||||
amount = (int) expectAmount;
|
||||
if (rand.nextDouble() < expectAmount - amount) amount++;
|
||||
} else {
|
||||
amount = Integer.parseInt(i.getCountRange());
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param share Whether other players in the scene could see the drop items.
|
||||
*/
|
||||
private void dropItem(GameItem item, ActionReason reason, Player player, GameEntity bornFrom, boolean share) {
|
||||
DropMaterialData drop = GameData.getDropMaterialDataMap().get(item.getItemId());
|
||||
if ((drop != null && drop.isAutoPick()) || (item.getItemData().getItemType() == ItemType.ITEM_VIRTUAL && item.getItemData().getGadgetId() == 0)) {
|
||||
giveItem(item, reason, player, share);
|
||||
} else {
|
||||
//TODO:solve share problem
|
||||
player.getScene().addDropEntity(item, bornFrom, player, share);
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItems(List<GameItem> items, ActionReason reason, GameEntity bornFrom, Player player, boolean share) {
|
||||
for (var i : items) {
|
||||
dropItem(i,reason,player,bornFrom,share);
|
||||
}
|
||||
}
|
||||
|
||||
private void giveItem(GameItem item, ActionReason reason, Player player, boolean share) {
|
||||
if (share) {
|
||||
for (var p : player.getScene().getPlayers()) {
|
||||
p.getInventory().addItem(item, reason);
|
||||
p.sendPacket(new PacketDropHintNotify(item.getItemId(), player.getPosition().toProto()));
|
||||
}
|
||||
} else {
|
||||
player.getInventory().addItem(item, reason);
|
||||
player.sendPacket(new PacketDropHintNotify(item.getItemId(), player.getPosition().toProto()));
|
||||
}
|
||||
}
|
||||
|
||||
private void giveItems(List<GameItem> items, ActionReason reason, Player player, boolean share) {
|
||||
//don't know whether we need PacketDropHintNotify.
|
||||
if (share) {
|
||||
for (var p : player.getScene().getPlayers()) {
|
||||
p.getInventory().addItems(items, reason);
|
||||
p.sendPacket(new PacketDropHintNotify(items, player.getPosition().toProto()));
|
||||
}
|
||||
} else {
|
||||
player.getInventory().addItems(items, reason);
|
||||
player.sendPacket(new PacketDropHintNotify(items, player.getPosition().toProto()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
106
src/main/java/emu/grasscutter/game/drop/DropSystemLegacy.java
Normal file
106
src/main/java/emu/grasscutter/game/drop/DropSystemLegacy.java
Normal file
@ -0,0 +1,106 @@
|
||||
package emu.grasscutter.game.drop;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.DataLoader;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.ItemData;
|
||||
import emu.grasscutter.game.entity.EntityItem;
|
||||
import emu.grasscutter.game.entity.EntityMonster;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.inventory.ItemType;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.ActionReason;
|
||||
import emu.grasscutter.game.world.Scene;
|
||||
import emu.grasscutter.server.game.BaseGameSystem;
|
||||
import emu.grasscutter.server.game.GameServer;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DropSystemLegacy extends BaseGameSystem {
|
||||
private final Int2ObjectMap<List<DropData>> dropData;
|
||||
|
||||
public DropSystemLegacy(GameServer server) {
|
||||
super(server);
|
||||
this.dropData = new Int2ObjectOpenHashMap<>();
|
||||
this.load();
|
||||
}
|
||||
|
||||
public Int2ObjectMap<List<DropData>> getDropData() {
|
||||
return dropData;
|
||||
}
|
||||
|
||||
public synchronized void load() {
|
||||
getDropData().clear();
|
||||
try {
|
||||
List<DropInfo> banners = DataLoader.loadList("Drop.json", DropInfo.class);
|
||||
if (banners.size() > 0) {
|
||||
for (DropInfo di : banners) {
|
||||
getDropData().put(di.getMonsterId(), di.getDropDataList());
|
||||
}
|
||||
Grasscutter.getLogger().debug("Drop data successfully loaded.");
|
||||
} else {
|
||||
Grasscutter.getLogger().error("Unable to load drop data. Drop data size is 0.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Unable to load drop data.", e);
|
||||
}
|
||||
}
|
||||
private void addDropEntity(DropData dd, Scene dropScene, ItemData itemData, Position pos, int num, Player target) {
|
||||
if (!dd.isGive() && (itemData.getItemType() != ItemType.ITEM_VIRTUAL || itemData.getGadgetId() != 0)) {
|
||||
EntityItem entity = new EntityItem(dropScene, target, itemData, pos, num, dd.isShare());
|
||||
if (!dd.isShare())
|
||||
dropScene.addEntityToSingleClient(target, entity);
|
||||
else
|
||||
dropScene.addEntity(entity);
|
||||
} else {
|
||||
if (target != null) {
|
||||
target.getInventory().addItem(new GameItem(itemData, num), ActionReason.SubfieldDrop, true);
|
||||
} else {
|
||||
// target is null if items will be added are shared. no one could pick it up because of the combination(give + shared)
|
||||
// so it will be sent to all players' inventories directly.
|
||||
dropScene.getPlayers().forEach(x -> x.getInventory().addItem(new GameItem(itemData, num), ActionReason.SubfieldDrop, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processDrop(DropData dd, EntityMonster em, Player gp) {
|
||||
int target = Utils.randomRange(1, 10000);
|
||||
if (target >= dd.getMinWeight() && target < dd.getMaxWeight()) {
|
||||
ItemData itemData = GameData.getItemDataMap().get(dd.getItemId());
|
||||
int num = Utils.randomRange(dd.getMinCount(), dd.getMaxCount());
|
||||
|
||||
if (itemData == null) {
|
||||
return;
|
||||
}
|
||||
if (itemData.isEquip()) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
float range = (2.5f + (.05f * num));
|
||||
Position pos = em.getPosition().nearby2d(range).addY(3f);
|
||||
addDropEntity(dd, em.getScene(), itemData, pos, num, gp);
|
||||
}
|
||||
} else {
|
||||
Position pos = em.getPosition().clone().addY(3f);
|
||||
addDropEntity(dd, em.getScene(), itemData, pos, num, gp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void callDrop(EntityMonster em) {
|
||||
int id = em.getMonsterData().getId();
|
||||
if (getDropData().containsKey(id)) {
|
||||
for (DropData dd : getDropData().get(id)) {
|
||||
if (dd.isShare())
|
||||
processDrop(dd, em, null);
|
||||
else {
|
||||
for (Player gp : em.getScene().getPlayers()) {
|
||||
processDrop(dd, em, gp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -82,9 +82,9 @@ public class DungeonManager {
|
||||
return LogicType.calculate(passConfigData.getLogicType(), finishedConditions);
|
||||
}
|
||||
|
||||
public int getLevelForMonster(int id) {
|
||||
public int getLevelForMonster(int id, int monsterLevel) {
|
||||
//TODO should use levelConfigMap? and how?
|
||||
return dungeonData.getShowLevel();
|
||||
return Math.max(dungeonData.getShowLevel(), monsterLevel);
|
||||
}
|
||||
|
||||
public boolean activateRespawnPoint(int pointId) {
|
||||
|
@ -22,6 +22,7 @@ import emu.grasscutter.net.proto.SceneEntityAiInfoOuterClass.SceneEntityAiInfo;
|
||||
import emu.grasscutter.net.proto.SceneEntityInfoOuterClass.SceneEntityInfo;
|
||||
import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo;
|
||||
import emu.grasscutter.net.proto.VectorOuterClass.Vector;
|
||||
import emu.grasscutter.server.packet.send.PacketDropHintNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import emu.grasscutter.utils.ProtoHelper;
|
||||
@ -66,6 +67,7 @@ public class EntityItem extends EntityBaseGadget {
|
||||
@Override
|
||||
public void onInteract(Player player, GadgetInteractReq interactReq) {
|
||||
// check drop owner to avoid someone picked up item in others' world
|
||||
//TODO:improve it
|
||||
if (!this.isShare()) {
|
||||
int dropOwner = (int) (this.getGuid() >> 32);
|
||||
if (dropOwner != player.getUid()) {
|
||||
@ -79,6 +81,7 @@ public class EntityItem extends EntityBaseGadget {
|
||||
// Add to inventory
|
||||
boolean success = player.getInventory().addItem(item, ActionReason.SubfieldDrop);
|
||||
if (success) {
|
||||
player.sendPacket(new PacketDropHintNotify(item.getItemId(),getPosition().toProto()));
|
||||
if (!this.isShare()) { // not shared drop
|
||||
player.sendPacket(new PacketGadgetInteractRsp(this, InteractType.INTERACT_TYPE_PICK_ITEM));
|
||||
} else {
|
||||
|
@ -24,6 +24,7 @@ import emu.grasscutter.net.proto.SceneEntityInfoOuterClass.SceneEntityInfo;
|
||||
import emu.grasscutter.net.proto.SceneMonsterInfoOuterClass.SceneMonsterInfo;
|
||||
import emu.grasscutter.net.proto.SceneWeaponInfoOuterClass.SceneWeaponInfo;
|
||||
import emu.grasscutter.scripts.constants.EventType;
|
||||
import emu.grasscutter.scripts.data.SceneMonster;
|
||||
import emu.grasscutter.scripts.data.ScriptArgs;
|
||||
import emu.grasscutter.server.event.entity.EntityDamageEvent;
|
||||
import emu.grasscutter.utils.Position;
|
||||
@ -50,7 +51,7 @@ public class EntityMonster extends GameEntity {
|
||||
@Getter private int weaponEntityId;
|
||||
@Getter @Setter private int poseId;
|
||||
@Getter @Setter private int aiId = -1;
|
||||
|
||||
@Getter @Setter private SceneMonster metaMonster;
|
||||
public EntityMonster(Scene scene, MonsterData monsterData, Position pos, int level) {
|
||||
super(scene);
|
||||
this.id = getWorld().getNextEntityId(EntityIdType.MONSTER);
|
||||
|
@ -1,10 +1,11 @@
|
||||
package emu.grasscutter.game.entity.gadget;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.drop.DropSystem;
|
||||
import emu.grasscutter.game.entity.EntityGadget;
|
||||
import emu.grasscutter.game.entity.gadget.chest.BossChestInteractHandler;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.props.LifeState;
|
||||
import emu.grasscutter.game.props.WatcherTriggerType;
|
||||
import emu.grasscutter.net.proto.BossChestInfoOuterClass.BossChestInfo;
|
||||
import emu.grasscutter.net.proto.GadgetInteractReqOuterClass.GadgetInteractReq;
|
||||
import emu.grasscutter.net.proto.InterOpTypeOuterClass.InterOpType;
|
||||
@ -13,8 +14,9 @@ import emu.grasscutter.net.proto.InteractTypeOuterClass.InteractType;
|
||||
import emu.grasscutter.net.proto.ResinCostTypeOuterClass;
|
||||
import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo;
|
||||
import emu.grasscutter.scripts.constants.ScriptGadgetState;
|
||||
import emu.grasscutter.scripts.data.SceneGadget;
|
||||
import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp;
|
||||
import emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketWorldChestOpenNotify;
|
||||
|
||||
public class GadgetChest extends GadgetContent {
|
||||
|
||||
@ -22,7 +24,54 @@ public class GadgetChest extends GadgetContent {
|
||||
super(gadget);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether we should remove the gadget.
|
||||
*/
|
||||
public boolean onInteract(Player player, GadgetInteractReq req) {
|
||||
//If bigWorldScript enabled,use new drop system.
|
||||
if (Grasscutter.getConfig().server.game.enableScriptInBigWorld) {
|
||||
SceneGadget chest = getGadget().getMetaGadget();
|
||||
DropSystem dropSystem = player.getServer().getDropSystem();
|
||||
if (chest.boss_chest != null && chest.drop_tag != null) {
|
||||
//Boss chest drop
|
||||
//TODO:check for blossom chests
|
||||
if (req.getOpType() == InterOpType.INTER_OP_TYPE_START) {
|
||||
//Two steps
|
||||
player.sendPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_TYPE_OPEN_CHEST, InterOpType.INTER_OP_TYPE_START));
|
||||
return false;
|
||||
}
|
||||
//TODO:check for take_num.(some boss rewards can only be claimed once a week.). Handle boss respawn.
|
||||
//TODO:should return Retcode.RET_RESIN_NOT_ENOUGH ?
|
||||
if (player.getResinManager().useResin(chest.boss_chest.resin) && dropSystem.handleBossChestDrop(chest.drop_tag, player)) {
|
||||
//Is it correct?
|
||||
player.getBattlePassManager().triggerMission(WatcherTriggerType.TRIGGER_WORLD_BOSS_REWARD,chest.boss_chest.monster_config_id,1);
|
||||
getGadget().updateState(ScriptGadgetState.ChestOpened);
|
||||
player.sendPacket(new PacketGadgetInteractRsp(this.getGadget(), InteractTypeOuterClass.InteractType.INTERACT_TYPE_OPEN_CHEST, InterOpType.INTER_OP_TYPE_FINISH));
|
||||
return true;
|
||||
}
|
||||
//if failed,fallback to legacy drop system.
|
||||
} else {
|
||||
//Normal chest drop
|
||||
//only the owner of the world can open chests.
|
||||
if (player != player.getWorld().getHost()) return false;
|
||||
boolean status = false;
|
||||
if (chest.drop_tag != null) {
|
||||
status = dropSystem.handleChestDrop(chest.drop_tag, chest.level, getGadget());
|
||||
} else if (chest.chest_drop_id != 0) {
|
||||
status = dropSystem.handleChestDrop(chest.chest_drop_id, chest.drop_count, getGadget());
|
||||
}
|
||||
if (status) {
|
||||
getGadget().updateState(ScriptGadgetState.ChestOpened);
|
||||
player.sendPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_TYPE_OPEN_CHEST, InterOpType.INTER_OP_TYPE_FINISH));
|
||||
player.sendPacket(new PacketWorldChestOpenNotify(getGadget().getGroupId(), player.getSceneId(), chest.config_id));
|
||||
return true;
|
||||
}
|
||||
//if failed,fallback to legacy drop system.
|
||||
}
|
||||
Grasscutter.getLogger().warn("Can not solve chest drop: chest_drop_id = {} , drop_tag = {}.Fallback to legacy drop system.", chest.chest_drop_id, chest.drop_tag);
|
||||
}
|
||||
|
||||
//Legacy chest drop system
|
||||
var chestInteractHandlerMap = getGadget().getScene().getWorld().getServer().getWorldDataSystem().getChestInteractHandlerMap();
|
||||
var handler = chestInteractHandlerMap.get(getGadget().getGadgetData().getJsonName());
|
||||
if (handler == null) {
|
||||
@ -46,7 +95,7 @@ public class GadgetChest extends GadgetContent {
|
||||
}
|
||||
|
||||
getGadget().updateState(ScriptGadgetState.ChestOpened);
|
||||
player.sendPacket(new PacketGadgetInteractRsp(this.getGadget(), InteractTypeOuterClass.InteractType.INTERACT_TYPE_OPEN_CHEST));
|
||||
player.sendPacket(new PacketGadgetInteractRsp(this.getGadget(), InteractTypeOuterClass.InteractType.INTERACT_TYPE_OPEN_CHEST, InterOpType.INTER_OP_TYPE_FINISH));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
|
||||
if (item.getItemId() == 0) continue;
|
||||
GameItem result = null;
|
||||
try {
|
||||
// putItem might throws exception
|
||||
// putItem might throw exception
|
||||
// ignore that exception and continue
|
||||
result = putItem(item);
|
||||
} catch (Exception e) {
|
||||
@ -158,7 +158,7 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
|
||||
return;
|
||||
}
|
||||
if (reason != null) {
|
||||
getPlayer().sendPacket(new PacketItemAddHintNotify(changedItems, reason));
|
||||
getPlayer().sendPacket(new PacketItemAddHintNotify(items, reason));
|
||||
}
|
||||
getPlayer().sendPacket(new PacketStoreItemChangeNotify(changedItems));
|
||||
}
|
||||
|
@ -13,12 +13,14 @@ import emu.grasscutter.game.dungeons.challenge.WorldChallenge;
|
||||
import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType;
|
||||
import emu.grasscutter.game.entity.*;
|
||||
import emu.grasscutter.game.entity.gadget.GadgetWorktop;
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.game.managers.blossom.BlossomManager;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
import emu.grasscutter.game.player.TeamInfo;
|
||||
import emu.grasscutter.game.props.*;
|
||||
import emu.grasscutter.game.quest.QuestGroupSuite;
|
||||
import emu.grasscutter.game.world.data.TeleportProperties;
|
||||
import emu.grasscutter.game.world.SpawnDataEntry.GridBlockId;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.proto.AttackResultOuterClass.AttackResult;
|
||||
import emu.grasscutter.net.proto.EnterTypeOuterClass;
|
||||
@ -63,6 +65,8 @@ public class Scene {
|
||||
private Set<SpawnDataEntry.GridBlockId> loadedGridBlocks;
|
||||
@Getter @Setter private boolean dontDestroyWhenEmpty;
|
||||
@Getter private final SceneScriptManager scriptManager;
|
||||
|
||||
@Getter @Setter private int autoCloseTime;
|
||||
@Getter @Setter private WorldChallenge challenge;
|
||||
@Getter private List<DungeonSettleListener> dungeonSettleListeners;
|
||||
@Getter @Setter private int prevScene; // Id of the previous scene
|
||||
@ -366,7 +370,10 @@ public class Scene {
|
||||
|
||||
// Reward drop
|
||||
if (target instanceof EntityMonster && this.getSceneType() != SceneType.SCENE_DUNGEON) {
|
||||
getWorld().getServer().getDropSystem().callDrop((EntityMonster) target);
|
||||
if (!getWorld().getServer().getDropSystem().handleMonsterDrop((EntityMonster) target)) {
|
||||
Grasscutter.getLogger().warn("Can not solve monster drop: drop_id = {} , drop_tag = {}.Fallback to legacy drop system.", ((EntityMonster) target).getMetaMonster().drop_id, ((EntityMonster) target).getMetaMonster().drop_tag);
|
||||
getWorld().getServer().getDropSystemLegacy().callDrop((EntityMonster) target);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove entity from world
|
||||
@ -510,8 +517,7 @@ public class Scene {
|
||||
public synchronized void checkSpawns() {
|
||||
Set<SpawnDataEntry.GridBlockId> loadedGridBlocks = new HashSet<>();
|
||||
for (Player player : this.getPlayers()) {
|
||||
for (SpawnDataEntry.GridBlockId block : SpawnDataEntry.GridBlockId.getAdjacentGridBlockIds(player.getSceneId(), player.getPosition()))
|
||||
loadedGridBlocks.add(block);
|
||||
Collections.addAll(loadedGridBlocks, GridBlockId.getAdjacentGridBlockIds(player.getSceneId(), player.getPosition()));
|
||||
}
|
||||
if (this.loadedGridBlocks.containsAll(loadedGridBlocks)) { // Don't recalculate static spawns if nothing has changed
|
||||
return;
|
||||
@ -821,16 +827,34 @@ public class Scene {
|
||||
if (itemData.isEquip()) {
|
||||
float range = (1.5f + (.05f * amount));
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Position pos = bornForm.getPosition().nearby2d(range).addZ(.9f); // Why Z?
|
||||
Position pos = bornForm.getPosition().nearby2d(range).addY(1.5f);
|
||||
EntityItem entity = new EntityItem(this, null, itemData, pos, 1);
|
||||
addEntity(entity);
|
||||
}
|
||||
} else {
|
||||
EntityItem entity = new EntityItem(this, null, itemData, bornForm.getPosition().clone().addZ(.9f), amount); // Why Z?
|
||||
EntityItem entity = new EntityItem(this, null, itemData, bornForm.getPosition().clone().addY(1.5f), amount);
|
||||
addEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void addDropEntity(GameItem item, GameEntity bornForm, Player player, boolean share) {
|
||||
//TODO:optimize EntityItem.java. Maybe we should make other players can't see the ItemEntity.
|
||||
ItemData itemData = GameData.getItemDataMap().get(item.getItemId());
|
||||
if (itemData == null) return;
|
||||
if (itemData.isEquip()) {
|
||||
float range = (1.5f + (.05f * item.getCount()));
|
||||
for (int j = 0; j < item.getCount(); j++) {
|
||||
Position pos = bornForm.getPosition().nearby2d(range).addY(1.5f);
|
||||
EntityItem entity = new EntityItem(this, player, itemData, pos, item.getCount(), share);
|
||||
addEntity(entity);
|
||||
}
|
||||
} else {
|
||||
EntityItem entity = new EntityItem(this, player, itemData, bornForm.getPosition().clone().addY(1.5f), item.getCount(), share);
|
||||
addEntity(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void loadNpcForPlayerEnter(Player player) {
|
||||
this.npcBornEntrySet.addAll(loadNpcForPlayer(player));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class WorldDataSystem extends BaseGameSystem {
|
||||
public Map<String, ChestInteractHandler> getChestInteractHandlerMap() {
|
||||
return chestInteractHandlerMap;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public RewardPreviewData getRewardByBossId(int monsterId) {
|
||||
var investigationMonsterData = GameData.getInvestigationMonsterDataMap().values().parallelStream()
|
||||
.filter(imd -> imd.getMonsterIdList() != null && !imd.getMonsterIdList().isEmpty())
|
||||
@ -80,7 +80,7 @@ public class WorldDataSystem extends BaseGameSystem {
|
||||
WorldLevelData worldLevelData = GameData.getWorldLevelDataMap().get(world.getWorldLevel());
|
||||
|
||||
if (worldLevelData != null) {
|
||||
level = worldLevelData.getMonsterLevel();
|
||||
level = Math.max(level, worldLevelData.getMonsterLevel());
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
@ -1800,7 +1800,7 @@ public class PacketOpcodes {
|
||||
public static final int Unk3000_FIPHHGCJIMO = 23678;
|
||||
public static final int Unk3000_FPDBJJJLKEP = 6103;
|
||||
public static final int Unk3000_GCBMILHPIKA = 4659;
|
||||
public static final int Unk3000_GDMEIKLAMIB = 3295;
|
||||
public static final int WorldChestOpenNotify = 3295;
|
||||
public static final int Unk3000_GMLAHHCDKOI = 841;
|
||||
public static final int Unk3000_GNLFOLGMEPN = 21208;
|
||||
public static final int Unk3000_HBIPKOBMGGD = 5995;
|
||||
|
@ -546,12 +546,12 @@ public class SceneScriptManager {
|
||||
int level = monster.level;
|
||||
|
||||
if (getScene().getDungeonManager() != null) {
|
||||
level = getScene().getDungeonManager().getLevelForMonster(monster.config_id);
|
||||
} else if (getScene().getWorld().getWorldLevel() > 0) {
|
||||
level = getScene().getDungeonManager().getLevelForMonster(monster.config_id, level);
|
||||
} else {
|
||||
WorldLevelData worldLevelData = GameData.getWorldLevelDataMap().get(getScene().getWorld().getWorldLevel());
|
||||
|
||||
if (worldLevelData != null) {
|
||||
level = worldLevelData.getMonsterLevel();
|
||||
level = Math.max(level, worldLevelData.getMonsterLevel());
|
||||
}
|
||||
}
|
||||
|
||||
@ -562,6 +562,7 @@ public class SceneScriptManager {
|
||||
entity.setBlockId(blockId);
|
||||
entity.setConfigId(monster.config_id);
|
||||
entity.setPoseId(monster.pose_id);
|
||||
entity.setMetaMonster(monster);
|
||||
|
||||
this.getScriptMonsterSpawnService()
|
||||
.onMonsterCreatedListener.forEach(action -> action.onNotify(entity));
|
||||
|
@ -6,12 +6,27 @@ import lombok.ToString;
|
||||
@ToString
|
||||
@Setter
|
||||
public class SceneGadget extends SceneObject{
|
||||
public int config_id;
|
||||
public int gadget_id;
|
||||
public int level;
|
||||
public int chest_drop_id;
|
||||
public int drop_count;
|
||||
public String drop_tag;
|
||||
boolean showcutscene;
|
||||
boolean persistence;
|
||||
public int state;
|
||||
|
||||
public int point_type;
|
||||
public int owner;
|
||||
public SceneBossChest boss_chest;
|
||||
public int interact_id;
|
||||
/**
|
||||
* Note: this field indicates whether the gadget should disappear permanently.
|
||||
* For example, if isOneOff=true, like most chests, it will disappear permanently after interacted.
|
||||
* If isOneOff=false, like investigation points, it will disappear temporarily, and appear again in next big world resource refresh routine.
|
||||
*/
|
||||
public boolean isOneoff;
|
||||
public int area_id;
|
||||
public int draft_id;
|
||||
public int route_id;
|
||||
public boolean start_route = true;
|
||||
|
@ -6,8 +6,11 @@ import lombok.ToString;
|
||||
@ToString
|
||||
@Setter
|
||||
public class SceneMonster extends SceneObject{
|
||||
public int monster_id;
|
||||
public int config_id;
|
||||
public int monster_id;
|
||||
public int pose_id;
|
||||
public int level;
|
||||
public int drop_id;
|
||||
public boolean disableWander;
|
||||
public String drop_tag;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import emu.grasscutter.game.chat.ChatSystem;
|
||||
import emu.grasscutter.game.chat.ChatSystemHandler;
|
||||
import emu.grasscutter.game.combine.CombineManger;
|
||||
import emu.grasscutter.game.drop.DropSystem;
|
||||
import emu.grasscutter.game.drop.DropSystemLegacy;
|
||||
import emu.grasscutter.game.dungeons.DungeonSystem;
|
||||
import emu.grasscutter.game.dungeons.challenge.DungeonChallenge;
|
||||
import emu.grasscutter.game.expedition.ExpeditionSystem;
|
||||
@ -28,10 +29,10 @@ import emu.grasscutter.game.world.World;
|
||||
import emu.grasscutter.game.world.WorldDataSystem;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail;
|
||||
import emu.grasscutter.server.event.types.ServerEvent;
|
||||
import emu.grasscutter.server.event.game.ServerTickEvent;
|
||||
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.scheduler.ServerTaskScheduler;
|
||||
import emu.grasscutter.task.TaskMap;
|
||||
import kcp.highway.ChannelConfig;
|
||||
@ -44,7 +45,7 @@ import java.time.OffsetDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.*;
|
||||
import static emu.grasscutter.config.Configuration.GAME_INFO;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
@Getter
|
||||
@ -63,6 +64,7 @@ public final class GameServer extends KcpServer {
|
||||
private final DungeonSystem dungeonSystem;
|
||||
private final ExpeditionSystem expeditionSystem;
|
||||
private final DropSystem dropSystem;
|
||||
private final DropSystemLegacy dropSystemLegacy;
|
||||
private final WorldDataSystem worldDataSystem;
|
||||
private final BattlePassSystem battlePassSystem;
|
||||
private final CombineManger combineSystem;
|
||||
@ -115,6 +117,7 @@ public final class GameServer extends KcpServer {
|
||||
this.multiplayerSystem = new MultiplayerSystem(this);
|
||||
this.dungeonSystem = new DungeonSystem(this);
|
||||
this.dropSystem = new DropSystem(this);
|
||||
this.dropSystemLegacy = new DropSystemLegacy(this);
|
||||
this.expeditionSystem = new ExpeditionSystem(this);
|
||||
this.combineSystem = new CombineManger(this);
|
||||
this.towerSystem = new TowerSystem(this);
|
||||
|
@ -0,0 +1,25 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.game.inventory.GameItem;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.DropHintNotifyOuterClass.DropHintNotify;
|
||||
import emu.grasscutter.net.proto.VectorOuterClass.Vector;
|
||||
|
||||
public class PacketDropHintNotify extends BasePacket {
|
||||
public PacketDropHintNotify(int itemId, Vector position) {
|
||||
super(PacketOpcodes.DropHintNotify);
|
||||
var proto = DropHintNotify.newBuilder()
|
||||
.addItemIdList(itemId)
|
||||
.setPosition(position);
|
||||
setData(proto.build());
|
||||
}
|
||||
|
||||
public PacketDropHintNotify(Iterable<GameItem> items, Vector position) {
|
||||
super(PacketOpcodes.DropHintNotify);
|
||||
var proto = DropHintNotify.newBuilder();
|
||||
items.forEach(i -> proto.addItemIdList(i.getItemId()));
|
||||
proto.setPosition(position);
|
||||
setData(proto.build());
|
||||
}
|
||||
}
|
@ -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.WorldChestOpenNotifyOuterClass.WorldChestOpenNotify;
|
||||
|
||||
public class PacketWorldChestOpenNotify extends BasePacket {
|
||||
public PacketWorldChestOpenNotify(int groupId,int sceneId,int configId){
|
||||
super(PacketOpcodes.WorldChestOpenNotify);
|
||||
WorldChestOpenNotify proto= WorldChestOpenNotify.newBuilder()
|
||||
.setGroupId(groupId)
|
||||
.setSceneId(sceneId)
|
||||
.setConfigId(configId)
|
||||
.build();
|
||||
setData(proto);
|
||||
}
|
||||
}
|
@ -8,7 +8,10 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -129,7 +132,9 @@ public final class FileUtils {
|
||||
}
|
||||
|
||||
public static Path getExcelPath(String filename) {
|
||||
return getTsjJsonTsv(RESOURCES_PATH.resolve("ExcelBinOutput"), filename);
|
||||
Path p = getTsjJsonTsv(RESOURCES_PATH.resolve("Server"), filename);
|
||||
if (Files.exists(p)) return p;
|
||||
else return getTsjJsonTsv(RESOURCES_PATH.resolve("ExcelBinOutput"), filename);
|
||||
}
|
||||
|
||||
// Gets path of a resource.
|
||||
|
9170
src/main/resources/defaults/data/ChestDrop.json
Normal file
9170
src/main/resources/defaults/data/ChestDrop.json
Normal file
File diff suppressed because it is too large
Load Diff
6902
src/main/resources/defaults/data/MonsterDrop.json
Normal file
6902
src/main/resources/defaults/data/MonsterDrop.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user