Skip to content

Commit

Permalink
Corpse Finder (#960)
Browse files Browse the repository at this point in the history
* early one. Needs polishing and config

* 2nd wave of changes

* a little refactor to parsing. New version is yet to be tested

* another little patch to solve some silly issues

* Fixed bug when some of corpses weren't highlighted. Also rebased

* a little refactor to parsing. New version is yet to be tested

* dementia

* moved few code blocks around

* Remove unused constructor

* Simplify and reformat getColor method

* Fix typo in log messager

* Change the way the argument values are obtained and fix formatting

* Extract coords pattern into a PSF variable

* More formatting

* Oops forgot to remove + fix typo

* Clear corpses on world change

* Rebased for 1.21.3

* Tweak chat message slightly

* Inline LOCATION variable as it was hard to read

* Bunch of stuff

- Changed sent position format to match what we're reading
- Extracted item id strings to PSF variables and then made a bimap between them and the corpse type that uses them.
- Changed debug message to be printed in chat rather than logs to be more easily seen
- Simplified and/or reformatted a bunch of code
- Changed log level of some messages to `debug`

* Add a debug config for corpse finder and have it toggled off by default

* Fix regex and change sent message format

This should allow skyhanni users to be able to parse the messages sent by skyblocker users since their regex starts matching from the start of the message content (so after any prefixes, player names)

The regex change was also because of this. We use .find so the regex doesn't have to match the whole message body.

* Refactor some if checks

* Add auto location sharing, off by default

* Corrected format and ignore player's own messages

* Oops one too many inversed

* Change CorpseTypeArgumentType to use StringIdentifiable and format Waypoint constructors

* Migrate to CorpseType enum

* Update getting enum

* Wrap int parsing in try catch for possibly malformed inputs

* Don't allow negative y values

* Add a locale to toUpperCase

* Fix rebase artifacts

* Add seen waypoint todo

---------

Co-authored-by: Rime <[email protected]>
Co-authored-by: Kevinthegreat <[email protected]>
  • Loading branch information
3 people authored Jan 5, 2025
1 parent 180408f commit 6d8592c
Show file tree
Hide file tree
Showing 11 changed files with 382 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.debug.dumpFormat = newValue)
.controller(opt -> EnumControllerBuilder.create(opt).enumClass(Debug.DumpFormat.class)) // ConfigUtils::createEnumCyclingListController causes a NPE for some reason
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.debug.corpseFinderDebug"))
.binding(defaults.debug.corpseFinderDebug,
() -> config.debug.corpseFinderDebug,
newValue -> config.debug.corpseFinderDebug = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,36 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.collapsed(false)
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.mining.glacite.coldOverlay"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.glacite.coldOverlay@Tooltip")))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.glacite.coldOverlay.@Tooltip")))
.binding(defaults.mining.glacite.coldOverlay,
() -> config.mining.glacite.coldOverlay,
newValue -> config.mining.glacite.coldOverlay = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.mining.glacite.enableCorpseFinder"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.glacite.enableCorpseFinder.@Tooltip")))
.binding(defaults.mining.glacite.enableCorpseFinder,
() -> config.mining.glacite.enableCorpseFinder,
newValue -> config.mining.glacite.enableCorpseFinder = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.mining.glacite.enableParsingChatCorpseFinder"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.glacite.enableParsingChatCorpseFinder.@Tooltip")))
.binding(defaults.mining.glacite.enableParsingChatCorpseFinder,
() -> config.mining.glacite.enableParsingChatCorpseFinder,
newValue -> config.mining.glacite.enableParsingChatCorpseFinder = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.mining.glacite.autoShareCorpses"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.glacite.autoShareCorpses.@Tooltip")))
.binding(defaults.mining.glacite.autoShareCorpses,
() -> config.mining.glacite.autoShareCorpses,
newValue -> config.mining.glacite.autoShareCorpses = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ public class DebugConfig {

@SerialEntry
public boolean webSocketDebug = false;

@SerialEntry
public boolean corpseFinderDebug = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ public String toString() {
public static class Glacite {
@SerialEntry
public boolean coldOverlay = true;

@SerialEntry
public boolean enableCorpseFinder = true;

@SerialEntry
public boolean enableParsingChatCorpseFinder = true;

@SerialEntry
public boolean autoShareCorpses = false;
}

public enum DwarvenHudStyle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.skyblock.dungeon.DungeonScore;
import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonManager;
import de.hysky.skyblocker.skyblock.dwarven.CorpseFinder;
import de.hysky.skyblocker.skyblock.dwarven.CrystalsChestHighlighter;
import de.hysky.skyblocker.skyblock.dwarven.WishingCompassSolver;
import de.hysky.skyblocker.skyblock.end.EnderNodes;
Expand Down Expand Up @@ -57,6 +58,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
if (SkyblockerConfigManager.get().slayers.blazeSlayer.firePillarCountdown != SlayersConfig.BlazeSlayer.FirePillar.OFF) FirePillarAnnouncer.checkFirePillar(entity);

EggFinder.checkIfEgg(armorStandEntity);
CorpseFinder.checkIfCorpse(armorStandEntity);
try { //Prevent packet handling fails if something goes wrong so that entity trackers still update, just without compact damage numbers
CompactDamage.compactDamage(armorStandEntity);
} catch (Exception e) {
Expand Down Expand Up @@ -94,6 +96,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
@Inject(method = "onEntityEquipmentUpdate", at = @At(value = "TAIL"))
private void skyblocker$onEntityEquip(EntityEquipmentUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
EggFinder.checkIfEgg(entity);
CorpseFinder.checkIfCorpse(entity);
}

@Inject(method = "onPlayerListHeader", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setFooter(Lnet/minecraft/text/Text;)V"))
Expand Down
Loading

0 comments on commit 6d8592c

Please sign in to comment.