-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathConfig.java
More file actions
165 lines (141 loc) · 5.9 KB
/
Config.java
File metadata and controls
165 lines (141 loc) · 5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package net.dungeon_difficulty.config;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Random;
public class Config {
public Meta meta = new Meta();
public static class Meta { public Meta() { }
public boolean sanitize_config = true;
public Double rounding_unit = 0.5;
public boolean merge_item_modifiers = true;
}
public Announcement announcement = new Announcement();
public static class Announcement { public Announcement() { }
public boolean enabled = true;
public int check_interval_seconds = 5;
public int history_size = 2;
}
public PerPlayerDifficulty per_player_difficulty;
public static class PerPlayerDifficulty { public PerPlayerDifficulty() { }
public boolean enabled = true;
public enum Counting { EVERYWHERE, DIMENSION }
public Counting counting = Counting.EVERYWHERE;
public int cap = 10;
public List<EntityModifier> entities = List.of();
}
public List<DifficultyType> difficulty_types = List.of();
public static class DifficultyType { public DifficultyType() { }
public String name;
public String parent;
@Nullable public String translation_code;
@Nullable public Boolean allow_loot_scaling;
public List<EntityModifier> entities = List.of();
public DifficultyType(String name) {
this.name = name;
}
}
public Rewards loot_scaling = new Rewards();
public static class Rewards { public Rewards() { }
public List<ItemModifier> armor = List.of();
public List<ItemModifier> weapons = List.of();
public static class SmithingUpgrade { public SmithingUpgrade() { }
public boolean enabled = true;
public int add_upon_upgrade = 0;
public float multiply_upon_upgrade = 1;
}
public SmithingUpgrade smithing_upgrade = new SmithingUpgrade();
}
public static class DifficultyReference { public DifficultyReference() { }
public String name;
public int level = 0;
@Nullable public Integer entity_level;
@Nullable public Integer reward_level;
public DifficultyReference(String name, int level) {
this.name = name;
this.level = level;
}
}
public Dimension[] dimensions;
public static class Dimension { public Dimension() { }
public static class Filters {
// Universal pattern matching against dimension ID
public String dimension;
}
public Filters world_matches = new Filters();
public DifficultyReference difficulty;
public List<Zone> zones = List.of();
public List<Zone.TypeOverride> zone_specifiers = List.of();
public List<EntityMatcher> entities = List.of();
}
public static class Zone { public Zone() { }
public static class Filters { public Filters() { }
// Universal pattern matching against biome ID
@Nullable public String biome = null;
// Universal pattern matching against structure ID
@Nullable public String structure = null;
}
public Filters zone_matches = new Filters();
public DifficultyReference difficulty;
public static class TypeOverride { public TypeOverride() { }
public Filters zone_matches = new Filters();
public String difficulty_name;
}
}
public static class EntityMatcher { public EntityMatcher() { }
public String entity_type = null;
public String loot_table = null;
public DifficultyReference difficulty;
}
public enum Operation { ADDITION, MULTIPLY_BASE }
public static class EntityModifier { public EntityModifier() { }
public static class Filters {
public enum Attitude {
FRIENDLY, HOSTILE, ANY
}
@Nullable public Attitude attitude = Attitude.ANY;
// Universal pattern matching against entity type ID
@Nullable public String type = "";
}
@Nullable public Filters entity_matches = new Filters();
@Nullable public SpawnerModifier spawners = null;
public List<AttributeModifier> attributes = List.of();
public float experience_multiplier = 0;
}
public static class ItemModifier { public ItemModifier() { }
public static class Filters {
// Universal pattern matching against item ID
@Nullable public String id = "";
@Nullable public String loot_table_regex = "";
@Nullable public String rarity_regex = "";
}
@Nullable public Filters item_matches = new Filters();
public List<AttributeModifier> attributes = List.of();
}
public static class AttributeModifier { public AttributeModifier() { }
public String attribute;
public Operation operation = Operation.MULTIPLY_BASE;
public float randomness = 0;
public float value = 0;
public float offset = 0;
public AttributeModifier(String attribute, float value) {
this.attribute = attribute;
this.value = value;
}
private static Random rng = new Random();
public float randomizedValue(int level) {
var value = this.value * level;
var randomizedValue = (randomness > 0)
? rng.nextFloat(value - randomness, value + randomness)
: value;
return this.offset + randomizedValue;
}
}
public static class SpawnerModifier { public SpawnerModifier() { }
public float spawn_range_multiplier = 0;
public float spawn_count_multiplier = 0;
public float max_nearby_entities_multiplier = 0;
public float min_spawn_delay_multiplier = 0;
public float max_spawn_delay_multiplier = 0;
public float required_player_range_multiplier = 0;
}
}