From a5c540d977a3510812cac7fac340fe17e7d10983 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Thu, 14 Jul 2022 12:06:07 +0200 Subject: renamed mod to SkyHanni --- .../at/lorenz/mod/dungeon/DungeonBossMessages.kt | 51 --- .../at/lorenz/mod/dungeon/DungeonChatFilter.kt | 224 ------------ .../java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt | 130 ------- src/main/java/at/lorenz/mod/dungeon/DungeonData.kt | 46 --- .../at/lorenz/mod/dungeon/DungeonDeathCounter.kt | 97 ------ .../mod/dungeon/DungeonHighlightClickedBlocks.kt | 99 ------ .../lorenz/mod/dungeon/DungeonMilestoneDisplay.kt | 97 ------ .../damageindicator/DungeonBossDamageIndicator.kt | 181 ---------- .../dungeon/damageindicator/DungeonBossFinder.kt | 382 --------------------- .../mod/dungeon/damageindicator/EntityData.kt | 6 - .../mod/dungeon/damageindicator/EntityResult.kt | 3 - 11 files changed, 1316 deletions(-) delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonData.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonDeathCounter.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/DungeonMilestoneDisplay.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityData.kt delete mode 100644 src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityResult.kt (limited to 'src/main/java/at/lorenz/mod/dungeon') diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt deleted file mode 100644 index 43c66e59c..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt +++ /dev/null @@ -1,51 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.LorenzMod -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.utils.LorenzUtils -import at.lorenz.mod.utils.LorenzUtils.matchRegex -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class DungeonBossMessages { - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return - - if (!LorenzMod.feature.chat.dungeonBossMessages) return - - if (isBoss(event.message)) { - event.blockedReason = "dungeon_boss" - } - } - - private fun isBoss(message: String): Boolean { - when { - message.matchRegex("§([cd4])\\[BOSS] (.*)") -> { - when { - message.contains(" The Watcher§r§f: ") -> return true - message.contains(" Bonzo§r§f: ") -> return true - message.contains(" Scarf§r§f:") -> return true - message.contains("Professor§r§f") -> return true - message.contains(" Livid§r§f: ") || message.contains(" Enderman§r§f: ") -> return true - message.contains(" Thorn§r§f: ") -> return true - message.contains(" Sadan§r§f: ") -> return true - message.contains(" Maxor§r§c: ") -> return true - message.contains(" Storm§r§c: ") -> return true - message.contains(" Goldor§r§c: ") -> return true - message.contains(" Necron§r§c: ") -> return true - message.contains(" §r§4§kWither King§r§c:") -> return true - - message.endsWith(" Necron§r§c: That is enough, fool!") -> return true - message.endsWith(" Necron§r§c: Adventurers! Be careful of who you are messing with..") -> return true - message.endsWith(" Necron§r§c: Before I have to deal with you myself.") -> return true - } - } - - //M7 - Dragons - message == "§cThe Crystal withers your soul as you hold it in your hands!" -> return true - message == "§cIt doesn't seem like that is supposed to go there." -> return true - } - return false - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt deleted file mode 100644 index 65a187816..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt +++ /dev/null @@ -1,224 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.utils.LorenzUtils.matchRegex -import at.lorenz.mod.LorenzMod -import at.lorenz.mod.utils.LorenzUtils -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class DungeonChatFilter { - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inSkyblock) return - - if (!LorenzMod.feature.chat.dungeonMessages) return - - val blockReason = block(event.message) - if (blockReason != "") { - event.blockedReason = "dungeon_$blockReason" - } - } - - private fun block(message: String): String { - when { - isPrepare(message) -> return "prepare" - isStart(message) -> return "start" - } - - if (!LorenzUtils.inDungeons) return "" - - return when { - isKey(message) -> "key" - isDoor(message) -> "door" - isPickup(message) -> "pickup" - isReminder(message) -> "reminder" - isBuff(message) -> "buff" - isNotPossible(message) -> "not_possible" - isDamage(message) -> "damage" - isAbility(message) -> "ability" - isPuzzle(message) -> "puzzle" - isEnd(message) -> "end" - - else -> "" - } - } - - private fun isDoor(message: String): Boolean = message == "§cThe §r§c§lBLOOD DOOR§r§c has been opened!" - - private fun isEnd(message: String): Boolean = when { - message.matchRegex("(.*) §r§eunlocked §r§d(.*) Essence §r§8x(.*)§r§e!") -> true - message.matchRegex(" §r§d(.*) Essence §r§8x(.*)") -> true - message.endsWith(" Experience §r§b(Team Bonus)") -> true - else -> false - } - - private fun isAbility(message: String): Boolean = when { - message == "§a§r§6Guided Sheep §r§ais now available!" -> true - message.matchRegex("§7Your Guided Sheep hit §r§c(.*) §r§7enemy for §r§c(.*) §r§7damage.") -> true - message == "§6Rapid Fire§r§a is ready to use! Press §r§6§lDROP§r§a to activate it!" -> true - message == "§6Castle of Stone§r§a is ready to use! Press §r§6§lDROP§r§a to activate it!" -> true - - - message.matchRegex("§a§lBUFF! §fYou were splashed by (.*) §fwith §r§cHealing VIII§r§f!") -> true - message.matchRegex("§aYou were healed for (.*) health by (.*)§a!") -> true - message.matchRegex("§aYou gained (.*) HP worth of absorption for 3s from §r(.*)§r§a!") -> true - message.matchRegex("§c(.*) §r§epicked up your (.*) Orb!") -> true - message.matchRegex("§cThis ability is on cooldown for (.*)s.") -> true - message.matchRegex("§a§l(.*) healed you for (.*) health!") -> true - message.matchRegex("§eYour bone plating reduced the damage you took by §r§c(.*)§r§e!") -> true - message.matchRegex("(.*) §r§eformed a tether with you!") -> true - message.matchRegex("§eYour tether with (.*) §r§ehealed you for §r§a(.*) §r§ehealth.") -> true - message.matchRegex("§7Your Implosion hit §r§c(.*) §r§7enemy for §r§c(.*) §r§7damage.") -> true - - message.matchRegex("§eYour §r§6Spirit Pet §r§ehealed (.*) §r§efor §r§a(.*) §r§ehealth!") -> true - message.matchRegex("§eYour §r§6Spirit Pet §r§ehit (.*) enemy for §r§c(.*) §r§edamage.") -> true - - message == "§dCreeper Veil §r§aActivated!" -> true - message == "§dCreeper Veil §r§cDe-activated!" -> true - message.matchRegex("§cYou need at least (.*) mana to activate this!") -> true - - message.matchRegex( - "§eYou were healed for §r§a(.*)§r§e health by §r(.*)§r§e's §r§9Healing Bow§r§e and " + "gained §r§c\\+(.*) Strength§r§e for 10 seconds." - ) -> true - message.matchRegex("(.*)§r§a granted you §r§c(.*) §r§astrength for §r§e20 §r§aseconds!") -> true - - message.matchRegex("§eYour fairy healed §r§ayourself §r§efor §r§a(.*) §r§ehealth!") -> true - message.matchRegex("§eYour fairy healed §r(.*) §r§efor §r§a(.*) §r§ehealth!") -> true - message.matchRegex("(.*) fairy healed you for §r§a(.*) §r§ehealth!") -> true - - else -> false - } - - private fun isDamage(message: String): Boolean = when { - message == "§cMute silenced you!" -> true - message.matchRegex("(.*) §r§aused §r(.*) §r§aon you!") -> true - message.matchRegex("§cThe (.*)§r§c struck you for (.*) damage!") -> true - message.matchRegex("§cThe (.*) hit you for (.*) damage!") -> true - message.matchRegex("§7(.*) struck you for §r§c(.*)§r§7 damage.") -> true - message.matchRegex("(.*) hit you for §r§c(.*)§r§7 damage.") -> true - message.matchRegex("(.*) hit you for §r§c(.*)§r§7 true damage.") -> true - message.matchRegex("§7(.*) exploded, hitting you for §r§c(.*)§r§7 damage.") -> true - message.matchRegex("(.*)§r§c hit you with §r(.*) §r§cfor (.*) damage!") -> true - message.matchRegex("(.*)§r§a struck you for §r§c(.*)§r§a damage!") -> true - message.matchRegex("(.*)§r§c struck you for (.*)!") -> true - - message.matchRegex("§7The Mage's Magma burnt you for §r§c(.*)§r§7 true damage.") -> true - - message.matchRegex("§7Your (.*) hit §r§c(.*) §r§7(enemy|enemies) for §r§c(.*) §r§7damage.") -> true - else -> false - } - - private fun isNotPossible(message: String): Boolean = when (message) { - "§cYou cannot hit the silverfish while it's moving!", - "§cYou cannot move the silverfish in that direction!", - "§cThere are blocks in the way!", - "§cThis chest has already been searched!", - "§cThis lever has already been used.", - "§cYou cannot do that in this room!", - "§cYou do not have the key for this door!", - "§cYou have already opened this dungeon chest!", - "§cYou cannot use abilities in this room!", - "§cA mystical force in this room prevents you from using that ability!" -> true - - else -> false - } - - private fun isBuff(message: String): Boolean = when { - message.matchRegex("§6§lDUNGEON BUFF! (.*) §r§ffound a §r§dBlessing of (.*)§r§f!(.*)") -> true - message.matchRegex("§6§lDUNGEON BUFF! §r§fYou found a §r§dBlessing of (.*)§r§f!(.*)") -> true - message.matchRegex("§6§lDUNGEON BUFF! §r§fA §r§dBlessing of (.*)§r§f was found! (.*)") -> true - message.matchRegex("§eA §r§a§r§dBlessing of (.*)§r§e was picked up!") -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§dBlessing of (.*)§r§e!") -> true - message.matchRegex(" §r§7(Grants|Granted) you §r§a(.*) Strength §r§7and §r§a(.*) Crit Damage§r§7.") -> true - message.matchRegex(" §r§7(Grants|Granted) you §r§a(.*) Defense §r§7and §r§a+(.*) Damage§r§7.") -> true - message.matchRegex(" §r§7(Grants|Granted) you §r§a(.*) HP §r§7and §r§a+(.*)% §r§7health regeneration.") -> true - message.matchRegex(" §r§7(Grants|Granted) you §r§a(.*) Intelligence §r§7and §r§a+(.*)? Speed§r§7.") -> true - message.matchRegex(" §r§7Granted you §r§a+(.*) HP§r§7, §r§a(.*) Defense§r§7, §r§a(.*) Intelligence§r§7, and §r§a(.*) Strength§r§7.") -> true - message == "§a§lBUFF! §fYou have gained §r§cHealing V§r§f!" -> true - else -> false - } - - private fun isPuzzle(message: String): Boolean = when { - message.matchRegex("§a§lPUZZLE SOLVED! (.*) §r§ewasn't fooled by §r§c(.*)§r§e! §r§4G§r§co§r§6o§r§ed§r§a §r§2j§r§bo§r§3b§r§5!") -> true - message.matchRegex("§a§lPUZZLE SOLVED! (.*) §r§etied Tic Tac Toe! §r§4G§r§co§r§6o§r§ed§r§a §r§2j§r§bo§r§3b§r§5!") -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fThough I sit stationary in this prison that is §r§cThe Catacombs§r§f, my knowledge knows no bounds." -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fProve your knowledge by answering 3 questions and I shall reward you in ways that transcend time!" -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fAnswer incorrectly, and your moment of ineptitude will live on for generations." -> true - -// message == "§4[STATUE] Oruo the Omniscient§r§f: §r§f2 questions §r§fleft...and§r§f you will have proven your worth to me!" -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§f2 questions left... Then you will have proven your worth to me!" -> true - - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fOne more question!" -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fI bestow upon you all the power of a hundred years!" -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fYou've already proven enough to me! No need to press more of my buttons!" -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fI've had enough of you and your party fiddling with my buttons. Scram!" -> true - message == "§4[STATUE] Oruo the Omniscient§r§f: §r§fEnough! My buttons are not to be pressed with such lack of grace!" -> true - message.matchRegex("§4\\[STATUE] Oruo the Omniscient§r§f: §r(.*) §r§fthinks the answer is §r§6 . §r(.*)§r§f! §r§fLock in your party's answer in my Chamber!") -> true - else -> false - } - - private fun isKey(message: String): Boolean = when { - message.matchRegex("(.*) §r§ehas obtained §r§a§r§6§r§8Wither Key§r§e!") -> true - message.matchRegex("(.*) opened a §r§8§lWITHER §r§adoor!") -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§c§r§cBlood Key§r§e!") -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§9Beating Heart§r§e!") -> true - message == "§5A shiver runs down your spine..." -> true - message == "§eA §r§a§r§6§r§8Wither Key§r§e was picked up!" -> true - message == "§eA §r§a§r§c§r§cBlood Key§r§e was picked up!" -> true - - else -> false - } - - private fun isReminder(message: String): Boolean = when (message) { - "§e§lRIGHT CLICK §r§7on §r§7a §r§8WITHER §r§7door§r§7 to open it. This key can only be used to open §r§a1§r§7 door!", - "§e§lRIGHT CLICK §r§7on §r§7the §r§cBLOOD DOOR§r§7 to open it. This key can only be used to open §r§a1§r§7 door!" -> true - - else -> false - } - - private fun isPickup(message: String): Boolean = when { - message.matchRegex("(.*) §r§ehas obtained §r§a§r§9Superboom TNT§r§e!") -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§9Superboom TNT §r§8x2§r§e!") -> true - message.matchRegex("§6§lRARE DROP! §r§9Hunk of Blue Ice §r§b\\(+(.*)% Magic Find!\\)") -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§6Revive Stone§r§e!") -> true - message.matchRegex("(.*) §r§ffound a §r§dWither Essence§r§f! Everyone gains an extra essence!") -> true - message == "§fYou found a §r§dWither Essence§r§f! Everyone gains an extra essence!" -> true - message.matchRegex("§d(.*) the Fairy§r§f: You killed me! Take this §r§6Revive Stone §r§fso that my death is not in vain!") -> true - message.matchRegex("§d(.*) the Fairy§r§f: You killed me! I'll revive you so that my death is not in vain!") -> true - message.matchRegex("§d(.*) the Fairy§r§f: You killed me! I'll revive your friend §r(.*) §r§fso that my death is not in vain!") -> true - message.matchRegex("§d(.*) the Fairy§r§f: Have a great life!") -> true - message.matchRegex( - "§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." - ) -> true - message.matchRegex( - "§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." - ) -> true - message.matchRegex("(.*) §r§ehas obtained §r§a§r§9Premium Flesh§r§e!") -> true - message.matchRegex("§6§lRARE DROP! §r§9Beating Heart §r§b(.*)") -> true - else -> false - } - - private fun isStart(message: String): Boolean = when { - message == "§e[NPC] §bMort§f: §rHere, I found this map when I first entered the dungeon." -> true - message == "§e[NPC] §bMort§f: §rYou should find it useful if you get lost." -> true - message == "§e[NPC] §bMort§f: §rGood luck." -> true - message == "§e[NPC] §bMort§f: §rTalk to me to change your class and ready up." -> true - - //§a[Berserk] §r§fMelee Damage §r§c48%§r§f -> §r§a88% - //§a[Berserk] §r§fWalk Speed §r§c38§r§f -> §r§a68 - message.matchRegex("§a(.*) §r§f(.*) §r§c(.*)§r§f -> §r§a(.*)") -> true - else -> false - } - - private fun isPrepare(message: String): Boolean = when { - message == "§aYour active Potion Effects have been paused and stored. They will be restored when you leave Dungeons! You are not allowed to use existing Potion Effects while in Dungeons." -> true - message.matchRegex("(.*) has started the dungeon countdown. The dungeon will begin in 1 minute.") -> true - message.matchRegex("§e[NPC] §bMort§f: §rTalk to me to change your class and ready up.") -> true - message.matchRegex("(.*) §a is now ready!") -> true - message.matchRegex("§aDungeon starts in (.*) seconds.") -> true - message == "§aDungeon starts in 1 second." -> true - message == "§aYou can no longer consume or splash any potions during the remainder of this Dungeon run!" -> true - else -> false - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt deleted file mode 100644 index 04326c598..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt +++ /dev/null @@ -1,130 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.LorenzMod -import at.lorenz.mod.events.CheckRenderEntityEvent -import at.lorenz.mod.events.DamageIndicatorFinalBossEvent -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.events.PacketEvent -import at.lorenz.mod.utils.LorenzUtils -import at.lorenz.mod.utils.LorenzUtils.matchRegex -import net.minecraft.client.Minecraft -import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraft.entity.item.EntityArmorStand -import net.minecraft.entity.monster.EntityGuardian -import net.minecraft.network.play.server.S1CPacketEntityMetadata -import net.minecraft.network.play.server.S2APacketParticles -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class DungeonCleanEnd { - - private var bossDone = false - private var chestsSpawned = false - private var lastBossId: Int = -1 - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inDungeons) return - if (!LorenzMod.feature.dungeon.cleanEnd) return - - val message = event.message - - if (message.matchRegex("([ ]*)§r§c(The|Master Mode) Catacombs §r§8- §r§eFloor (.*)")) { - chestsSpawned = true - } - } - - private fun shouldBlock(): Boolean { - if (!LorenzUtils.inDungeons) return false - if (!LorenzMod.feature.dungeon.cleanEnd) return false - - if (!bossDone) return false - - return true - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - bossDone = false - chestsSpawned = false - lastBossId = -1 - } - - @SubscribeEvent - fun onBossDead(event: DamageIndicatorFinalBossEvent) { - if (!LorenzUtils.inDungeons) return - if (bossDone) return - - if (lastBossId == -1) { - lastBossId = event.id - } - } - - @SubscribeEvent - fun onHealthUpdatePacket(event: PacketEvent.ReceiveEvent) { - if (!LorenzUtils.inDungeons) return - if (!LorenzMod.feature.dungeon.cleanEnd) return - - if (bossDone) return - if (lastBossId == -1) return - - val packet = event.packet - if (packet !is S1CPacketEntityMetadata) return - if (packet.entityId != lastBossId) return - - for (watchableObject in packet.func_149376_c()) { - if (watchableObject.dataValueId == 6) { - val health = watchableObject.`object` as Float - if (health < 1) { - val dungeonFloor = DungeonData.dungeonFloor - LorenzUtils.chat("§eFloor $dungeonFloor done!") - bossDone = true - } - } - } - } - - @SubscribeEvent - fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!shouldBlock()) return - - val entity = event.entity - - if (entity == Minecraft.getMinecraft().thePlayer) return - - if (LorenzMod.feature.dungeon.cleanEndF3IgnoreGuardians) { - if (DungeonData.isOneOf("F3", "M3")) { - if (entity is EntityGuardian) { - if (entity.entityId != lastBossId) { - if (Minecraft.getMinecraft().thePlayer.isSneaking) { - return - } - } - } - } - } - - if (chestsSpawned) { - if (entity is EntityArmorStand) { - if (!entity.hasCustomName()) { - return - } - } - if (entity is EntityOtherPlayerMP) { - return - } - } - - event.isCanceled = true - } - - @SubscribeEvent - fun onReceivePacket(event: PacketEvent.ReceiveEvent) { - if (!shouldBlock()) return - - - if (event.packet is S2APacketParticles) { - event.isCanceled = true - } - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonData.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonData.kt deleted file mode 100644 index 870bcaa50..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonData.kt +++ /dev/null @@ -1,46 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.events.DungeonEnterEvent -import at.lorenz.mod.misc.ScoreboardData -import at.lorenz.mod.utils.LorenzUtils -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class DungeonData { - - companion object { - var dungeonFloor: String? = null - - fun isOneOf(vararg floors: String): Boolean { - for (floor in floors) { - if (dungeonFloor == floor) { - return true - } - } - - return false - } - } - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (event.phase != TickEvent.Phase.START) return - if (LorenzUtils.inDungeons) { - if (dungeonFloor == null) { - for (line in ScoreboardData.sidebarLines) { - if (line.contains("The Catacombs (")) { - dungeonFloor = line.substringAfter("(").substringBefore(")") - DungeonEnterEvent(dungeonFloor!!).postAndCatch() - break - } - } - } - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - dungeonFloor = null - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonDeathCounter.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonDeathCounter.kt deleted file mode 100644 index 156b641c4..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonDeathCounter.kt +++ /dev/null @@ -1,97 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.LorenzMod -import at.lorenz.mod.events.DungeonEnterEvent -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.utils.GuiRender.renderString -import at.lorenz.mod.utils.LorenzUtils -import at.lorenz.mod.utils.LorenzUtils.matchRegex -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class DungeonDeathCounter { - - private var textToRender = "" - private var deaths = 0 - - private fun isDeathMessage(message: String): Boolean = when { - message.matchRegex("§c ☠ §r§7You were killed by (.*)§r§7 and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r§7(.*) was killed by (.*) and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You were crushed and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r§7§r(.*)§r§7 was crushed and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You died to a trap and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r(.*)§r§7 died to a trap and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You burnt to death and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r(.*)§r§7 burnt to death and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You died and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r(.*)§r§7 died and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You suffocated and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r§7§r(.*)§r§7 suffocated and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You died to a mob and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r(.*)§7 died to a mob and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7You fell into a deep hole and became a ghost§r§7.") -> true - message.matchRegex("§c ☠ §r(.*)§r§7 fell into a deep hole and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§(.*)§r§7 disconnected from the Dungeon and became a ghost§r§7.") -> true - - message.matchRegex("§c ☠ §r§7(.*)§r§7 fell to their death with help from §r(.*)§r§7 and became a ghost§r§7.") -> true - - else -> false - } - - @SubscribeEvent(receiveCanceled = true) - fun onChatPacket(event: LorenzChatEvent) { - if (!isEnabled()) return - - if (isDeathMessage(event.message)) { - deaths++ - LorenzUtils.chat("§c§l$deaths. DEATH!") - update() - } - } - - private fun update() { - if (deaths == 0) { - textToRender = "" - return - } - - val color = when (deaths) { - 1, 2 -> "§e" - 3 -> "§c" - else -> "§4" - } - textToRender = color + "Deaths: $deaths" - } - - @SubscribeEvent - fun onDungeonStart(event: DungeonEnterEvent) { - deaths = 0 - update() - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - deaths = 0 - update() - } - - @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { - if (!isEnabled()) return - - LorenzMod.feature.dungeon.deathCounterDisplay.renderString(DungeonMilestoneDisplay.color + textToRender) - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inDungeons && LorenzMod.feature.dungeon.deathCounter - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt deleted file mode 100644 index e824eb714..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonHighlightClickedBlocks.kt +++ /dev/null @@ -1,99 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.events.PacketEvent -import at.lorenz.mod.utils.* -import at.lorenz.mod.utils.BlockUtils.getBlockAt -import at.lorenz.mod.utils.RenderUtils.drawColor -import at.lorenz.mod.utils.RenderUtils.drawString -import at.lorenz.mod.LorenzMod -import net.minecraft.init.Blocks -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement -import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent - -class DungeonHighlightClickedBlocks { - - private val blocks = mutableListOf() - private var colorIndex = 0 - private val colors = listOf(LorenzColor.YELLOW, LorenzColor.AQUA, LorenzColor.GREEN, LorenzColor.LIGHT_PURPLE) - - private fun getNextColor(): LorenzColor { - var id = colorIndex + 1 - if (id == colors.size) id = 0 - colorIndex = id - return colors[colorIndex] - } - - @SubscribeEvent - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzMod.feature.dungeon.highlightClickedBlocks) return - if (!LorenzUtils.inDungeons) return - - if (event.message == "§cYou hear the sound of something opening...") { - event.blockedReason = "dungeon_highlight_clicked_block" - } - } - - @SubscribeEvent - fun onSendPacket(event: PacketEvent.SendEvent) { - if (!LorenzMod.feature.dungeon.highlightClickedBlocks) return - if (!LorenzUtils.inDungeons) return -// TODO add -// if (DungeonAPI.inBossRoom) return - if (event.packet !is C08PacketPlayerBlockPlacement || event.packet.stack == null) return - - val position = event.packet.position.toLorenzVec() - - if (blocks.any { it.position == position }) return - - val type: ClickedBlockType = when (position.getBlockAt()) { - Blocks.chest, Blocks.trapped_chest -> ClickedBlockType.CHEST - Blocks.lever -> ClickedBlockType.LEVER - Blocks.skull -> ClickedBlockType.WITHER_ESSENCE - else -> return - } - - if (type == ClickedBlockType.WITHER_ESSENCE) { - val text = BlockUtils.getSkinFromSkull(position.toBlocPos()) - if (text != "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQ" + - "ubmV0L3RleHR1cmUvYzRkYjRhZGZhOWJmNDhmZjVkNDE3M" + - "DdhZTM0ZWE3OGJkMjM3MTY1OWZjZDhjZDg5MzQ3NDlhZjRjY2U5YiJ9fX0=" - ) { - return - } - } - -// if (nearWaterRoom() && type == ClickedBlockType.LEVER) return - - val color = getNextColor() - val displayText = color.getChatColor() + "Clicked " + type.display - blocks.add(ClickedBlock(position, displayText, color, System.currentTimeMillis())) - } - - @SubscribeEvent - fun onWorldRender(event: RenderWorldLastEvent) { - if (!LorenzMod.feature.dungeon.highlightClickedBlocks) return - if (!LorenzUtils.inDungeons) return - - blocks.removeAll { System.currentTimeMillis() > it.time + 3000 } - blocks.forEach { - event.drawColor(it.position, it.color) - event.drawString(it.position.add(0.5, 0.5, 0.5), it.displayText, true) - } - } - - class ClickedBlock(val position: LorenzVec, val displayText: String, val color: LorenzColor, val time: Long) - - enum class ClickedBlockType(val display: String) { - LEVER("Lever"), - CHEST("Chest"), - WITHER_ESSENCE("Wither Essence"), - } - -// private fun nearWaterRoom(): Boolean { -// val playerLoc = -// LocationUtils.getPlayerLocation().add(LocationUtils.getPlayerLookingAtDirection().multiply(2)).add(0, 2, 0) -// return WaterBoardSolver.waterRoomDisplays.any { it.distance(playerLoc) < 3 } -// } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonMilestoneDisplay.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonMilestoneDisplay.kt deleted file mode 100644 index cad3ff56f..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonMilestoneDisplay.kt +++ /dev/null @@ -1,97 +0,0 @@ -package at.lorenz.mod.dungeon - -import at.lorenz.mod.LorenzMod -import at.lorenz.mod.events.DungeonEnterEvent -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.misc.CurrentPetDisplay -import at.lorenz.mod.utils.GuiRender.renderString -import at.lorenz.mod.utils.LorenzUtils -import at.lorenz.mod.utils.LorenzUtils.matchRegex -import net.minecraftforge.client.event.RenderGameOverlayEvent -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import kotlin.concurrent.fixedRateTimer - -class DungeonMilestoneDisplay { - - - companion object { - private var textToRender = "" - var color = "" - var currentMilestone = 0 - var timeReached = 0L - - fun isMilestoneMessage(message: String): Boolean = when { - message.matchRegex("§e§l(.*) Milestone §r§e.§r§7: You have dealt §r§c(.*)§r§7 Total Damage so far! §r§a(.*)") -> true - message.matchRegex("§e§lArcher Milestone §r§e.§r§7: You have dealt §r§c(.*)§r§7 Ranged Damage so far! §r§a(.*)") -> true - message.matchRegex("§e§lHealer Milestone §r§e.§r§7: You have healed §r§a(.*)§r§7 Damage so far! §r§a(.*)") -> true - message.matchRegex("§e§lTank Milestone §r§e.§r§7: You have tanked and dealt §r§c(.*)§r§7 Total Damage so far! §r§a(.*)s") -> true - - else -> false - } - } - - init { - fixedRateTimer(name = "dungeon-milestone-display", period = 200) { - if (!isEnabled()) return@fixedRateTimer - checkVisibility() - } - } - - private fun checkVisibility() { - if (currentMilestone >= 3) { - if (System.currentTimeMillis() > timeReached + 3_000) - if (textToRender != "") { - textToRender = textToRender.substring(1) - } - } - } - - @SubscribeEvent(receiveCanceled = true) - fun onChatPacket(event: LorenzChatEvent) { - if (!isEnabled()) return - - if (isMilestoneMessage(event.message)) { - event.blockedReason = "dungeon_milestone" - currentMilestone++ - update() - } - } - - private fun update() { - if (currentMilestone > 3) return - if (currentMilestone == 3) { - timeReached = System.currentTimeMillis() - } - - color = when (currentMilestone) { - 0, 1 -> "§c" - 2 -> "§e" - else -> "§a" - } - textToRender = "Current Milestone: $currentMilestone" - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - textToRender = "" - currentMilestone = 0 - } - - @SubscribeEvent - fun onDungeonStart(event: DungeonEnterEvent) { - currentMilestone = 0 - update() - } - - @SubscribeEvent - fun renderOverlay(event: RenderGameOverlayEvent.Post) { - if (!isEnabled()) return - - LorenzMod.feature.dungeon.milestoneDisplayPos.renderString(color + textToRender) - } - - private fun isEnabled(): Boolean { - return LorenzUtils.inDungeons && LorenzMod.feature.dungeon.showMilestoneDisplay - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt deleted file mode 100644 index f1cf83b9c..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt +++ /dev/null @@ -1,181 +0,0 @@ -package at.lorenz.mod.dungeon.damageindicator - -import at.lorenz.mod.LorenzMod -import at.lorenz.mod.dungeon.DungeonData -import at.lorenz.mod.events.DamageIndicatorFinalBossEvent -import at.lorenz.mod.events.DungeonEnterEvent -import at.lorenz.mod.events.LorenzChatEvent -import at.lorenz.mod.utils.LorenzColor -import at.lorenz.mod.utils.LorenzUtils -import at.lorenz.mod.utils.LorenzUtils.baseMaxHealth -import at.lorenz.mod.utils.NumberUtil -import at.lorenz.mod.utils.RenderUtils -import net.minecraft.client.Minecraft -import net.minecraft.client.renderer.GlStateManager -import net.minecraft.entity.EntityLivingBase -import net.minecraft.util.Vec3 -import net.minecraftforge.client.event.RenderLivingEvent -import net.minecraftforge.client.event.RenderWorldLastEvent -import net.minecraftforge.event.entity.EntityJoinWorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.text.DecimalFormat -import java.util.* -import kotlin.math.max - -class DungeonBossDamageIndicator { - - var data = mutableMapOf() - private var bossFinder: DungeonBossFinder? = null - private val decimalFormat = DecimalFormat("0.0") - private val maxHealth = mutableMapOf() - - @SubscribeEvent - fun onDungeonStart(event: DungeonEnterEvent) { - bossFinder = DungeonBossFinder() - } - - @SubscribeEvent(receiveCanceled = true) - fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.inDungeons) return - - bossFinder?.handleChat(event.message) - } - - @SubscribeEvent - fun onWorldRender(event: RenderWorldLastEvent) { - if (!LorenzUtils.inDungeons) return - if (!LorenzMod.feature.dungeon.bossDamageIndicator) return - - GlStateManager.disableDepth() - GlStateManager.disableCull() - - val player = Minecraft.getMinecraft().thePlayer - - for (data in data.values) { - if (System.currentTimeMillis() > data.time + 100) continue//TODO use removeIf - if (!data.ignoreBlocks) { - if (!player.canEntityBeSeen(data.entity)) continue - } - - val entity = data.entity - - var color = data.color - var text = data.text - val delayedStart = data.delayedStart - if (delayedStart != -1L) { - if (delayedStart > System.currentTimeMillis()) { - val delay = delayedStart - System.currentTimeMillis() - color = colorForTime(delay) - var d = delay * 1.0 - d /= 1000 - text = decimalFormat.format(d) - } - } - - val partialTicks = event.partialTicks - RenderUtils.drawLabel( - Vec3( - RenderUtils.interpolate(entity.posX, entity.lastTickPosX, partialTicks), - RenderUtils.interpolate(entity.posY, entity.lastTickPosY, partialTicks) + 0.5f, - RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) - ), - text, - color.toColor(), - partialTicks, - true, - 6f - ) - } - GlStateManager.enableDepth() - GlStateManager.enableCull() - } - - private fun colorForTime(delayedStart: Long): LorenzColor = when { - delayedStart < 1_000 -> LorenzColor.DARK_PURPLE - delayedStart < 3_000 -> LorenzColor.LIGHT_PURPLE - - else -> LorenzColor.WHITE - } - - @SubscribeEvent - fun onRenderLivingPost(event: RenderLivingEvent.Post<*>) { - if (!LorenzUtils.inDungeons) return - - try { - val entity = event.entity - val result = bossFinder?.shouldShow(entity) ?: return - checkLastBossDead(result.finalBoss, entity.entityId) - val ignoreBlocks = result.ignoreBlocks - val delayedStart = result.delayedStart - - - var health = event.entity.health.toInt() - val maxHealth: Int - if (DungeonData.isOneOf("F4")) { - val hitPoints = when (health) { - 300_000 -> 4 - 222_000 -> 3 - 144_000 -> 2 - 66_000 -> 1 - else -> { - LorenzUtils.error("Unexpected health of thorn in F4! ($health)") - return - } - } - - health = hitPoints - maxHealth = 4 - } else { - val biggestHealth = getMaxHealthFor(event.entity) - - if (biggestHealth == 0) { - val currentMaxHealth = event.entity.baseMaxHealth.toInt() - maxHealth = max(currentMaxHealth, health) - setMaxHealth(event.entity, maxHealth) - } else { - maxHealth = biggestHealth - } - } - - val percentage = health.toDouble() / maxHealth.toDouble() - val color = when { - percentage > 0.9 -> LorenzColor.DARK_GREEN - percentage > 0.75 -> LorenzColor.GREEN - percentage > 0.5 -> LorenzColor.YELLOW - percentage > 0.25 -> LorenzColor.GOLD - else -> LorenzColor.RED - } - - data[entity] = EntityData( - entity, - NumberUtil.format(health), - color, - System.currentTimeMillis(), - ignoreBlocks, - delayedStart - ) - - } catch (e: Throwable) { - e.printStackTrace() - } - } - - private fun checkLastBossDead(finalBoss: Boolean, id: Int) { - if (finalBoss) { - DamageIndicatorFinalBossEvent(id).postAndCatch() - } - } - - private fun setMaxHealth(entity: EntityLivingBase, currentMaxHealth: Int) { - maxHealth[entity.uniqueID!!] = currentMaxHealth - } - - private fun getMaxHealthFor(entity: EntityLivingBase): Int { - return maxHealth.getOrDefault(entity.uniqueID!!, 0) - } - - @SubscribeEvent - fun onWorldRender(event: EntityJoinWorldEvent) { - bossFinder?.handleNewEntity(event.entity) - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt deleted file mode 100644 index 2b7e1b373..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt +++ /dev/null @@ -1,382 +0,0 @@ -package at.lorenz.mod.dungeon.damageindicator - -import at.lorenz.mod.dungeon.DungeonData -import at.lorenz.mod.test.LorenzTest -import at.lorenz.mod.utils.LorenzUtils -import at.lorenz.mod.utils.LorenzUtils.baseMaxHealth -import at.lorenz.mod.utils.LorenzUtils.matchRegex -import at.lorenz.mod.utils.LorenzVec -import at.lorenz.mod.utils.getLorenzVec -import net.minecraft.client.Minecraft -import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraft.entity.Entity -import net.minecraft.entity.EntityLivingBase -import net.minecraft.entity.monster.EntityGhast -import net.minecraft.entity.monster.EntityGiantZombie -import net.minecraft.entity.monster.EntityGuardian -import java.util.* - -class DungeonBossFinder { - - //F1 - private var floor1bonzo1 = false - private var floor1bonzo1SpawnTime = 0L - private var floor1bonzo2 = false - private var floor1bonzo2SpawnTime = 0L - - //F2 - private var floor2summons1 = false - private var floor2summons1SpawnTime = 0L - private var floor2summonsDiedOnce = mutableListOf() - private var floor2secondPhase = false - private var floor2secondPhaseSpawnTime = 0L - - //F3 - private var floor3GuardianShield = false - private var floor3GuardianShieldSpawnTime = 0L - private var guardians = mutableListOf() - private var floor3Professor = false - private var floor3ProfessorSpawnTime = 0L - private var floor3ProfessorGuardianPrepare = false - private var floor3ProfessorGuardianPrepareSpawnTime = 0L - private var floor3ProfessorGuardian = false - private var floor3ProfessorGuardianEntity: EntityGuardian? = null - - //F5 - private var floor5lividEntity: EntityOtherPlayerMP? = null - private var floor5lividEntitySpawnTime = 0L - - //F6 - private var floor6Giants = false - private var floor6GiantsSpawnTime = 0L - private var floor6GiantsSeparateDelay = mutableMapOf() - private var floor6Sadan = false - private var floor6SadanSpawnTime = 0L - - internal fun shouldShow(entity: EntityLivingBase): EntityResult? { - if (LorenzUtils.inDungeons) { - if (DungeonData.isOneOf("F1", "M1")) { - if (floor1bonzo1) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "Bonzo ") { - return EntityResult(floor1bonzo1SpawnTime) - } - } - } - if (floor1bonzo2) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "Bonzo ") { - return EntityResult(floor1bonzo2SpawnTime, finalBoss = true) - } - } - } - } - - if (DungeonData.isOneOf("F2", "M2")) { - if (entity.name == "Summon ") { - if (entity is EntityOtherPlayerMP) { - if (floor2summons1) { - if (!floor2summonsDiedOnce.contains(entity)) { - if (entity.health.toInt() != 0) { - return EntityResult(floor2summons1SpawnTime) - } else { - floor2summonsDiedOnce.add(entity) - } - } - } - if (floor2secondPhase) { - return EntityResult(floor2secondPhaseSpawnTime) - } - } - } - - if (floor2secondPhase) { - if (entity is EntityOtherPlayerMP) { - //TODO only show scarf after (all/at least x) summons are dead? - val result = entity.name == "Scarf " - if (result) { - return EntityResult(floor2secondPhaseSpawnTime, finalBoss = true) - } - } - } - } - - if (DungeonData.isOneOf("F3", "M3")) { - if (entity is EntityGuardian) { - if (floor3GuardianShield) { - if (guardians.size == 4) { - var totalHealth = 0 - for (guardian in guardians) { - totalHealth += guardian.health.toInt() - } - if (totalHealth == 0) { - floor3GuardianShield = false - guardians.clear() - } - } else { - findGuardians() - } - if (guardians.contains(entity)) { - return EntityResult(floor3GuardianShieldSpawnTime, true) - } - } - } - - if (floor3Professor) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "The Professor") { - return EntityResult( - floor3ProfessorSpawnTime, - floor3ProfessorSpawnTime + 1_000 > System.currentTimeMillis() - ) - } - } - } - if (floor3ProfessorGuardianPrepare) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "The Professor") { - return EntityResult(floor3ProfessorGuardianPrepareSpawnTime, true) - } - } - } - - if (entity is EntityGuardian) { - if (floor3ProfessorGuardian) { - if (entity == floor3ProfessorGuardianEntity) { - return EntityResult(finalBoss = true) - } - } - } - } - - if (DungeonData.isOneOf("F4", "M4")) { - if (entity is EntityGhast) { - val health = LorenzUtils.formatDouble(entity.health.toDouble()) - LorenzTest.enabled = true - LorenzTest.text = "thorn has $health hp!" - return EntityResult(ignoreBlocks = true, finalBoss = true) - } - - } - - if (DungeonData.isOneOf("F5", "M5")) { - if (entity is EntityOtherPlayerMP) { - if (entity == floor5lividEntity) { -// ignoreBlocks(entity.getLorenzVec().distance(5.5, 69.0, -2.5) < 5) - return EntityResult(floor5lividEntitySpawnTime, true, finalBoss = true) - } - } - } - - if (DungeonData.isOneOf("F6", "M6")) { - if (entity is EntityGiantZombie && !entity.isInvisible) { - if (floor6Giants && entity.posY > 68) { - val extraDelay = checkExtraF6GiantsDelay(entity) - return EntityResult( - floor6GiantsSpawnTime + extraDelay, - floor6GiantsSpawnTime + extraDelay + 1_000 > System.currentTimeMillis() - ) - } - - if (floor6Sadan) { - return EntityResult(floor6SadanSpawnTime, finalBoss = true) - } - } - } - } - - return null - } - - private fun checkExtraF6GiantsDelay(entity: EntityGiantZombie): Long { - val uuid = entity.uniqueID - - if (floor6GiantsSeparateDelay.contains(uuid)) { - return floor6GiantsSeparateDelay[uuid]!! - } - - val middle = LorenzVec(-8, 0, 56) - - val loc = entity.getLorenzVec() - - var pos = 0 - - //first - if (loc.x > middle.x && loc.z > middle.z) { - pos = 2 - } - - //second - if (loc.x > middle.x && loc.z < middle.z) { - pos = 3 - } - - //third - if (loc.x < middle.x && loc.z < middle.z) { - pos = 0 - } - - //fourth - if (loc.x < middle.x && loc.z > middle.z) { - pos = 1 - } - - val extraDelay = 900L * pos - floor6GiantsSeparateDelay[uuid] = extraDelay - - return extraDelay - } - - fun handleChat(message: String) { - when (message) { - //F1 - "§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I’m basically unbeatable." -> { - floor1bonzo1 = true - floor1bonzo1SpawnTime = System.currentTimeMillis() + 11_250 - } - - "§c[BOSS] Bonzo§r§f: Oh noes, you got me.. what ever will I do?!" -> { - floor1bonzo1 = false - } - - "§c[BOSS] Bonzo§r§f: Oh I'm dead!" -> { - floor1bonzo2 = true - floor1bonzo2SpawnTime = System.currentTimeMillis() + 4_200 - } - - "§c[BOSS] Bonzo§r§f: Alright, maybe I'm just weak after all.." -> { - floor1bonzo2 = false - } - - //F2 - "§c[BOSS] Scarf§r§f: ARISE, MY CREATIONS!" -> { - floor2summons1 = true - floor2summons1SpawnTime = System.currentTimeMillis() + 3_500 - } - - "§c[BOSS] Scarf§r§f: Those toys are not strong enough I see." -> { - floor2summons1 = false - } - - "§c[BOSS] Scarf§r§f: Don't get too excited though." -> { - floor2secondPhase = true - floor2secondPhaseSpawnTime = System.currentTimeMillis() + 6_300 - } - - "§c[BOSS] Scarf§r§f: Whatever..." -> { - floor2secondPhase = false - } - - //F3 - "§c[BOSS] The Professor§r§f: I was burdened with terrible news recently..." -> { - floor3GuardianShield = true - floor3GuardianShieldSpawnTime = System.currentTimeMillis() + 16_400 - } - - "§c[BOSS] The Professor§r§f: Even if you took my barrier down, I can still fight." -> { - floor3GuardianShield = false - } - - "§c[BOSS] The Professor§r§f: Oh? You found my Guardians one weakness?" -> { - floor3Professor = true - floor3ProfessorSpawnTime = System.currentTimeMillis() + 10_300 - } - - "§c[BOSS] The Professor§r§f: I see. You have forced me to use my ultimate technique." -> { - floor3Professor = false - - floor3ProfessorGuardianPrepare = true - floor3ProfessorGuardianPrepareSpawnTime = System.currentTimeMillis() + 10_500 - } - - "§c[BOSS] The Professor§r§f: The process is irreversible, but I'll be stronger than a Wither now!" -> { - floor3ProfessorGuardian = true - } - - "§c[BOSS] The Professor§r§f: What?! My Guardian power is unbeatable!" -> { - floor3ProfessorGuardian = false - } - - - //F5 - "§c[BOSS] Livid§r§f: This Orb you see, is Thorn, or what is left of him." -> { - floor5lividEntity = findLivid() - floor5lividEntitySpawnTime = System.currentTimeMillis() + 13_000 - } - - //F6 - "§c[BOSS] Sadan§r§f: ENOUGH!" -> { - floor6Giants = true - floor6GiantsSpawnTime = System.currentTimeMillis() + 7_400 - } - - "§c[BOSS] Sadan§r§f: You did it. I understand now, you have earned my respect." -> { - floor6Giants = false - floor6Sadan = true - floor6SadanSpawnTime = System.currentTimeMillis() + 32_500 - } - - "§c[BOSS] Sadan§r§f: NOOOOOOOOO!!! THIS IS IMPOSSIBLE!!" -> { - floor6Sadan = false - } - } - - if (message.matchRegex("§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!")) { - floor5lividEntity = null - } - } - - fun handleNewEntity(entity: Entity) { - if (floor3ProfessorGuardian) { - if (entity is EntityGuardian) { - if (floor3ProfessorGuardianEntity == null) { - floor3ProfessorGuardianEntity = entity - floor3ProfessorGuardianPrepare = false - } - } - } - } - - private fun findGuardians() { - guardians.clear() - - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityGuardian) { - - val maxHealth = entity.baseMaxHealth.toInt() - - //F3 - if (maxHealth == 1_000_000 || maxHealth == 1_200_000) { - guardians.add(entity) - } - - //F3 Derpy - if (maxHealth == 2_000_000 || maxHealth == 2_400_000) { - guardians.add(entity) - } - - //M3 - if (maxHealth == 240_000_000 || maxHealth == 280_000_000) { - guardians.add(entity) - } - - //M3 Derpy - if (maxHealth == 120_000_000 || maxHealth == 140_000_000) { - guardians.add(entity) - } - } - } - } - - private fun findLivid(): EntityOtherPlayerMP? { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "Livid ") { - return entity - } - } - } - - return null - } -} \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityData.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityData.kt deleted file mode 100644 index 4d60626fc..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityData.kt +++ /dev/null @@ -1,6 +0,0 @@ -package at.lorenz.mod.dungeon.damageindicator - -import at.lorenz.mod.utils.LorenzColor -import net.minecraft.entity.EntityLivingBase - -class EntityData(val entity: EntityLivingBase, val text: String, val color: LorenzColor, val time: Long, val ignoreBlocks: Boolean, val delayedStart: Long) \ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityResult.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityResult.kt deleted file mode 100644 index f0642b953..000000000 --- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/EntityResult.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.lorenz.mod.dungeon.damageindicator - -class EntityResult(val delayedStart: Long = -1L, val ignoreBlocks: Boolean = false, val finalBoss: Boolean = false) \ No newline at end of file -- cgit