Skip to content

Commit

Permalink
Feature + Fix: Added new chat filters, Fixed: Healer Orb Pickup (hann…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikecraft1224 authored May 26, 2024
1 parent 80c414d commit e78e440
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ public class FilterTypesConfig {
@FeatureToggle
public boolean factoryUpgrade = false;

@Expose
@ConfigOption(name = "Sacrifice", desc = "Hide sacrifice messages of other players.")
@ConfigEditorBoolean
@FeatureToggle
public boolean sacrifice = false;


//TODO remove
@Expose
@ConfigOption(name = "Others", desc = "Hide other annoying messages.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class MessageFilterConfig {
@Expose
@ConfigOption(name = "Rare Drops", desc = "Hides the chat message when other players get rare drops from chests.")
@ConfigEditorBoolean
@FeatureToggle
public boolean rareDrops = false;

@Expose
@ConfigOption(name = "Keys and Doors", desc = "Hides the chat message when picking up keys or opening doors in Dungeons.")
@ConfigEditorBoolean
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ class ChatFilter {
"§7You will now produce §r§6.* Chocolate §r§7per click!".toPattern(),
"§7You upgraded to §r§d.*?§r§7!".toPattern(),
)
/**
* REGEX-TEST: §c§lSACRIFICE! §r§6[MVP§r§d++§r§6] Mikecraft1224§r§f §r§eturned §r§6Young Dragon Boots §r§einto §r§d40 Dragon Essence§r§e!
* REGEX-TEST: §c§lBONUS LOOT! §r§eThey also received §r§5Ritual Residue §r§efrom their sacrifice!
*/
private val sacrificePatterns = listOf(
"§c§lSACRIFICE! (.*) §r§eturned (.*) §r§einto (.*) Dragon Essence§r§e!".toPattern(),
"§c§lBONUS LOOT! §r§eThey also received (.*) §r§efrom their sacrifice!".toPattern()
)
private val powderMiningMessages = listOf(
"§aYou uncovered a treasure chest!",
"§aYou received §r§f1 §r§aWishing Compass§r§a.",
Expand All @@ -372,6 +380,13 @@ class ChatFilter {
"▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬",
)

/**
* REGEX-TEST: §6§lRARE REWARD! §r§bLeebys §r§efound a §r§6Recombobulator 3000 §r§ein their Obsidian Chest§r§e!
*/
private val rareDropsMessages = listOf(
"§6§lRARE REWARD! (.*) §r§efound a (.*) §r§ein their (.*) Chest§r§e!".toPattern()
)

// &r&6Your &r&aMage &r&6stats are doubled because you are the only player using this class!&r
private val soloClassPatterns = listOf(
"§6Your §r§a(Healer|Mage|Berserk|Archer|Tank) §r§6stats are doubled because you are the only player using this class!".toPattern()
Expand Down Expand Up @@ -405,6 +420,8 @@ class ChatFilter {
"fire_sale" to fireSalePatterns,
"event" to eventPatterns,
"factory_upgrade" to factoryUpgradePatterns,
"sacrifice" to sacrificePatterns,
"rare_drops" to rareDropsMessages,
"solo_class" to soloClassPatterns,
"solo_stats" to soloStatsPatterns,
"fairy" to fairyPatterns,
Expand Down Expand Up @@ -465,8 +482,10 @@ class ChatFilter {
config.eventLevelUp && (message.isPresent("event") || StringUtils.isEmpty(message)) -> "event"
config.fireSale && (fireSalePattern.matches(message) || message.isPresent("fire_sale")) -> "fire_sale"
config.factoryUpgrade && message.isPresent("factory_upgrade") -> "factory_upgrade"
config.sacrifice && message.isPresent("sacrifice") -> "sacrifice"
generalConfig.hideJacob && !GardenAPI.inGarden() && anitaFortunePattern.matches(message) -> "jacob_event"
generalConfig.hideSkyMall && !LorenzUtils.inMiningIsland() && skymallPerkPattern.matches(message) -> "skymall"
dungeonConfig.rareDrops && message.isPresent("rare_drops") -> "rare_drops"
dungeonConfig.soloClass && DungeonAPI.inDungeon() && message.isPresent("solo_class") -> "solo_class"
dungeonConfig.soloStats && DungeonAPI.inDungeon() && message.isPresent("solo_stats") -> "solo_stats"
dungeonConfig.fairy && DungeonAPI.inDungeon() && message.isPresent("fairy") -> "fairy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ class DungeonChatFilter {
"§d(.*) the Fairy§r§f: You killed me! I'll revive you so that my death is not in vain!".toPattern(),
"§d(.*) the Fairy§r§f: You killed me! I'll revive your friend §r(.*) §r§fso that my death is not in vain!".toPattern(),
"§d(.*) the Fairy§r§f: Have a great life!".toPattern(),
"§c(.*) §r§eYou picked up a Ability Damage Orb from (.*) §r§ehealing you for §r§c(.*) §r§eand granting you +§r§c(.*)% §r§eAbility Damage for §r§b10 §r§eseconds.".toPattern(),
"§c(.*) §r§eYou picked up a Damage Orb from (.*) §r§ehealing you for §r§c(.*) §r§eand granting you +§r§c(.*)% §r§eDamage for §r§b10 §r§eseconds.".toPattern(),
"§c(.*) §r§eYou picked up a (.*) Orb from (.*) §r§ehealing you for §r§c(.*) §r§eand granting you +(.*)% §r§e(.*) for §r§b10 §r§eseconds.".toPattern(),
"(.*) §r§ehas obtained §r§a§r§9Premium Flesh§r§e!".toPattern(),
"§6§lRARE DROP! §r§9Beating Heart §r§b(.*)".toPattern(),
"(.*) §r§ehas obtained §r§a§r§9Beating Heart§r§e!".toPattern()
Expand Down

0 comments on commit e78e440

Please sign in to comment.