Skip to content

Commit

Permalink
5.9.36
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertSkalko committed Dec 22, 2024
1 parent b1971ac commit 1819cb9
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 163 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ v.5.9.36
- downgrade map now has a cooldown of 5 minutes
- starting a new map also has a cooldown of 3 minutes
These cooldowns are to stop the abuse of generating tons of maps to search for best layouts.
They shouldn't really impact genuine play
They shouldn't really impact genuine play
- tweaked some tooltips
- redid code for finding random map spot within worldborders, should hopefully utilize the full dimension border now
- you should no longer see old maps when you start new maps (this requires a map dimension wipe, just delete the dimensions/mmorpg/dungeon folder)
2 changes: 1 addition & 1 deletion docs/mechanics/rested_exp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ If you say have 200 rested exp, that means while you gain exp in the future, you
# How Do I get Rested Exp?

You can currently get it in 1 way only:
- Doing Professions like mining or gear crafting etc will give you Rested Compat Exp, which then makes you gain bonus exp when you kill mobs
- Doing Professions like mining or gear crafting etc will give you Rested Combat Exp, which then makes you gain bonus exp when you kill mobs
- Killing mobs gives you rested Profession Exp, which will give you bonus exp when you later do professions

It purely exists to reward doing professions while leveling!
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx2G
# --- COMMON GRADLE START ---
# Mod Properties
mod_version=5.9.35
mod_version=5.9.36
# Minecraft Versions
minecraft_version=1.20.1
forgeversion=47.1.43
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.robertx22.mine_and_slash.itemstack.StackKeys;
import com.robertx22.mine_and_slash.saveclasses.gearitem.gear_parts.AffixData;
import com.robertx22.mine_and_slash.uncommon.localization.Words;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;

public class RerollAffixItemMod extends GearModification {
Expand Down Expand Up @@ -60,15 +59,17 @@ public OutcomeType getOutcomeType() {

@Override
public MutableComponent getDescWithParams() {
Component rar = Words.RANDOM_RARITY.locName();
MutableComponent rar = Words.RANDOM_RARITY.locName();
if (ExileDB.GearRarities().isRegistered(data.result_rar)) {
rar = ExileDB.GearRarities().get(data.result_rar).coloredName();
}
rar.append(" ").append(Words.AFFIX.locName());

return this.getDescParams(data.finder_data.finder().getTooltip(data.finder_data), rar);
}

@Override
public String locDescForLangFile() {
return "Rerolls %1$s into %2$s";
return "Rerolls %1$s into a new %2$s";
}
}
16 changes: 9 additions & 7 deletions src/main/java/com/robertx22/mine_and_slash/maps/MapData.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public void reduceLives(Player p) {

public static MapData newMap(Player p, MapItemData map, MapsData maps) {


Load.player(p).prophecy.affixesTaken.clear();

maps.deleteOldMap(p);
Expand All @@ -88,6 +87,7 @@ public static MapData newMap(Player p, MapItemData map, MapsData maps) {

data.leagues.setupOnMapStart(map, p);

maps.addToList(cp);

return data;

Expand Down Expand Up @@ -142,19 +142,21 @@ public static BlockPos getDungeonStartTeleportPos(ChunkPos pos) {

private ChunkPos randomFree(Level level, MapsData maps) {

int MAXTRIES = 300;

ChunkPos pos = null;

int tries = 0;

// seems this is how you get the level
WorldBorder border = level.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, WorldUtils.DUNGEON_DIM_ID)).getWorldBorder();

int max = (int) (border.getMaxX() / 16 / 2);
int max = (int) (border.getMaxX() / 16);

max = MathHelper.clamp(max, 0, 299999 / 2); // don't be higher than normal mc border
max = MathHelper.clamp(max, 0, Integer.MAX_VALUE);

while (pos == null || maps.getMap(pos).isPresent() || !border.isWithinBounds(pos)) {
if (tries++ > 200) {
while (pos == null || maps.startExistsAlready(pos) || !border.isWithinBounds(pos)) {
if (tries++ > MAXTRIES) {
ExileLog.get().warn("Tried too many times to find random dungeon pos and failed, please delete the map dimension folder");
return null;
}
Expand All @@ -166,8 +168,8 @@ private ChunkPos randomFree(Level level, MapsData maps) {

}

if (tries > 1000) {
ExileLog.get().warn("It took more than 1000 tries to find random free dungeon, either you are insanely unlucky, or the world is close to filled! Dungeon worlds are cleared on next server boot if they reach too close to capacity.");
if (tries > MAXTRIES) {
ExileLog.get().warn("It took more than " + MAXTRIES + " tries to find random free dungeon, either you are insanely unlucky, or the world is close to filled! Dungeon worlds are cleared on next server boot if they reach too close to capacity.");
}

return pos;
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/com/robertx22/mine_and_slash/maps/MapsData.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
import net.minecraft.world.level.ChunkPos;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;

public class MapsData {


private List<MapData> maps = new ArrayList<>();

private HashMap<String, Boolean> oldMaps = new HashMap<>();

public void deleteOldMap(Player p) {
maps.removeIf(x -> x.playerUuid.equals(p.getStringUUID()));
}
Expand All @@ -23,6 +25,16 @@ public Optional<MapData> getCurrentMap(Player player) {
return maps.stream().filter(x -> x.playerUuid.equals(player.getStringUUID())).findFirst();
}

public void addToList(ChunkPos cp) {
var key = cp.x + "_" + cp.z;
oldMaps.put(key, true);
}

public Boolean startExistsAlready(ChunkPos cp) {
var key = cp.x + "_" + cp.z;
return oldMaps.getOrDefault(key, false);
}

public Optional<MapData> getMap(BlockPos pos) {
return maps.stream().filter(x -> x.isMapHere(pos)).findFirst();
}
Expand All @@ -44,10 +56,10 @@ public MapData startNewMap(Player player, MapItemData data) {

Load.player(player).map.clearMapAfterUpgrading();


if (!data.isUber()) {
Load.player(player).map.map = data;
}
Load.Unit(player).getCooldowns().setOnCooldown("start_map", 20 * 60 * 3);

return m;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public enum Words implements IAutoLocName {
OPTION_LOCKED_UNTIL_BOSS_KILLED("Option Locked Until Map Boss is Killed."),
MAP_IS_ALREADY_MAX_RARITY("Map is already at Maximum Rarity."),
NO_MAP_TO_UPGRADE("You don't have any map currently."),
MAP_DOWNGRADE_COOLDOWN("Map Downgrade option is on cooldown for 1$s seconds"),
MAP_START_COOLDOWN("You can not start new maps for 1$s seconds"),
MAP_DOWNGRADE_COOLDOWN("Map Downgrade option is on cooldown for %1$s seconds"),
MAP_START_COOLDOWN("You can not start new maps for %1$s seconds"),

UPGRADE_MAP("Upgrade Map Rarity"),
DOWNGRADE_MAP("Downgrade Map Rarity"),
Expand Down Expand Up @@ -48,6 +48,7 @@ public enum Words implements IAutoLocName {

RANDOM_AFFIX("Random Affix"),
RANDOM_RARITY("Random Rarity"),
AFFIX("Affix"),
SPECIFIC_RARITY_AFFIX("%1$s Affix"),
LOWEST_RARITY_AFFIX("Lowest Rarity Affix"),

Expand Down
Loading

0 comments on commit 1819cb9

Please sign in to comment.