Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Hide solo class, solo class stats and fairy dialogue messages #1702

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,22 @@ public class MessageFilterConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean keysAndDoors = false;

@Expose
@ConfigOption(name = "Solo Class", desc = "Hide the message that sends when you play a class alone.")
@ConfigEditorBoolean
@FeatureToggle
public boolean soloClass = false;

@Expose
@ConfigOption(name = "Solo Class Stats", desc = "Hide the boosted class stats when starting a dungeon.")
@ConfigEditorBoolean
@FeatureToggle
public boolean soloStats = false;

@Expose
@ConfigOption(name= "Fairy Dialogue" , desc = "Hide the dialogue when a fairy is killed.")
@ConfigEditorBoolean
@FeatureToggle
public boolean fairy = false;
}
24 changes: 24 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 @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.chat
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils
Expand All @@ -15,6 +16,7 @@ class ChatFilter {

private val generalConfig get() = SkyHanniMod.feature.chat
private val config get() = SkyHanniMod.feature.chat.filterType
private val dungeonConfig get() = SkyHanniMod.feature.dungeon.messageFilter

/// <editor-fold desc="Regex Patterns & Messages">
// Lobby Messages
Expand Down Expand Up @@ -369,6 +371,22 @@ class ChatFilter {
"▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬",
)

// &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()
)

private val soloStatsPatterns = listOf(
"§a\\[(Healer|Mage|Berserk|Archer|Tank)].*".toPattern()
)

// &r&dGenevieve the Fairy&r&f: You killed me! Take this &r&6Revive Stone &r&fso that my death is not in vain!&r
private val fairyPatterns = listOf(
"§d[\\w']+ the Fairy§r§f: You killed me! Take this §r§6Revive Stone §r§fso that my death is not in vain!".toPattern(),
"§d[\\w']+ the Fairy§r§f: You killed me! I'll revive you so that my death is not in vain!".toPattern(),
"§d[\\w']+ the Fairy§r§f: Have a great life!".toPattern()
)

private val patternsMap: Map<String, List<Pattern>> = mapOf(
"lobby" to lobbyPatterns,
"warping" to warpingPatterns,
Expand All @@ -386,6 +404,9 @@ class ChatFilter {
"fire_sale" to fireSalePatterns,
"event" to eventPatterns,
"factory_upgrade" to factoryUpgradePatterns,
"solo_class" to soloClassPatterns,
"solo_stats" to soloStatsPatterns,
"fairy" to fairyPatterns,
)

private val messagesMap: Map<String, List<String>> = mapOf(
Expand Down Expand Up @@ -445,6 +466,9 @@ class ChatFilter {
config.factoryUpgrade && message.isPresent("factory_upgrade") -> "factory_upgrade"
generalConfig.hideJacob && !GardenAPI.inGarden() && anitaFortunePattern.matches(message) -> "jacob_event"
generalConfig.hideSkyMall && !LorenzUtils.inMiningIsland() && skymallPerkPattern.matches(message) -> "skymall"
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"

else -> ""
}
Expand Down
Loading