diff --git a/build.gradle.kts b/build.gradle.kts index c971ba14fef2..423182c63dff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.25.Beta.25" +version = "0.25" val gitHash by lazy { val baos = ByteArrayOutputStream() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 239dfc8d2a49..511d56d15082 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,6 @@ # SkyHanni - Change Log -## Version 0.25 (In Beta) +## Version 0.25 ### New Features @@ -16,7 +16,7 @@ + Options to show/hide boosted crop and pest icons. + Added Super Craft button to visitors for ease of access. - Conutik (https://github.com/hannibal002/SkyHanni/pull/1173) + Checks if you have enough materials to craft the items and depending on that shows the button or not. -+ Added overflow Garden crop milestones. - Luna & HiZe (https://github.com/hannibal002/SkyHanni/pull/997) ++ Added overflow Garden crop milestones. - Alexia Luna & HiZe (https://github.com/hannibal002/SkyHanni/pull/997) #### Diana Features @@ -46,7 +46,7 @@ + Added option to highlight own Golden/Diamond Goblin. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1466) + Added Glacial Powder as stack size in the Fossil Excavator. - - jani270 (https://github.com/hannibal002/SkyHanni/pull/1458) + jani (https://github.com/hannibal002/SkyHanni/pull/1458) + Click to get an Ascension Rope from sacks in the Mineshaft. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1542) + Added Tunnel Maps. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1546) @@ -90,11 +90,11 @@ + Added Quiver Display. - Empa (https://github.com/hannibal002/SkyHanni/pull/1190) + Only shows the type of arrow when wearing a Skeleton Master Chestplate. + Added an option to highlight Zealots holding Chests in a different color. - - Luna (https://github.com/hannibal002/SkyHanni/pull/1347) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1347) #### Chat Features -+ Added party chat commands. - !nea (https://github.com/hannibal002/SkyHanni/pull/1433) ++ Added party chat commands. - nea (https://github.com/hannibal002/SkyHanni/pull/1433) + Added `!pt` (and aliases) as a command that allows others to transfer the party to themselves. + Added `!pw` (and aliases) as a command that allows others to request a warp. + Added Option to reorder or hide every part of a player chat message. - @@ -154,6 +154,8 @@ RobotHanzo (https://github.com/hannibal002/SkyHanni/pull/1582) + Added time until the next Hoppity event in chat message for egg locator. - seraid (https://github.com/hannibal002/SkyHanni/pull/1625) ++ Added a warning before the Time Tower in the Chocolate Factory ends. - + seraid (https://github.com/hannibal002/SkyHanni/pull/1816) #### Inventory Features @@ -163,6 +165,8 @@ + Option to change enchant formatting. + Also parses tooltips from /show. + Added option to hide item tooltips inside the Harp. - raven (https://github.com/hannibal002/SkyHanni/pull/1700) ++ Added an option in the Auction House search browser to search for the item on coflnet.com. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1743) #### Crimson Features @@ -191,6 +195,9 @@ + Added /shignore. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1469) + This lets you block users from running party commands. + Option to Replace Roman Numerals. - Mikecraft1224 (https://github.com/hannibal002/SkyHanni/pull/1722) ++ Added a simple Ferocity Display. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1765) + + Shows the Ferocity stat as a single GUI element. + + Requires the Tab List widget to be enabled and Ferocity to be selected to work. ### Improvements @@ -218,7 +225,7 @@ + Added options to toggle overflow garden levels and overflow level up messages. - Empa (https://github.com/hannibal002/SkyHanni/pull/1325) + Added an option to disable custom garden key binds while on the barn plot. - - jani270 (https://github.com/hannibal002/SkyHanni/pull/1559) + jani (https://github.com/hannibal002/SkyHanni/pull/1559) + Added option to block accepting/refusing visitors depending on coin loss. - Albin (https://github.com/hannibal002/SkyHanni/pull/1502) + Changed broken Pest Particle Waypoint to just show existing particles better, no guess. - @@ -228,12 +235,21 @@ hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1650) + Made the Composter chat message clickable to warp to the Garden. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1723) -+ Improved Farming Timer. - Luna (https://github.com/hannibal002/SkyHanni/pull/1737) ++ Improved Farming Timer. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1737) + The secondary visitor timer now accurately checks your BPS (Blocks Per Second) instead of assuming a value of 20. -+ Do Not Hide Maeve's Garden Chat Dialogue. - Luna (https://github.com/hannibal002/SkyHanni/pull/1742) ++ Do Not Hide Maeve's Garden Chat Dialogue. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1742) + Maeve's Garden visitor dialogue is no longer hidden, preventing confusion about potential bugs. -+ Displays the middle of the plot while the pest line is showing. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1647) ++ Displays the middle of the plot while the pest line is showing. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1647) + This makes it clearer when the guess points to the middle of the plot rather than to a pest. ++ Improved pest count accuracy in plot detection. - Empa (https://github.com/hannibal002/SkyHanni/pull/1764) ++ Added options to show crops per second and crops per hour in the Crop Milestone Display. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1536) ++ Added tool gemstone information to /ff crop pages. - + maxime-bodifee (https://github.com/hannibal002/SkyHanni/pull/1817) ++ Added supreme chocolate bars to the Cocoa Beans menu in /ff. - + maxime-bodifee (https://github.com/hannibal002/SkyHanni/pull/1817) + + Toggle this information with `/shcocoabeans`. #### Diana Improvements @@ -246,6 +262,8 @@ + Disabled per default. + Now detecting inquisitor share messages sent from CT module "InquisitorChecker". - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1359) ++ Added a Diana chat helper. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1808) + + This feature helps to enable /particlequality extreme and /togglemusic when needed. #### GUI Improvements @@ -285,7 +303,10 @@ hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1648) + Changed Chocolate Factory shortcut icon. - seraid (https://github.com/hannibal002/SkyHanni/pull/1640) + Added incoming tab list event to Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1666) -+ Changed the default design of the quiver line in Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1752) ++ Changed the default design of the quiver line in Custom Scoreboard. - + j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1752) ++ Show infinite Arrows in Custom Scoreboard when wearing Skeleton Master Chestplate. - + j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1795) #### Commands Improvements @@ -327,11 +348,17 @@ + Click an item that can be upgraded/purchased with chocolate to set it as a reminder goal. + Works with Rabbits, Barn, Time Tower, etc. + Option to display this timer universally, even outside the inventory. ++ Added a display for the time remaining until Tower Charges are full. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1760) ++ Include item prices for upgrading in the Chocolate Shop calculation. - + seraid (https://github.com/hannibal002/SkyHanni/pull/1805) ++ Added display of prestige level in chocolate factory statistics. - + seraid (https://github.com/hannibal002/SkyHanni/pull/1827) #### Slayer Improvements -+ Added Dragon's Nest as a valid Enderman Slayer location. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1399) ++ Added Dragon's Nest as a valid Enderman Slayer location. - Alexia Luna + (https://github.com/hannibal002/SkyHanni/pull/1399) + RNG meter item will now be detected when opening slayer menu. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1479) + Clicking the slayer RNG meter now opens the selection inventory. - @@ -358,6 +385,8 @@ + Renamed Deep Caverns parkour to Deep Caverns Guide. - seraid (https://github.com/hannibal002/SkyHanni/pull/1443) + Make Fossil Excavator a category rather than accordion. - walker (https://github.com/hannibal002/SkyHanni/pull/1441) + Disabled colored blocks in the Mineshaft. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1749) ++ Disabled mining commissions block color in Dwarven Mines. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1790) #### Event Improvements @@ -397,12 +426,20 @@ + Expanded options for Hoppity Waypoint rendering. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1739) + Improved wording for Chocolate Factory spam filter and upgrade notification config options. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1729) -+ Added an option to only receive Rabbit Crush warnings during the Hoppity event. - Empa (https://github.com/hannibal002/SkyHanni/pull/1762) ++ Added an option to only receive Rabbit Crush warnings during the Hoppity event. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1762) ++ Warn when all three Hoppity eggs are ready to be found. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1747) ++ Improved Hoppity Egg warning. - Obsidian (https://github.com/hannibal002/SkyHanni/pull/1802) + + Added option to warp to an island on click. + + Fixed a typo. ++ Extended warning sound duration when all 3 Hoppity Eggs are found. - + seraid (https://github.com/hannibal002/SkyHanni/pull/1793) #### Rift Improvements + Made the vermins in the Vermin Tracker match the order shown in Kat's menu. - - Luna (https://github.com/hannibal002/SkyHanni/pull/1459) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1459) #### Dungeon Improvements @@ -421,7 +458,7 @@ + Added option to toggle No Bits Warning sound. - Empa (https://github.com/hannibal002/SkyHanni/pull/1425) + Show enchantment in book bundle name in profit tracker. - Empa (https://github.com/hannibal002/SkyHanni/pull/1391) + Added the option to choose the duration and color of Patcher Coords Waypoints. - - jani270 (https://github.com/hannibal002/SkyHanni/pull/1476) + jani (https://github.com/hannibal002/SkyHanni/pull/1476) + Added support to right-click in GUI editor to open config for all remaining GUI elements. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1455) + Fixed another memory leak. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1491) @@ -429,7 +466,14 @@ + Added descriptions for missing config categories. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1600) + Architect Draft messages can now be copied and pasted. - raven (https://github.com/hannibal002/SkyHanni/pull/1732) + Updated setting description for clarity. - seraid (https://github.com/hannibal002/SkyHanni/pull/1736) -+ The GUI position editor can now edit all GUIs that were visible within the last 20 seconds, including those inside inventories. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1768) ++ The GUI position editor can now edit all GUIs that were visible within the last 20 seconds, including those inside + inventories. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1768) ++ Improved the performance of scoreboard and tab list reading. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1779) ++ Improved performance of minion nametag feature and removed unnecessary checks between blocks. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1780) ++ Re-added different arrow types in Quiver Reminder after a run. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1832) ### Fixes @@ -448,6 +492,11 @@ hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1607) + Fixed error message when starting slayer quest in mining islands. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1619) ++ Fixed multiple slayer warning bugs. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1814) + + Fixed slayer warning showing up at the wrong time. + + Fixed Slayer Warning showing up when others are damaging mobs in an incorrect area. + + Fixed showing warnings while doing Diana. + + Fixed Slayer warning being off when joining/leaving the Rift. #### Garden Fixes @@ -491,14 +540,27 @@ + Fixed farming tool detection sometimes not working after closing an inventory. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1692) + Fixed the secondary visitor timer constantly disappearing while farming. - - Luna (https://github.com/hannibal002/SkyHanni/pull/1737) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1737) ++ Fixed /ff not displaying armor fortune correctly. - maxime-bodifee (https://github.com/hannibal002/SkyHanni/pull/1817) + + Gemstones and the Pesterminator are now included in the calculations. + + The total value for each armor piece is now displayed correctly. + + Updated total universal farming values to reflect these changes. ++ Fixed Farming Contest Stats taking too long to display in chat. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1829) ++ Fixed Farming Contest blocking other GUIs even while outside the Garden. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1829) ++ Fixed showing the wrong visitor time when info is not in the tab list. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1831) ++ Fixed an error in /ff when you don't have a gemstone. - + Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1823) ++ Fixed plot border rendering in the Garden. - seraid (https://github.com/hannibal002/SkyHanni/pull/1819) #### Chat Fixes + Added names of lobby players to /p tab complete. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1340) + Fixed friend detection from chat. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1336) -+ Fixed the Supercraft /gfs prompt not showing when you crafted 1,000 or more items. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1351) ++ Fixed the Supercraft /gfs prompt not showing when you crafted 1,000 or more items. - Alexia Luna + (https://github.com/hannibal002/SkyHanni/pull/1351) + Make fire sale hider in tab list work again. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1355) + Queued gfs now works with gemstone names. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1468) + Fixed pet rarity drop messages modifying unrelated messages. - @@ -510,10 +572,16 @@ + Fixed aquamarine gemstones in queued gfs. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1545) + Fixed some guild chat messages having wrong format. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1568) + Fixed chat click and hover functionality. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1680) -+ Fixed a rare crash related to complex chat events. - !nea (https://github.com/hannibal002/SkyHanni/pull/1707) ++ Fixed a rare crash related to complex chat events. - nea (https://github.com/hannibal002/SkyHanni/pull/1707) + Fixed stash getting detected as private message. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1716) + Fixed spaces in chat formatting. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1704) -+ Fixed player chat spacing issue with the crimson faction icon. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1770) ++ Fixed player chat spacing issue with the crimson faction icon. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1770) ++ Fixed extra space in chat formatting. - Jordyrat (https://github.com/hannibal002/SkyHanni/pull/1785) ++ Fixed incorrect chat format when using the Hypixel command /show. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1781) ++ Fixed replacing words in dialogue with numbers. - Mikecraft1224 (https://github.com/hannibal002/SkyHanni/pull/1755) ++ Minor co-op chat capitalization fix. - appable (https://github.com/hannibal002/SkyHanni/pull/1825) #### GUI Fixes @@ -530,8 +598,8 @@ + Fixed "unknown lines" error with an objective line in Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1394) + Fixed Powder not being shown in the Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1414) -+ Fixed the skill tab list pattern sometimes not matching. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1419) ++ Fixed the skill tab list pattern sometimes not matching. - Alexia Luna + (https://github.com/hannibal002/SkyHanni/pull/1419) + Fixed multiple mining v3 Unknown Lines errors in Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1420) + Fixed Fame rank-up not updating the rank. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1450) @@ -566,12 +634,20 @@ + Fixed text transparency issues with Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1730) + Fixed more double objectives in Custom Scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1731) + Fixed missing Hay Eaten line in Custom Scoreboard in Rift. - Empa (https://github.com/hannibal002/SkyHanni/pull/1721) -+ Fixed Custom Scoreboard showing the Spooky Festival Time twice. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1757) ++ Fixed Custom Scoreboard showing the Spooky Festival Time twice. - + j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1757) ++ Fixed unknown scoreboard lines chat error message when Hypixel sends incomplete line data. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1761) ++ Fixed Custom Scoreboard error during Winter Event. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1789) ++ Fixed max island size display in Crimson Isle and Catacombs in Custom Scoreboard. - + j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1822) ++ Fixed some issues where skyhanni guis would have click and hover events when they shouldn't. - + CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1846) #### Dungeon Fixes -+ Dungeon Copilot no longer tells you to enter the nonexistent boss room in The Catacombs - Entrance. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1374) ++ Dungeon Copilot no longer tells you to enter the nonexistent boss room in The Catacombs - Entrance. - Alexia Luna + (https://github.com/hannibal002/SkyHanni/pull/1374) + Fixed some area walls overlapping with blocks. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1418) + Fixed Dungeon Copilot not working on the Entrance Floor. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1656) @@ -611,15 +687,38 @@ CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1726) + Fixed the Chocolate Factory upgrade warning incorrectly displaying when no upgrade was possible. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1741) -+ Fixed a case where the chocolate factory upgrade warning did not work. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1758) ++ Fixed a case where the chocolate factory upgrade warning did not work. - + CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1758) ++ Fixed Chocolate Factory time remaining calculations while the Time Tower is active. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1774) ++ Fixed enchantment colours showing as white when SkyHanni chroma is not enabled. - + CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1798) ++ Fixed Chocolate Factory Shop. - seraid (https://github.com/hannibal002/SkyHanni/pull/1815) + + Profit calculations now show in sub-menus. + + Total chocolate value now updates when buying something from the Chocolate Factory Shop. ++ Fixed displaying Chest Value in minion inventories. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1834) ++ Fixed displaying Chest Value in some bazaar pages. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1833) ++ Fixed the selling of SkyBlock Menu. - seraid (https://github.com/hannibal002/SkyHanni/pull/1820) ++ Fixed Dark Candy not appearing in Candy Bag possible items. - + seraid (https://github.com/hannibal002/SkyHanni/pull/1820) ++ Fixed the ability to hide Chocolate Factory upgrade messages. - + seraid (https://github.com/hannibal002/SkyHanni/pull/1820) ++ Fixed Time Until Next Charge display. - seraid (https://github.com/hannibal002/SkyHanni/pull/1806) ++ Fixed typos and formatting in Craft Materials From Bazaar. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1840) ++ Fixed invalid bazaar items being highlighted in the clickable items feature. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1841) ++ Fixed Bazaar price features not working for Ultimate Jerry. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1842) #### Rift Fixes + Fixed Rift NPC shops being treated as overworld ones for selling items to them. - - Luna (https://github.com/hannibal002/SkyHanni/pull/1494) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1494) + Fixed Blood Effigies timers in the Rift. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1649) + Fixed timers showing even when above the set respawn time. + Fixed display flickering due to milliseconds. ++ Fixed duplicate word "soul" in an Enigma Waypoint. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1776) #### Mining Fixes @@ -631,6 +730,8 @@ hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1628) + Fixed Mining event error spam in chat when the API got connection problems. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1746) ++ Fixed Bal being incorrectly highlighted when a Yog Slayer commission is active. - + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1801) #### Command Fixes @@ -653,11 +754,28 @@ + Fixed some cases where egg locator solver would trigger incorrectly. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1689) + Fixed incorrect Hoppity Waypoint rendering. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1739) ++ Fixed Hoppity Egg warnings appearing at the wrong time. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1796) + + Fixed warning showing while the event is already over. + + Fixed warning showing while you are busy. #### Crimson Isle Fixes + Fixed incorrect miniboss amount displayed by Crimson Isle Reputation Helper. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1633) ++ Fixed Volcano Explosivity Display. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1821) + + Broken when Hypixel introduced the new tab list. + +#### Diana Fixes + ++ Fixed an error in the All Burrows List. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1809) + +#### Combat Fixes + ++ Fixed Low Quiver Warning incorrectly appearing when switching to no arrows. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1832) ++ Fixed bestiary display always being disabled in search mode. - + appable (https://github.com/hannibal002/SkyHanni/pull/1828) #### Misc Fixes @@ -665,11 +783,11 @@ + Fixes random error in mob detection. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1361) + Fixed a spelling mistake in the Deep Caverns Parkour config. - jani (https://github.com/hannibal002/SkyHanni/pull/1349) -+ Rendered Items in SkyHanni GUIs no longer have partially broken textures. (on default size) - ++ Rendered Items in SkyHanni GUIs no longer have partially broken textures (on default size). - Empa (https://github.com/hannibal002/SkyHanni/pull/1390) + Fixes skill progress item scale being bigger than intended. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1413) -+ Fixed modid of SkyHanni classes being wrong, causing various issues, like the gfs queue not working - ++ Fixed modid of SkyHanni classes being wrong, causing various issues, like the gfs queue not working. - nea (https://github.com/hannibal002/SkyHanni/pull/1411) + Fixed some typos. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1408) + Fixed No Bits Warning triggering when spending bits. - Empa (https://github.com/hannibal002/SkyHanni/pull/1425) @@ -704,17 +822,35 @@ + Fixed the low quiver warning. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1629) + Fixed Custom Scoreboard occasionally displaying an outdated mayor after an election switch. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1698) -+ Fixed Active Effects in Compact Tab List always showing 0. - Luna (https://github.com/hannibal002/SkyHanni/pull/1706) -+ Fixed bugged minion name tags on your private island when opening a minion. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1630) ++ Fixed Active Effects in Compact Tab List always showing 0. - Alexia + Luna (https://github.com/hannibal002/SkyHanni/pull/1706) ++ Fixed bugged minion name tags on your private island when opening a minion. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1630) ++ Fixed supercrafted items being incorrectly added to profit trackers. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1784) ++ Fixed typo in the Mythological Creature Tracker reset command. - + Jordyrat (https://github.com/hannibal002/SkyHanni/pull/1800) ++ Fixed Inquisitor chat sharing sometimes not working. - yhtez (https://github.com/hannibal002/SkyHanni/pull/1799) ++ Fixed some cases of incorrect height for Griffin burrow waypoints. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1797) ++ Fixed profit tracker enchanted book name. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1775) ++ Fixed removal of incorrect minion name tags. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1791) + + No longer resets all minion nametags when clicking the wheat minion in the Hub. + + No longer resets minion nametags that are far away from the clicked minion. ++ Fixed the armor hider also hiding items in the inventory. - + hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1813) ++ Fixed an error in the Outside SkyBlock setting. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1810) ++ Fixed memory leaks. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1839) ++ Fixed a small Memory Leak in MobData. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1844) ### Technical Details + Added KuudraAPI. - Empa (https://github.com/hannibal002/SkyHanni/pull/1209) + Added KuudraEnterEvent and KuudraCompleteEvent. - Empa (https://github.com/hannibal002/SkyHanni/pull/1209) -+ Added intrinsic scalability of strings - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/888) ++ Added intrinsic scalability of strings. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/888) + Added Renderable.wrappedString. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/888) + Wraps a string n times if it exceeds the specified length -+ Added Mob Detection - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/712) ++ Added Mob Detection. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/712) + Make all event function names uniform. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1290) + Added offset to tick event. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1342) + Made dungeon milestone use repo instead of local patterns. - @@ -749,8 +885,8 @@ hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1380) + Added Renderable.verticalContainer. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1318) + Remove a lot of deprecated methods. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1371) -+ Added Renderable.table - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/822) -+ Add API for rendering fake ghostly/holograhpic entities in the world - ! ++ Added Renderable.table. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/822) ++ Add API for rendering fake ghostly/holograhpic entities in the world. - nea (https://github.com/hannibal002/SkyHanni/pull/731) + Added a `removeSpray` method to `Plot`. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1178) + Changed stuff around with chat messages. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1227) @@ -763,20 +899,20 @@ + Fixed mob detection: decoy, m7 dragon, husks. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1367) + Added clickableUserError. - Empa (https://github.com/hannibal002/SkyHanni/pull/1387) + Fixed itemScale for Renderable.itemStack. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1390) -+ Bump MoulConfig to 3.0.0 betas - !nea (https://github.com/hannibal002/SkyHanni/pull/1382) ++ Bump MoulConfig to 3.0.0 betas. - nea (https://github.com/hannibal002/SkyHanni/pull/1382) + Adds jumps, links and portals. + Changes the package from a mix of `io.github.moulberry.moulconfig` and `io.github.notenoughupdates.moulconfig` to just `io.github.notenoughupdates.moulconfig` -+ Added Renderable.renderInsideRoundedRect - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/890) ++ Added Renderable.renderInsideRoundedRect. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/890) + Switch from LorenzUtils.inDungeons to DungeonAPI.inDungeon(). - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1378) -+ Bumped MoulConfig - nea (https://github.com/hannibal002/SkyHanni/pull/1411) ++ Bumped MoulConfig. - nea (https://github.com/hannibal002/SkyHanni/pull/1411) + Deleted two empty files. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1401) + Added BitsGain, BitsSpent and BitsAvailableGained to BitsUpdateEvent. - Empa (https://github.com/hannibal002/SkyHanni/pull/1425) + Renamed bitsToClaim to bitsAvailable. - Empa (https://github.com/hannibal002/SkyHanni/pull/1425) -+ Made `HypixelData.skyBlockArea[withSymbol]` and `LorenzUtils.skyBlockArea` nullable. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1421) ++ Made `HypixelData.skyBlockArea[withSymbol]` and `LorenzUtils.skyBlockArea` nullable. - Alexia Luna + (https://github.com/hannibal002/SkyHanni/pull/1421) + This replaces the previous `"?"` magic value. + Fixed colors in debug messages. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1423) + Code cleanup. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1402) @@ -785,8 +921,8 @@ + Added slot to OwnInventoryItemUpdateEvent. - Empa (https://github.com/hannibal002/SkyHanni/pull/1190) + Added QuiverUpdateEvent. - Empa (https://github.com/hannibal002/SkyHanni/pull/1190) + Use Quiver item in 9th hotbar slot for QuiverAPI. - Empa (https://github.com/hannibal002/SkyHanni/pull/1190) -+ Added party leader to `PartyAPI`. - !nea (https://github.com/hannibal002/SkyHanni/pull/1433) -+ Added party chat event. - !nea (https://github.com/hannibal002/SkyHanni/pull/1433) ++ Added party leader to `PartyAPI`. - nea (https://github.com/hannibal002/SkyHanni/pull/1433) ++ Added party chat event. - nea (https://github.com/hannibal002/SkyHanni/pull/1433) + Removed use of notenoughupdates.util.Constants. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1191) + Made a generic gson builder containing common type adapters. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1308) @@ -803,7 +939,7 @@ CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1445) + Changed neu version in dev env. - nopo (https://github.com/hannibal002/SkyHanni/pull/1446) + Changed config name. - seraid (https://github.com/hannibal002/SkyHanni/pull/1443) -+ Fixed internalizing config moves introducing a self reference inside the JSON tree. - ! ++ Fixed internalizing config moves introducing a self reference inside the JSON tree. - nea (https://github.com/hannibal002/SkyHanni/pull/1447) + Added MiningAPI which includes all GlaciteTunnels related stuff. - j10a1n15, Empa (https://github.com/hannibal002/SkyHanni/pull/1438) @@ -819,7 +955,7 @@ + Fixed a bug in mobDetection. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1495) + Show sound locations in-world for `/shtracksounds`. - ThatGravyBoat (https://github.com/hannibal002/SkyHanni/pull/1489) -+ Changed auto mixins to be gathered at compile time, rather than runtime. - ! ++ Changed auto mixins to be gathered at compile time, rather than runtime. - nea (https://github.com/hannibal002/SkyHanni/pull/1456) + A ton. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1483) + LorenzTooltipEvent no longer uses forge events. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1331) @@ -828,11 +964,11 @@ + Fixed f7 bosses not detecting as boss. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1496) + Move contributors to its own class manager. - ThatGravyBoat (https://github.com/hannibal002/SkyHanni/pull/1519) + Allow tab list suffix to be changed per contributor. -+ Added chat component spans. - !nea (https://github.com/hannibal002/SkyHanni/pull/1512) ++ Added chat component spans. - nea (https://github.com/hannibal002/SkyHanni/pull/1512) + Chat component spans represent a substring of a component, preserving chat style information. + You can further slice it, as well as sampling the style in various places. + Allows transforming back into an equivalent chat component (excluding hierarchy information). -+ Added component matcher. - !nea (https://github.com/hannibal002/SkyHanni/pull/1512) ++ Added component matcher. - nea (https://github.com/hannibal002/SkyHanni/pull/1512) + Allows matching regexes against chat component spans (and by extension, chat components). + Removed `ItemRenderBackground`. - ThatGravyBoat (https://github.com/hannibal002/SkyHanni/pull/1497) + Added helpers in `RenderUtils` for drawing borders. @@ -845,7 +981,7 @@ + Replace many internal commands with onClick() feature. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1522) + Using PrimitiveItemStack at getMultiplier. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1165) + Simplified the code checking when you can steak your Vampire Slayer boss. - - Luna (https://github.com/hannibal002/SkyHanni/pull/1547) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1547) + Added blessings to dungeonAPI. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1326) + Moved drawGradientRect to RenderUtils. - Vixid (https://github.com/hannibal002/SkyHanni/pull/1461) + Moved Discord RPC to ThatGravyBoat version on TeamResourceful maven. - @@ -876,7 +1012,7 @@ + Allows use of `/shtestmessage -complex` to test components in JSON format. - nea (https://github.com/hannibal002/SkyHanni/pull/1663) + Similar to those obtained from shift-clicking `/shchathistory`. -+ Made `CropType.getByNameOrNull()` case-insensitive. - Luna (https://github.com/hannibal002/SkyHanni/pull/997) ++ Made `CropType.getByNameOrNull()` case-insensitive. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/997) + Added GuiContainerEvent.BeforeDraw. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1510) + Created a new bazaar price data fetcher, independent of NEU. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1597) @@ -886,6 +1022,14 @@ ThatGravyBoat (https://github.com/hannibal002/SkyHanni/pull/1696) + Useful for hiding extra layers of a player such as armor, capes, Items and so on. + Removed code duplication in AxisAlignedBB.getCorners. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1756) ++ Added a RemovalListener to TimeLimitedCache and TimeLimitedSet. - + Empa (https://github.com/hannibal002/SkyHanni/pull/1761) ++ Added an optional custom hover to clickableChat. - Obsidian (https://github.com/hannibal002/SkyHanni/pull/1802) ++ Added test command /shtestgriffinspots. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1797) + + This command tests all surrounding locations for possible Griffin burrow spots. ++ No longer creating a new MiscFeatures instance on each lobby command. - + CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1792) ++ Fixed up some other patterns. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1792) ### Removed Features @@ -894,7 +1038,7 @@ + Removed Bow Sound distance setting. - Empa (https://github.com/hannibal002/SkyHanni/pull/1190) + Removing Player Chat Symbols. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1483) + This is now merged in "Part Order". -+ Removed Twinclaws Sound. - Luna (https://github.com/hannibal002/SkyHanni/pull/1527) ++ Removed Twinclaws Sound. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1527) + Implemented by Hypixel. ## Version 0.24 @@ -1045,7 +1189,7 @@ + Updating "bits to claim" in the Custom Scoreboard when opening the GUI /boostercookiemenu. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1230) + Added "Curse of Greed" to non-God Potion effect display. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1225) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1225) + Added cold as a Scoreboard Element. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1238) + Add 4 more empty lines into custom scoreboard. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1259) + Added customisable Events Priority in Custom Scoreboard. - @@ -1084,10 +1228,10 @@ + Hide the Sensitivity Reducer overlay when the mouse is locked. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/1253) + Hide visitor Jacob messages without hiding real Jacob ones. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1267) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1267) + Previously, we made the Jacob visitor messages not hidden to avoid hiding real Jacob messages. + Added the ability to get your current speed on the Garden even if it isn't shown in the tab list. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1277) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1277) + This also means the speed now updates faster. + Change the Pest Waypoint color depending on distance. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1296) + It is the one from the Hypixel particles. @@ -1114,7 +1258,7 @@ + Added custom text when ready to pull. + The text is now aligned to the center of the GUI element. + Added a delay after tool swap before warning about wrong farming speed. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/840) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/840) + Loading Trophy Fish information from NEU PV. - hannibal2 & CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1123) + Added wireframe as a valid Totem of Corruption outline. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/1248) @@ -1212,7 +1356,7 @@ + Fixed visitor status not updating to Ready when you have enough items in sacks after first talking to the visitor. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1224) + Fixed visitor status not updating to Waiting when you no longer have enough items when talking to them. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1224) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1224) + Fixed pest overlays not showing if the amount in each one was unknown. - Empa (https://github.com/hannibal002/SkyHanni/pull/1237) + Fixed pests spawning in the Barn plot not being detected. - Empa (https://github.com/hannibal002/SkyHanni/pull/1237) @@ -1365,7 +1509,7 @@ CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1186) + Fixed Superboom TNT not working with Queued GFS. - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/1196) + Fixed detection of Party Leader when their username ends with an `s`. - Alexia - Luna (https://github.com/hannibal002/SkyHanni/pull/1203) + Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1203) + Hover messages can't go off-screen anymore - Thunderblade73 (https://github.com/hannibal002/SkyHanni/pull/821) + Fix "Ghost Entities" feature breaking outside SkyBlock game modes on Hypixel. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1301) @@ -1397,11 +1541,11 @@ + Use internal name more in ItemDisplayOverlayFeatures - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1114) + Reformatted the code in a lot of files. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1109) + Changed line endings to be normalized over the whole project and prevents further breaks. - - your_name_here (https://github.com/hannibal002/SkyHanni/pull/1112) + nea (https://github.com/hannibal002/SkyHanni/pull/1112) + Added more error logging to getting farming weight. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/1120) + Removed unnecessary capturing groups from the Anita's Accessory chat filter regex. - Alexia Luna (https://github.com/hannibal002/SkyHanni/pull/1115) -+ Add maven publication details, allowing other mods to integrate more easily with Skyhanni. - ! ++ Add maven publication details, allowing other mods to integrate more easily with Skyhanni. - nea (https://github.com/hannibal002/SkyHanni/pull/935) + Created Pull Request template. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1108) + For better maintainability and automatic beta changelog creation. @@ -1464,7 +1608,7 @@ hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1171) + Moved Thaumaturgy Tuning Points detection into MaxwellAPI, and saving it in the profile-specific config. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1201) -+ Add "open in regex101.com" IntelliJ intention. - !nea (https://github.com/hannibal002/SkyHanni/pull/1210) ++ Add "open in regex101.com" IntelliJ intention. - nea (https://github.com/hannibal002/SkyHanni/pull/1210) + Press ALT+ENTER while hovering over a RepoPattern.pattern call with your text cursor to select the "Open regex101.com" option + Add a Kotlin doc comment with `REGEX-TEST: someString` lines to add test cases @@ -1683,7 +1827,7 @@ + Added option to change the size of the Pet Item Display Icon in inventories. - Thunderblade73 + Allow putting Water Bottles into Potion Bag. - Alexia Luna + Skip unavailable experiments for number of clicks in Super Pair Clicks Alert in the experimentation table. - Alexia - Luna + Alexia Luna + Hide non-clickable items in Basket of Seeds, Nether Wart Pouch & Trick or Treat Bag. - Alexia Luna + Added support for blocking quick crafting for the new quick craft UI. - hannibal2 diff --git a/docs/FEATURES.md b/docs/FEATURES.md index d8ef32d1beca..595709575e87 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -182,6 +182,7 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. purse. + Copy Underbid Keybind. - Obsidian + Copies the price of the hovered item in Auction House minus 1 coin into the clipboard for easier under-bidding. ++ Option in the Auction House search browser to search for the item on coflnet.com. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1743) + Gfs message after super crafting. — Zickles + Adding a clickable message to pick up the super crafted items from sacks. + Added Inferno Minion Fuel pickup prevention. - Zickles (https://github.com/hannibal002/SkyHanni/pull/1103) @@ -877,6 +878,7 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. + Amount of chocolate until next prestige to stats display. - seraid (https://github.com/hannibal002/SkyHanni/pull/1638) + Ability to adjust the opacity of players near shared and guessed egg waypoints. - RobotHanzo (https://github.com/hannibal002/SkyHanni/pull/1582) + Time until the next Hoppity event in chat message for egg locator. - seraid (https://github.com/hannibal002/SkyHanni/pull/1625) ++ Warning before the Time Tower in the Chocolate Factory ends. - seraid (https://github.com/hannibal002/SkyHanni/pull/1816)
@@ -1159,6 +1161,9 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. + Inventory background to GUI editor. - seraid (https://github.com/hannibal002/SkyHanni/pull/1622) + Added option to hide item tooltips inside the Harp. - raven (https://github.com/hannibal002/SkyHanni/pull/1700) + Option to Replace Roman Numerals. - Mikecraft1224 (https://github.com/hannibal002/SkyHanni/pull/1722) ++ Simple Ferocity Display. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/1765) + + Shows the Ferocity stat as a single GUI element. + + Requires the Tab List widget to be enabled and Ferocity to be selected to work.
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 623b9000f9ce..683b5bcdfb4e 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -19,6 +19,7 @@ import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.data.CropAccessoryData import at.hannibal2.skyhanni.data.EntityData import at.hannibal2.skyhanni.data.EntityMovementData +import at.hannibal2.skyhanni.data.EventCounter import at.hannibal2.skyhanni.data.FameRanks import at.hannibal2.skyhanni.data.FixedRateTimerManager import at.hannibal2.skyhanni.data.FriendAPI @@ -89,6 +90,7 @@ import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier import at.hannibal2.skyhanni.features.chroma.ChromaManager import at.hannibal2.skyhanni.features.combat.BestiaryData +import at.hannibal2.skyhanni.features.combat.FerocityDisplay import at.hannibal2.skyhanni.features.combat.HideDamageSplash import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker @@ -269,6 +271,8 @@ import at.hannibal2.skyhanni.features.inventory.ShiftClickNPCSell import at.hannibal2.skyhanni.features.inventory.SkyblockGuideHighlightFeature import at.hannibal2.skyhanni.features.inventory.StatsTuning import at.hannibal2.skyhanni.features.inventory.SuperCraftFeatures +import at.hannibal2.skyhanni.features.inventory.auctionhouse.AuctionHouseCopyUnderbidPrice +import at.hannibal2.skyhanni.features.inventory.auctionhouse.AuctionHouseOpenPriceWebsite import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarBestSellMethod import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarCancelledBuyOrderClipboard @@ -361,7 +365,6 @@ import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList import at.hannibal2.skyhanni.features.misc.compacttablist.TabListReader import at.hannibal2.skyhanni.features.misc.compacttablist.TabListRenderer import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager -import at.hannibal2.skyhanni.features.misc.items.AuctionHouseCopyUnderbidPrice import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.features.misc.items.EstimatedWardrobePrice import at.hannibal2.skyhanni.features.misc.items.GlowingDroppedItems @@ -485,7 +488,7 @@ import org.apache.logging.log4j.Logger clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop", - version = "0.25.Beta.25", + version = "0.25", ) class SkyHanniMod { @@ -509,7 +512,7 @@ class SkyHanniMod { loadModule(EntityData()) loadModule(MobData()) loadModule(MobDetection()) - loadModule(EntityMovementData()) + loadModule(EntityMovementData) loadModule(TestExportTools) loadModule(ItemClickData()) // loadModule(Year300RaffleEvent) @@ -523,7 +526,7 @@ class SkyHanniMod { loadModule(RenderData()) loadModule(GardenCropMilestones) loadModule(GardenCropMilestonesCommunityFix) - loadModule(GardenCropUpgrades()) + loadModule(GardenCropUpgrades) loadModule(VisitorListener()) loadModule(VisitorRewardWarning()) loadModule(OwnInventoryData()) @@ -563,6 +566,7 @@ class SkyHanniMod { loadModule(ContributorManager) loadModule(TabComplete) loadModule(HypixelBazaarFetcher) + loadModule(EventCounter) // APIs loadModule(BazaarApi()) @@ -631,6 +635,7 @@ class SkyHanniMod { loadModule(ShiftClickBrewing()) loadModule(BazaarOpenPriceWebsite()) loadModule(AuctionHouseCopyUnderbidPrice()) + loadModule(AuctionHouseOpenPriceWebsite()) loadModule(AnvilCombineHelper()) loadModule(SeaCreatureMessageShortener()) loadModule(AshfangFreezeCooldown) @@ -686,6 +691,7 @@ class SkyHanniMod { loadModule(FireVeilWandParticles()) loadModule(HideMobNames()) loadModule(HideDamageSplash()) + loadModule(FerocityDisplay()) loadModule(InGameDateDisplay()) loadModule(ThunderSparksHighlight()) loadModule(BlazeSlayerDaggerHelper()) @@ -734,7 +740,7 @@ class SkyHanniMod { loadModule(MinionCraftHelper()) loadModule(TpsCounter()) loadModule(ParticleHider()) - loadModule(MiscFeatures()) + loadModule(MiscFeatures) loadModule(ReplaceRomanNumerals()) loadModule(GardenPlotMenuHighlighting()) loadModule(SkyMartCopperPrice()) @@ -924,7 +930,7 @@ class SkyHanniMod { loadModule(GardenInventoryTooltipOverflow()) loadModule(SkillTooltip()) loadModule(MaxPurseItems()) - loadModule(SuperCraftFeatures()) + loadModule(SuperCraftFeatures) loadModule(InfernoMinionFeatures()) loadModule(LimboPlaytime()) loadModule(RareDropMessages()) diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index bcbee1cade1d..e5c9067cdad5 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -203,37 +203,27 @@ object SkillAPI { } @SubscribeEvent - fun onDebugDataCollectCurrent(event: DebugDataCollectEvent) { - event.title("Current Skill") + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Skills") val storage = storage if (storage == null) { event.addIrrelevant("SkillMap is empty") return } - val skillType = activeSkill - if (skillType == null) { - event.addIrrelevant("activeSkill is null") - return - } - - event.addData { - storage[skillType]?.let { skillInfo -> - addDebug(skillType, skillInfo) + event.addIrrelevant { + val activeSkill = activeSkill + if (activeSkill == null) { + add("activeSkill is null") + } else { + add("active skill:") + storage[activeSkill]?.let { skillInfo -> + addDebug(activeSkill, skillInfo) + } + add("") + add("") } - } - } - @SubscribeEvent - fun onDebugDataCollectAll(event: DebugDataCollectEvent) { - event.title("All Skills") - val storage = storage - if (storage == null) { - event.addIrrelevant("SkillMap is empty") - return - } - - event.addIrrelevant { for ((skillType, skillInfo) in storage) { addDebug(skillType, skillInfo) } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 24c85e80c8b4..b8fa95d85e7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.api.SkillAPI import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.config.features.About.UpdateStream -import at.hannibal2.skyhanni.utils.chat.ChatClickActionManager import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.data.GardenCropMilestonesCommunityFix import at.hannibal2.skyhanni.data.GuiEditManager @@ -82,6 +81,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.splitLines import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.chat.ChatClickActionManager import at.hannibal2.skyhanni.utils.chat.Text import at.hannibal2.skyhanni.utils.chat.Text.hover import at.hannibal2.skyhanni.utils.chat.Text.suggest @@ -256,7 +256,7 @@ object Commands { "Resets the Pest Profit Tracker" ) { PestProfitTracker.resetCommand() } registerCommand( - "shresetmythologicalcreatureracker", + "shresetmythologicalcreaturetracker", "Resets the Mythological Creature Tracker" ) { MythologicalCreatureTracker.resetCommand() } registerCommand( @@ -316,7 +316,7 @@ object Commands { registerCommand( "shlimbo", "Warps you to Limbo." - ) { MiscFeatures().goToLimbo() } + ) { MiscFeatures.goToLimbo() } registerCommand( "shlanedetection", "Detect a farming lane in garden" @@ -377,6 +377,10 @@ object Commands { "shpumpkin", "Toggles receiving the 12 fortune from pumpkins" ) { CaptureFarmingGear.reversePumpkinFortune() } + registerCommand( + "shcocoabeans", + "Toggles receiving the 12 fortune from cocoa beans" + ) { CaptureFarmingGear.reverseCocoaBeansFortune() } registerCommand( "shrepostatus", "Shows the status of all the mods constants" @@ -425,6 +429,10 @@ object Commands { "shtestsackapi", "Get the amount of an item in sacks according to internal feature SackAPI" ) { SackAPI.testSackAPI(it) } + registerCommand( + "shtestgriffinspots", + "Show potential griffin spots around you." + ) { GriffinBurrowHelper.testGriffinSpots() } } private fun developersCodingHelp() { diff --git a/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt b/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt index c407de4f284f..e334785c556e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/enums/OutsideSbFeature.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.enums import at.hannibal2.skyhanni.SkyHanniMod +import net.minecraft.client.Minecraft enum class OutsideSbFeature(private val displayName: String) { MODIFY_VISUAL_WORDS("Modify Visual Words"), @@ -21,5 +22,6 @@ enum class OutsideSbFeature(private val displayName: String) { override fun toString() = displayName - fun isSelected() = SkyHanniMod.feature.misc.showOutsideSB.contains(this) + fun isSelected() = + Minecraft.getMinecraft().thePlayer != null && SkyHanniMod.feature.misc.showOutsideSB.contains(this) } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java index d3a97bac7019..83a45c5848c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java @@ -10,6 +10,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorInfoText; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; public class ChromaConfig { @@ -22,7 +23,7 @@ public class ChromaConfig { @ConfigOption(name = "Enabled", desc = "Toggle for SkyHanni's chroma. (Disables Patcher's Optimized Font Renderer while enabled)") @ConfigEditorBoolean @FeatureToggle - public boolean enabled = false; + public Property enabled = Property.of(false); @Expose @ConfigOption(name = "Chroma Size", desc = "Change the size of each color in the chroma.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java index 0504a918dbd0..bf8e795d7074 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java @@ -44,6 +44,11 @@ public class CombatConfig { @Accordion public EnderNodeConfig enderNodeTracker = new EnderNodeConfig(); + @Expose + @ConfigOption(name = "Ferocity Display", desc = "") + @Accordion + public FerocityDisplayConfig ferocityDisplay = new FerocityDisplayConfig(); + @Expose @ConfigOption(name = "Hide Damage Splash", desc = "Hide all damage splashes anywhere in SkyBlock.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java new file mode 100644 index 000000000000..42c8bb9a6d92 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.config.features.combat; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; + +public class FerocityDisplayConfig { + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Show ferocity stat as single gui element. " + + "Requires tab list widget enabled and ferocity selected to work." + ) + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + @ConfigLink(owner = FerocityDisplayConfig.class, field = "enabled") + public Position position = new Position(10, 80, false, true); +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java index 31fed5074ded..04c915ff0bdb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/HoppityEggsConfig.java @@ -5,6 +5,7 @@ import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; @@ -43,6 +44,22 @@ public class HoppityEggsConfig { @FeatureToggle public boolean showClaimedEggs = false; + @Expose + @ConfigOption(name = "Warn When Unclaimed", desc = "Warn when all three eggs are ready to be found.") + @ConfigEditorBoolean + @FeatureToggle + public boolean warnUnclaimedEggs = false; + + @Expose + @ConfigOption(name = "Click to Warp", desc = "Makes the eggs ready chat message clickable to warp you to an island.") + @ConfigEditorBoolean + public boolean warpUnclaimedEggs = false; + + @Expose + @ConfigOption(name = "Warp Destination", desc = "A custom island to warp to in the above option.") + @ConfigEditorText + public String warpDestination = "nucleus"; + @Expose @ConfigOption(name = "Show during Contest", desc = "Show during a farming contest.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java index 56094742853f..39ed3c4ae27b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/ChumBucketHiderConfig.java @@ -12,7 +12,7 @@ public class ChumBucketHiderConfig { @ConfigOption(name = "Enable", desc = "Hide the Chum/Chumcap Bucket name tags for other players.") @ConfigEditorBoolean @FeatureToggle - public Property enabled = Property.of(true); + public Property enabled = Property.of(false); @Expose @ConfigOption(name = "Hide Bucket", desc = "Hide the Chum/Chumcap Bucket.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java index abc256c9732e..9d124f9880a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java @@ -116,7 +116,9 @@ public enum MilestoneTextEntry implements HasLegacyId { MILESTONE_TIER("§7Pumpkin Tier 22", 1), NUMBER_OUT_OF_TOTAL("§e12,300§8/§e100,000", 2), TIME("§7In §b12m 34s", 3), + CROPS_PER_SECOND("§7Crops/Second§8: §e205.75"), CROPS_PER_MINUTE("§7Crops/Minute§8: §e12,345", 4), + CROPS_PER_HOUR("§7Crops/Hour§8: §e740,700"), BLOCKS_PER_SECOND("§7Blocks/Second§8: §e19.85", 5), PERCENTAGE("§7Percentage: §e12.34%", 6), ; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/AuctionHouseConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/AuctionHouseConfig.java index 3725eeb1c228..21108095b62c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/AuctionHouseConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/AuctionHouseConfig.java @@ -49,4 +49,10 @@ public class AuctionHouseConfig { ) @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) public int copyUnderbidKeybind = Keyboard.KEY_NONE; + + @Expose + @ConfigOption(name = "Price Website", desc = "Adds a button to the Auction House that will open the item page in §csky.coflnet.com§7.") + @ConfigEditorBoolean + @FeatureToggle + public boolean openPriceWebsite = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/EnchantParsingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/EnchantParsingConfig.java index a7571291ad9f..132121c45b38 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/EnchantParsingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/EnchantParsingConfig.java @@ -39,7 +39,8 @@ public String toString() { } @Expose - @ConfigOption(name = "Perfect Enchantment Color", desc = "The color an enchantment will be at max level.") + @ConfigOption(name = "Perfect Enchantment Color", desc = "The color an enchantment will be at max level. " + + "§eIf SkyHanni chroma is disabled this will default to §6Gold.") @ConfigEditorDropdown public Property perfectEnchantColor = Property.of(LorenzColor.CHROMA); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java index bacd8aae051a..3f86dfefe044 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java @@ -50,6 +50,7 @@ public class ChocolateFactoryConfig { ChocolateFactoryStat.MULTIPLIER, ChocolateFactoryStat.BARN, ChocolateFactoryStat.TIME_TOWER, + ChocolateFactoryStat.TIME_TOWER_FULL, ChocolateFactoryStat.LEADERBOARD_POS, ChocolateFactoryStat.TIME_TO_BEST_UPGRADE )); @@ -103,12 +104,18 @@ public class ChocolateFactoryConfig { public boolean showDuplicateTime = false; @Expose - @ConfigOption(name = "Time Tower Warning", desc = "Notification when you have a new time tower usage available and " + + @ConfigOption(name = "Time Tower Usage Warning", desc = "Notification when you have a new time tower usage available and " + "continuously warn when your time tower is full.") @ConfigEditorBoolean @FeatureToggle public boolean timeTowerWarning = false; + @Expose + @ConfigOption(name = "Time Tower Reminder", desc = "Notification a minute before the time tower ends.") + @ConfigEditorBoolean + @FeatureToggle + public boolean timeTowerReminder = true; + @Expose @ConfigOption(name = "Upgrade Warnings", desc = "") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java index f77e528645fc..7e11ce6f9856 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateUpgradeWarningsConfig.java @@ -11,7 +11,7 @@ public class ChocolateUpgradeWarningsConfig { @ConfigOption(name = "Upgrade Warning", desc = "Chat notification when you have a chocolate factory upgrade available to purchase.") @ConfigEditorBoolean @FeatureToggle - public boolean upgradeWarning = true; + public boolean upgradeWarning = false; @Expose @ConfigOption(name = "Upgrade Warning Sound", desc = "Also plays a sound when an upgrade is available. " + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java index 1e1fef454861..81eeb2b1abc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningEventConfig.java @@ -15,7 +15,7 @@ public class MiningEventConfig { "also enables you sending data. §eTakes up to a minute to sync new events.") @ConfigEditorBoolean @FeatureToggle - public boolean enabled = true; + public boolean enabled = false; @Expose @ConfigOption(name = "Show Outside Mining Islands", desc = "Shows the event tracker when you are not inside of the Dwarven Mines or Crystal Hollows.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index 6e665161924d..bb7596cae3b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -345,6 +345,9 @@ public static class Fortune { @Expose public boolean pumpkinFortune = false; + @Expose + public boolean cocoaBeansFortune = false; + @Expose public Map farmingItems = new HashMap<>(); } diff --git a/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt b/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt index c43fe9ad08e9..32a2ee17d032 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BlockData.kt @@ -10,7 +10,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BlockData { @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onBlockReceivePacket(event: PacketEvent.ReceiveEvent) { + @Suppress("USELESS_ELVIS") val packet = event.packet ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index 8d1b836dffec..4cc5f840da3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzUtils.derpy @@ -35,6 +36,13 @@ class EntityData { } } + @SubscribeEvent + fun onSecondPassed(event: SecondPassedEvent) { + if (event.repeatSeconds(30)) { + maxHealthMap.keys.removeIf { it.isDead } + } + } + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { maxHealthMap.clear() diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt index 97039022ace9..17bf953c9875 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityMovementData.kt @@ -15,16 +15,18 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.Entity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class EntityMovementData { +object EntityMovementData { - companion object { + private val warpingPattern by RepoPattern.pattern( + "data.entity.warping", + "§7(?:Warping|Warping you to your SkyBlock island|Warping using transfer token|Finding player|Sending a visit request)\\.\\.\\." + ) - private val entityLocation = mutableMapOf() + private val entityLocation = mutableMapOf() - fun addToTrack(entity: Entity) { - if (entity !in entityLocation) { - entityLocation[entity] = entity.getLorenzVec() - } + fun addToTrack(entity: Entity) { + if (entity !in entityLocation) { + entityLocation[entity] = entity.getLorenzVec() } } @@ -46,15 +48,6 @@ class EntityMovementData { } } - private val warpingPattern by RepoPattern.pattern( - "warping", - "§7Warping...|" + - "§7Warping you to your SkyBlock island...|" + - "§7Warping using transfer token...|" + - "§7Finding player...|" + - "§7Sending a visit request..." - ) - @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt index f7a730a651d5..28f1e254b3b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EventCounter.kt @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object EventCounter { @@ -14,8 +16,15 @@ object EventCounter { private var map = mutableMapOf() private var lastUpdate = SimpleTimeMark.farPast() + private var enabled = false + + @SubscribeEvent + fun onSecondPassed(event: SecondPassedEvent) { + enabled = LorenzUtils.onHypixel && config.eventCounter + } + fun count(eventName: String) { - if (!isEnabled()) return + if (!enabled) return map.addOrPut(eventName, 1) @@ -42,6 +51,4 @@ object EventCounter { println("") println("total: ${total.addSeparators()}") } - - private fun isEnabled() = LorenzUtils.onHypixel && config.eventCounter } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt index e6c810852db6..5a131ae79bbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropUpgrades.kt @@ -1,52 +1,60 @@ package at.hannibal2.skyhanni.data -import at.hannibal2.skyhanni.events.CropUpgradeUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.garden.CropType -import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.NumberUtil.formatInt +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenCropUpgrades { +object GardenCropUpgrades { - // TODO USE SH-REPO - private val tierPattern = "§7Current Tier: §[0-9a-e](\\d)§7/§a9".toRegex() - private val chatUpgradePattern = " {2}§r§6§lCROP UPGRADE §e§f([\\w ]+)§7 #(\\d)".toRegex() + private val patternGroup = RepoPattern.group("garden.cropupgrades") + private val tierPattern by patternGroup.pattern( + "tier", + "§7Current Tier: §.(?\\d)§7/§a9" + ) + private val chatUpgradePattern by patternGroup.pattern( + "chatupgrade", + "\\s+§r§6§lCROP UPGRADE §e(?[\\w ]+)§7 #(?\\d)" + ) + + private val cropUpgrades: MutableMap? get() = GardenAPI.storage?.cropUpgrades @SubscribeEvent fun onChat(event: LorenzChatEvent) { - chatUpgradePattern.matchEntire(event.message)?.groups?.let { matches -> - val crop = getByNameOrNull(matches[1]!!.value) ?: return - val level = matches[2]!!.value.toInt() - crop.setUpgradeLevel(level) + if (!GardenAPI.inGarden()) return + + chatUpgradePattern.matchMatcher(event.message) { + val crop = CropType.getByNameOrNull(group("crop")) + val level = group("tier").formatInt() + crop?.setUpgradeLevel(level) } - CropUpgradeUpdateEvent().postAndCatch() } @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { + if (!GardenAPI.inGarden()) return if (event.inventoryName != "Crop Upgrades") return - event.inventoryItems.forEach { (_, item) -> - val crop = CropType.getByNameOrNull(item.name.removeColor()) ?: return@forEach - val level = item.getLore() - .firstNotNullOfOrNull { tierPattern.matchEntire(it)?.groups?.get(1)?.value?.toIntOrNull() } ?: 0 - crop.setUpgradeLevel(level) + + for (item in event.inventoryItems.values) { + val crop = CropType.getByNameOrNull(item.name.removeColor()) ?: continue + item.getLore().matchFirst(tierPattern) { + val level = group("level").formatInt() + crop.setUpgradeLevel(level) + } } - CropUpgradeUpdateEvent().postAndCatch() } - companion object { + fun CropType.getUpgradeLevel() = cropUpgrades?.get(this) - private val cropUpgrades: MutableMap? get() = GardenAPI.storage?.cropUpgrades - - fun CropType.getUpgradeLevel() = cropUpgrades?.get(this) - - fun CropType.setUpgradeLevel(level: Int) { - cropUpgrades?.put(this, level) - } + private fun CropType.setUpgradeLevel(level: Int) { + cropUpgrades?.put(this, level) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 765a51e95447..af68cd84733e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -24,6 +24,7 @@ import net.minecraft.client.gui.inventory.GuiInventory import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.opengl.GL11 import java.util.UUID import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.minutes @@ -54,7 +55,7 @@ class GuiEditManager { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { GlStateManager.color(1f, 1f, 1f, 1f) GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 3409920e3d9d..0d53ed8e17c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -185,7 +185,9 @@ class HypixelData { return when (skyBlockIsland) { IslandType.MINESHAFT -> 4 + IslandType.CATACOMBS -> 5 IslandType.CRYSTAL_HOLLOWS -> 24 + IslandType.CRIMSON_ISLE -> 24 else -> if (serverId?.startsWith("mega") == true) 80 else 26 } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt index 498d87d10b87..386f90965379 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt @@ -6,11 +6,14 @@ import at.hannibal2.skyhanni.events.ItemAddEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.SackChangeEvent import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent +import at.hannibal2.skyhanni.features.inventory.SuperCraftFeatures.craftedPattern import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds @@ -57,11 +60,12 @@ class ItemAddManager { for (sackChange in event.sackChanges) { val change = sackChange.delta - if (change > 0) { - val internalName = sackChange.internalName + val internalName = sackChange.internalName + if (change > 0 && internalName !in superCraftedItems) { Source.SACKS.addItem(internalName, change) } } + superCraftedItems.clear() } @SubscribeEvent @@ -83,11 +87,17 @@ class ItemAddManager { } private var lastDiceRoll = SimpleTimeMark.farPast() + private var superCraftedItems = TimeLimitedSet(30.seconds) @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (diceRollChatPattern.matches(event.message)) { lastDiceRoll = SimpleTimeMark.now() } + craftedPattern.matchMatcher(event.message) { + val internalName = NEUInternalName.fromItemName(group("item")) + if (!SackAPI.sackListInternalNames.contains(internalName.asString())) return@matchMatcher + superCraftedItems.add(internalName) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt index cfe08927e349..776580602d95 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OtherInventoryData.kt @@ -37,7 +37,7 @@ object OtherInventoryData { } @SubscribeEvent - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onInventoryDataReceiveEvent(event: PacketEvent.ReceiveEvent) { val packet = event.packet if (packet is S2EPacketCloseWindow) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index dc158c118f2d..18bf5629c9d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -38,7 +38,7 @@ class OwnInventoryData { ) @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onItemPickupReceivePacket(event: PacketEvent.ReceiveEvent) { if (!LorenzUtils.inSkyBlock) return val packet = event.packet diff --git a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt index af921f22ba2f..c40b291e6cf8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/QuiverAPI.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.data.jsonobjects.repo.ArrowTypeJson -import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -9,7 +8,6 @@ import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.QuiverUpdateEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemCategory import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName @@ -45,14 +43,20 @@ object QuiverAPI { storage?.arrows?.arrowAmount = value } var currentAmount: Int - get() = arrowAmount[currentArrow?.internalName]?.toInt() ?: 0 + get() = currentArrow?.amount ?: 0 set(value) { - arrowAmount[currentArrow?.internalName ?: return] = value + currentArrow?.amount = value + } + var ArrowType.amount: Int + get() = arrowAmount[this.internalName] ?: 0 + set(value) { + arrowAmount[this.internalName] = value } private var arrows: List = listOf() - private var wearingSkeletonMasterChestplate = false + var wearingSkeletonMasterChestplate = false + private set private var hasBow = false const val MAX_ARROW_AMOUNT = 2880 @@ -107,7 +111,7 @@ object QuiverAPI { "Unknown arrow type: $type", "message" to message, ) - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() return } @@ -119,8 +123,8 @@ object QuiverAPI { "Unknown arrow type: $type", "message" to message, ) - arrowAmount[ranOutType.internalName] = 0 - QuiverUpdateEvent(ranOutType, currentAmount, shouldHideAmount()).postAndCatch() + ranOutType.amount = 0 + postUpdateEvent(ranOutType) } fillUpJaxPattern.matchMatcher(message) { @@ -133,21 +137,19 @@ object QuiverAPI { "message" to message, ) - arrowAmount.addOrPut(filledUpType.internalName, amount) + filledUpType.amount += amount if (filledUpType == currentArrow) { - QuiverUpdateEvent(filledUpType, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } return - } fillUpPattern.matchMatcher(message) { val flintAmount = group("flintAmount").formatInt() - FLINT_ARROW_TYPE?.let { arrowAmount.addOrPut(it.internalName, flintAmount) } - + FLINT_ARROW_TYPE?.let { it.amount += flintAmount } if (currentArrow == FLINT_ARROW_TYPE) { - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } return } @@ -155,7 +157,6 @@ object QuiverAPI { addedToQuiverPattern.matchMatcher(message) { val type = group("type") val amount = group("amount").formatInt() - val filledUpType = getArrowByNameOrNull(type) ?: return ErrorManager.logErrorWithData( UnknownArrowType("Unknown arrow type: $type"), @@ -163,9 +164,9 @@ object QuiverAPI { "message" to message, ) - arrowAmount.addOrPut(filledUpType.internalName, amount) + filledUpType.amount += amount if (filledUpType == currentArrow) { - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } return } @@ -174,7 +175,7 @@ object QuiverAPI { currentAmount = 0 arrowAmount.clear() - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() return } @@ -182,7 +183,7 @@ object QuiverAPI { currentArrow = NONE_ARROW_TYPE currentAmount = 0 - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() return } } @@ -201,8 +202,7 @@ object QuiverAPI { if (stack.getItemCategoryOrNull() != ItemCategory.ARROW) continue val arrow = stack.getInternalNameOrNull() ?: continue val arrowType = getArrowByNameOrNull(arrow) ?: continue - - arrowAmount.addOrPut(arrowType.internalName, stack.stackSize) + arrowType.amount += stack.stackSize } } @@ -224,7 +224,7 @@ object QuiverAPI { if (currentArrowType != currentArrow || amount != currentAmount) { currentArrow = currentArrowType currentAmount = amount - QuiverUpdateEvent(currentArrowType, amount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } } } @@ -253,8 +253,6 @@ object QuiverAPI { fun isEnabled() = LorenzUtils.inSkyBlock && storage != null - private fun shouldHideAmount() = wearingSkeletonMasterChestplate - private fun checkBowInventory() { hasBow = InventoryUtils.getItemsInOwnInventory().any { it.item is ItemBow && !fakeBowsPattern.matches(it.getInternalName().asString()) @@ -266,10 +264,14 @@ object QuiverAPI { wearingSkeletonMasterChestplate = InventoryUtils.getChestplate()?.getInternalName() == SKELETON_MASTER_CHESTPLATE if (wasWearing != wearingSkeletonMasterChestplate) { - QuiverUpdateEvent(currentArrow, currentAmount, shouldHideAmount()).postAndCatch() + postUpdateEvent() } } + private fun postUpdateEvent(arrowType: ArrowType? = currentArrow) { + QuiverUpdateEvent(arrowType, currentAmount).postAndCatch() + } + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return @@ -282,9 +284,6 @@ object QuiverAPI { // Load arrows from repo @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val itemData = event.getConstant("Items") - infinityQuiverLevelMultiplier = itemData.enchant_multiplier["infinite_quiver"] ?: 0.03f - val arrowData = event.getConstant("ArrowTypes") arrows = arrowData.arrows.map { ArrowType(it.value.arrow, it.key.asInternalName()) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index 0bd1e6866c73..4c021929b71e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -1,10 +1,13 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.ScoreboardChangeEvent import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent import at.hannibal2.skyhanni.utils.StringUtils.matches import net.minecraft.client.Minecraft +import net.minecraft.network.play.server.S3CPacketUpdateScore +import net.minecraft.network.play.server.S3EPacketTeams import net.minecraft.scoreboard.Score import net.minecraft.scoreboard.ScorePlayerTeam import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -66,8 +69,26 @@ class ScoreboardData { var objectiveTitle = "" } + var dirty = false + + @SubscribeEvent(receiveCanceled = true) + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { + if (event.packet is S3CPacketUpdateScore) { + if (event.packet.objectiveName == "update") { + dirty = true + } + } + if (event.packet is S3EPacketTeams) { + if (event.packet.name.startsWith("team_")) { + dirty = true + } + } + } + @SubscribeEvent(priority = EventPriority.HIGHEST) fun onTick(event: LorenzTickEvent) { + if (!dirty) return + dirty = false val list = fetchScoreboardLines().reversed() val semiFormatted = list.map { cleanSB(it) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 5f92da7ae512..ec62adda023e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -98,10 +98,8 @@ object SlayerAPI { private fun grabActiveSlayer(): SlayerType? { for (line in ScoreboardData.sidebarLinesFormatted) { - for (type in SlayerType.entries) { - if (line.contains(type.displayName)) { - return type - } + SlayerType.getByName(line)?.let { + return it } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt index a2652404fb98..af3683402391 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/TitleManager.kt @@ -9,6 +9,7 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.opengl.GL11 import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -66,7 +67,7 @@ class TitleManager { val height = scaledResolution.scaledHeight GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) val renderer = Minecraft.getMinecraft().fontRendererObj GlStateManager.pushMatrix() diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt index 2cb70f857f7c..cd9465264362 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt @@ -62,6 +62,11 @@ object HypixelBazaarFetcher { val internalName = NEUItems.transHypixelNameToInternalName(key) val sellOfferPrice = product.buySummary.minOfOrNull { it.pricePerUnit } ?: 0.0 val insantBuyPrice = product.sellSummary.maxOfOrNull { it.pricePerUnit } ?: 0.0 + + if (product.quickStatus.isEmpty()) { + return@mapNotNull null + } + if (internalName.getItemStackOrNull() == null) { // Items that exist in Hypixel's Bazaar API, but not in NEU repo (not visible in in the ingame bazaar). // Should only include Enchants @@ -72,6 +77,17 @@ object HypixelBazaarFetcher { internalName to BazaarData(internalName.itemName, sellOfferPrice, insantBuyPrice, product) }.toMap() + private fun BazaarQuickStatus.isEmpty(): Boolean = with(this) { + sellPrice == 0.0 && + sellVolume == 0L && + sellMovingWeek == 0L && + sellOrders == 0L && + buyPrice == 0.0 && + buyVolume == 0L && + buyMovingWeek == 0L && + buyOrders == 0L + } + private fun onError(fetchType: String, e: Exception, rawResponse: String? = null) { val userMessage = "Failed fetching bazaar price data from hypixel" failedAttempts++ diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt index c19fa4a42fde..023589e0f090 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerChatManager.kt @@ -96,7 +96,7 @@ class PlayerChatManager { */ private val privateIslandRankPattern by patternGroup.pattern( "privateislandrank", - "(?.*?)(?§.\\[(?!MVP(§.\\++)?§.]|VIP\\+*|YOU§.TUBE|ADMIN|MOD|GM)[^]]+\\])(?.*)" + "(?.*?)(?§.\\[(?!MVP(§.\\++)?§.]|VIP\\+*|YOU§.TUBE|ADMIN|MOD|GM)[^]]+\\]) (?.*)" ) /** diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt index 035a166bbc8c..b617fd1185d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt @@ -13,8 +13,10 @@ import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.features.misc.compacttablist.AdvancedPlayerList +import at.hannibal2.skyhanni.utils.ChatUtils.changeColor import at.hannibal2.skyhanni.utils.ComponentMatcherUtils.matchStyledMatcher import at.hannibal2.skyhanni.utils.ComponentSpan +import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.applyFormattingFrom @@ -83,7 +85,7 @@ class PlayerNameFormatter { if (!isEnabled()) return event.chatComponent = StringUtils.replaceIfNeeded( event.chatComponent, - Text.text("§bCo-Op > ") { + Text.text("§bCo-op > ") { appendSibling(nameFormat(event.authorComponent)) appendText("§f: ") appendSibling(event.messageComponent.intoComponent()) @@ -140,7 +142,10 @@ class PlayerNameFormatter { level = event.levelComponent ) ) - appendSibling(event.action.intoComponent()) + + appendText(" ") + appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY)) + appendText(" ") appendSibling(event.item.intoComponent()) }) ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt index 4a9323ae20b2..3d8b00b70bec 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt @@ -19,6 +19,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityZombie import net.minecraft.util.AxisAlignedBB import java.awt.Color +import java.util.UUID /** * Represents a Mob in Hypixel Skyblock. @@ -56,6 +57,7 @@ import java.awt.Color * Gives back the second additional armor stand. * * (should be called in the [MobEvent.Spawn] since it is a lazy) + * @property id Unique identifier for each Mob instance */ class Mob( var baseEntity: EntityLivingBase, @@ -69,6 +71,8 @@ class Mob( val levelOrTier: Int = -1, ) { + private val id: UUID = UUID.randomUUID() + val owner: MobUtils.OwnerShip? val hologram1Delegate = lazy { MobUtils.getArmorStand(armorStand ?: baseEntity, 1) } @@ -200,16 +204,14 @@ class Mob( } } - override fun hashCode() = baseEntity.hashCode() + override fun hashCode() = id.hashCode() override fun toString(): String = "$name - ${baseEntity.entityId}" override fun equals(other: Any?): Boolean { if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Mob + if (other !is Mob) return false - return baseEntity == other.baseEntity + return id == other.id } } diff --git a/src/main/java/at/hannibal2/skyhanni/events/CropUpgradeUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/CropUpgradeUpdateEvent.kt deleted file mode 100644 index 3deccc74c4df..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/events/CropUpgradeUpdateEvent.kt +++ /dev/null @@ -1,3 +0,0 @@ -package at.hannibal2.skyhanni.events - -class CropUpgradeUpdateEvent : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/QuiverUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/QuiverUpdateEvent.kt index a084a1741553..d0c0e5b0b1ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/QuiverUpdateEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/QuiverUpdateEvent.kt @@ -2,4 +2,4 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.data.ArrowType -class QuiverUpdateEvent(val currentArrow: ArrowType?, val currentAmount: Int, val hideAmount: Boolean) : LorenzEvent() +class QuiverUpdateEvent(val currentArrow: ArrowType?, val currentAmount: Int) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index d598919023c7..c02a769e5766 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -352,7 +352,8 @@ class ChatFilter { private val factoryUpgradePatterns = listOf( "§.* §r§7has been promoted to §r§7\\[.*§r§7] §r§.*§r§7!".toPattern(), "§7Your §r§aRabbit Barn §r§7capacity has been increased to §r§a.* Rabbits§r§7!".toPattern(), - "§7You will now produce §r§6.* Chocolate §r§7per click!".toPattern() + "§7You will now produce §r§6.* Chocolate §r§7per click!".toPattern(), + "§7You upgraded to §r§d.*?§r§7!".toPattern(), ) private val powderMiningMessages = listOf( "§aYou uncovered a treasure chest!", diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index c80573e32fd3..22f60e1ff387 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -25,9 +25,11 @@ import at.hannibal2.skyhanni.utils.NumberUtil.toRoman import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraft.init.Items import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -36,6 +38,25 @@ object BestiaryData { private val config get() = SkyHanniMod.feature.combat.bestiary private val patternGroup = RepoPattern.group("combat.bestiary.data") + + /** + * REGEX-TEST: §7Progress to Tier 14: §b26% + * REGEX-TEST: §7Progress to Tier XV: §b57.1% + */ + private val tierProgressPattern by patternGroup.pattern( + "tierprogress", + "§7Progress to Tier [\\dIVXC]+: §b[\\d.]+%" + ) + + /** + * REGEX-TEST: §7Overall Progress: §b55.2% + * REGEX-TEST: §7Overall Progress: §b100% §7(§c§lMAX!§7) + */ + private val overallProgressPattern by patternGroup.pattern( + "overallprogress", + "§7Overall Progress: §b[\\d.]+%(?: §7\\(§c§lMAX!§7\\))?" + ) + private val progressPattern by patternGroup.pattern( "progress", "(?[0-9kKmMbB,.]+)/(?[0-9kKmMbB,.]+\$)" @@ -97,7 +118,7 @@ object BestiaryData { isCategory = inventoryName == "Bestiary ➜ Fishing" || inventoryName == "Bestiary" stackList.putAll(items) inInventory = true - overallProgressEnabled = items[52]?.getLore()?.any { it == "§7Overall Progress: §aSHOWN" } ?: false + overallProgressEnabled = isOverallProgressEnabled(items) update() } @@ -384,6 +405,21 @@ object BestiaryData { } } + private fun isOverallProgressEnabled(inventoryItems: Map): Boolean { + if (inventoryItems[52]?.item == Items.ender_eye) { + return inventoryItems[52]?.getLore()?.any { it == "§7Overall Progress: §aSHOWN" } == true + } + + indexes.forEach { index -> + val item = inventoryItems[index] ?: return true + val hasTierProgress = item.getLore().any { tierProgressPattern.matches(it) } + val hasOverallProgress = item.getLore().any { overallProgressPattern.matches(it) } + if (hasTierProgress && !hasOverallProgress) return false + } + + return true + } + private fun isBestiaryGui(stack: ItemStack?, name: String): Boolean { if (stack == null) return false val bestiaryGuiTitleMatcher = titlePattern.matcher(name) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt new file mode 100644 index 000000000000..c589922cf4be --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt @@ -0,0 +1,45 @@ +package at.hannibal2.skyhanni.features.combat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class FerocityDisplay { + private val config get() = SkyHanniMod.feature.combat.ferocityDisplay + + /** + * REGEX-TEST: Ferocity: §r§c⫽14 + */ + private val ferocityPattern by RepoPattern.pattern( + "combat.ferocity.tab", + " Ferocity: §r§c⫽(?.*)" + ) + + private var display = "" + + @SubscribeEvent + fun onTabListUpdate(event: TabListUpdateEvent) { + if (!isEnabled()) return + display = "" + val stat = event.tabList.matchFirst(ferocityPattern) { + group("stat") + } ?: return + + display = "§c⫽$stat" + + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent) { + if (!isEnabled()) return + + config.position.renderString(display, posLabel = "Ferocity Display") + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt index d84f4eeaab1c..98b56fd831de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt @@ -79,7 +79,7 @@ class SpawnTimers { // All this to detect "quickspawn" vs regular arachne spawn @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!saveNextTickParticles) return if (System.currentTimeMillis() <= searchTime + 3000) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt index 3ff3fa59f7cd..005d9b8f104e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.BurrowDetectEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzVec @@ -16,12 +17,18 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object AllBurrowsList { private var list = listOf() private val config get() = SkyHanniMod.feature.event.diana.allBurrowsList - private val burrowLocations get() = SkyHanniMod.feature.storage?.foundDianaBurrowLocations + private var burrowLocations + get() = SkyHanniMod.feature.storage?.foundDianaBurrowLocations + set(value) { + SkyHanniMod.feature.storage?.foundDianaBurrowLocations = value + } @SubscribeEvent fun onBurrowDetect(event: BurrowDetectEvent) { if (!isEnabled()) return - burrowLocations?.add(event.burrowLocation) + burrowLocations = burrowLocations?.editCopy { + add(event.burrowLocation) + } } @SubscribeEvent @@ -52,15 +59,20 @@ object AllBurrowsList { var new = 0 var duplicate = 0 + val newEntries = mutableListOf() for (raw in text.split(";")) { val location = LorenzVec.decodeFromString(raw) if (location !in burrowLocations) { - burrowLocations.add(location) + newEntries.add(location) new++ } else { duplicate++ } } + AllBurrowsList.burrowLocations = burrowLocations.editCopy { + addAll(newEntries) + } + ChatUtils.chat("Added $new new burrow locations, $duplicate are duplicate.") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt new file mode 100644 index 000000000000..04de77ce9c0d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt @@ -0,0 +1,121 @@ +package at.hannibal2.skyhanni.features.event.diana + +import at.hannibal2.skyhanni.data.ClickType +import at.hannibal2.skyhanni.events.BurrowGuessEvent +import at.hannibal2.skyhanni.events.ItemClickEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent +import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade +import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds + +class DianaFixChat { + + private var hasSetParticleQuality = false + private var hasSetToggleMusic = false + private var lastParticleQualityPrompt = SimpleTimeMark.farPast() + private var lastToggleMusicPrompt = SimpleTimeMark.farPast() + private var errorCounter = 0 + + private var lastSpadeUse = SimpleTimeMark.farPast() + private var lastErrorTime = SimpleTimeMark.farPast() + private var foundGuess = false + + @SubscribeEvent + fun onSecondPassed(event: SecondPassedEvent) { + if (!isEnabled()) return + if (lastSpadeUse.passedSince() > 1.minutes) return + + if (foundGuess) { + lastErrorTime = SimpleTimeMark.farPast() + return + } + // particles dont work if a valid target point is close + if (GriffinBurrowHelper.targetLocation != null) return + val spadeUse = lastSpadeUse.passedSince() + if (spadeUse <= 3.seconds) return + + if (lastErrorTime == lastSpadeUse) return + lastErrorTime = lastSpadeUse + + noGuessFound() + } + + private fun noGuessFound() { + errorCounter++ + if (errorCounter == 1) { + ChatUtils.chat("Could not find Diana Guess using sound and particles, please try again. (Was this a funny sound easter egg?)") + return + } + + println("error") + if (!hasSetParticleQuality) { + if (lastParticleQualityPrompt.passedSince() > 30.seconds) { + lastParticleQualityPrompt = SimpleTimeMark.now() + ChatUtils.clickableChat( + "§cError detecting Diana Guess! §eClick here to set the particle quality to high!", + onClick = { + hasSetParticleQuality = true + HypixelCommands.particleQuality("high") + errorCounter = 0 + ChatUtils.chat("Now try again!") + }) + } + } else { + if (!hasSetToggleMusic) { + if (lastToggleMusicPrompt.passedSince() > 30.seconds) { + lastToggleMusicPrompt = SimpleTimeMark.now() + ChatUtils.clickableChat( + "§cError detecting Diana Guess! Changing the Particle Quality has not worked :( " + + "§eClick here to disable hypixel music!", + onClick = { + hasSetToggleMusic = true + HypixelCommands.toggleMusic() + errorCounter = 0 + ChatUtils.chat("Now try again, please!") + }) + } + } else { + ErrorManager.logErrorStateWithData( + "Could not find diana guess point", + "diana guess point failed to load after /pq and /togglemusic", + "errorCounter" to errorCounter + ) + } + } + } + + @SubscribeEvent + fun onItemClick(event: ItemClickEvent) { + if (!isEnabled()) return + if (event.clickType != ClickType.RIGHT_CLICK) return + val item = event.itemInHand ?: return + if (!item.isDianaSpade) return + + if (lastSpadeUse.passedSince() > 5.seconds) { + lastSpadeUse = SimpleTimeMark.now() + foundGuess = false + } + } + + @SubscribeEvent + fun onBurrowGuess(event: BurrowGuessEvent) { + foundGuess = true + + if (hasSetToggleMusic) { + ChatUtils.chat("Toggling the hypixel music has worked, good job!") + } else if (hasSetParticleQuality) { + ChatUtils.chat("Changing the particle qualilty has worked, good job!") + } + + hasSetParticleQuality = false + hasSetToggleMusic = false + errorCounter = 0 + } + + private fun isEnabled() = DianaAPI.isDoingDiana() +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 7fd5cde549bf..c1485bcad792 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -14,10 +14,11 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.EntityMoveEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.event.diana.DianaAPI.isDianaSpade import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt +import at.hannibal2.skyhanni.utils.BlockUtils.isInLoadedChunk import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.DelayedRun @@ -35,6 +36,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeUtils.format +import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft import net.minecraft.init.Blocks import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -45,12 +47,27 @@ object GriffinBurrowHelper { private val config get() = SkyHanniMod.feature.event.diana + private val allowedBlocksAboveGround = + listOf( + Blocks.air, + Blocks.leaves, + Blocks.leaves2, + Blocks.tallgrass, + Blocks.double_plant, + Blocks.red_flower, + Blocks.yellow_flower, + Blocks.spruce_fence + ) + var targetLocation: LorenzVec? = null private var guessLocation: LorenzVec? = null private var particleBurrows = mapOf() var lastTitleSentTime = SimpleTimeMark.farPast() private var shouldFocusOnInquis = false + private var testList = listOf() + private var testGriffinSpots = false + @SubscribeEvent fun onDebugDataCollect(event: DebugDataCollectEvent) { event.title("Griffin Burrow Helper") @@ -71,11 +88,28 @@ object GriffinBurrowHelper { } @SubscribeEvent - fun onTick(event: LorenzTickEvent) { + fun onSecondPassed(event: SecondPassedEvent) { if (!isEnabled()) return - if (!event.repeatSeconds(1)) return - update() + loadTestGriffinSpots() + } + + fun testGriffinSpots() { + testGriffinSpots = !testGriffinSpots + val state = if (testGriffinSpots) "§aenabled" else "§cdisabled" + ChatUtils.chat("Test Griffin Spots $state§e.") + } + + private fun loadTestGriffinSpots() { + if (!testGriffinSpots) return + val center = LocationUtils.playerLocation().toBlockPos().toLorenzVec() + val list = mutableListOf() + for (x in -5 until 5) { + for (z in -5 until 5) { + list.add(findBlock(center.add(x, 0, z))) + } + } + testList = list } fun update() { @@ -166,7 +200,9 @@ object GriffinBurrowHelper { GriffinBurrowParticleFinder.reset() BurrowWarpHelper.currentWarp = null - update() + if (isEnabled()) { + update() + } } @SubscribeEvent @@ -175,31 +211,57 @@ object GriffinBurrowHelper { } private fun findBlock(point: LorenzVec): LorenzVec { - var gY = 131.0 - - var searchGrass = true - while ((if (searchGrass) LorenzVec(point.x, gY, point.z).getBlockAt() != Blocks.grass else LorenzVec( - point.x, - gY, - point.z - ).getBlockAt() == Blocks.air) - ) { + if (!point.isInLoadedChunk()) { + return point.copy(y = LocationUtils.playerLocation().y) + } + findGround(point)?.let { + return it + } + + return findBlockBelowAir(point) + } + + private fun findGround(point: LorenzVec): LorenzVec? { + fun isValidGround(y: Double): Boolean { + val isGround = point.copy(y = y).getBlockAt() == Blocks.grass + val isValidBlockAbove = point.copy(y = y + 1).getBlockAt() in allowedBlocksAboveGround + return isGround && isValidBlockAbove + } + + var gY = 140.0 + while (!isValidGround(gY)) { gY-- - if (gY < 70) { - if (!searchGrass) { - break - } else { - searchGrass = false - gY = 131.0 - } + if (gY < 65) { + // no ground detected, find lowest block below air + return null + } + } + return point.copy(y = gY) + } + + private fun findBlockBelowAir(point: LorenzVec): LorenzVec { + val start = 65.0 + var gY = start + while (point.copy(y = gY).getBlockAt() != Blocks.air) { + gY++ + if (gY > 140) { + // no blocks at this spot, assuming outside of island + return point.copy(y = LocationUtils.playerLocation().y) } } - return LorenzVec(point.x, gY, point.z) + + if (gY == start) { + return point.copy(y = LocationUtils.playerLocation().y) + } + return point.copy(y = gY - 1) } @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return + + showTestLocations(event) + showWarpSuggestions() val playerLocation = LocationUtils.playerLocation() @@ -279,6 +341,13 @@ object GriffinBurrowHelper { } } + private fun showTestLocations(event: LorenzRenderWorldEvent) { + if (!testGriffinSpots) return + for (location in testList) { + event.drawColor(location, LorenzColor.WHITE) + } + } + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "diana", "event.diana") diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index 12228a7c963e..fc43cdd9563e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -56,7 +56,7 @@ object GriffinBurrowParticleFinder { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!isEnabled()) return if (!config.burrowsSoopyGuess) return val packet = event.packet diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index ef1a58c55f9e..7e06240c3aec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -41,7 +41,7 @@ object InquisitorWaypointShare { */ private val partyOnlyCoordsPattern by patternGroup.pattern( "party.onlycoords", - "(?§9Party §8> )?(?.+)§f: §rx: (?[^ ]+),? y: (?[^ ]+),? z: (?[^ ]+)" + "(?§9Party §8> )?(?.+)§f: §rx: (?[^ ,]+),? y: (?[^ ,]+),? z: (?[^ ,]+)" ) //Support for https://www.chattriggers.com/modules/v/inquisitorchecker diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index c382e227ec29..8ee19dda846a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -11,12 +11,16 @@ import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactor import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow +import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.now import at.hannibal2.skyhanni.utils.SkyBlockTime +import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -57,6 +61,10 @@ object HoppityEggsManager { private var lastMeal: HoppityEggType? = null private var lastNote: String? = null + // has claimed all eggs at least once + private var warningActive = false + private var lastWarnTime = SimpleTimeMark.farPast() + @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { lastMeal = null @@ -67,6 +75,19 @@ object HoppityEggsManager { fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return + hoppityEventNotOn.matchMatcher(event.message) { + val currentYear = SkyBlockTime.now().year + + if (config.timeInChat) { + val timeUntil = SkyBlockTime(currentYear + 1).asTimeMark().timeUntil() + ChatUtils.chat("§eHoppity's Hunt is not active. The next Hoppity's Hunt is in §b${timeUntil.format()}§e.") + event.blockedReason = "hoppity_egg" + } + return + } + + if (!ChocolateFactoryAPI.isHoppityEvent()) return + eggFoundPattern.matchMatcher(event.message) { HoppityEggLocator.eggFound() val meal = getEggType(event) @@ -102,17 +123,6 @@ object HoppityEggsManager { getEggType(event).markSpawned() return } - - hoppityEventNotOn.matchMatcher(event.message) { - val currentYear = SkyBlockTime.now().year - - if (config.timeInChat) { - val timeUntil = SkyBlockTime(currentYear + 1).asTimeMark().timeUntil() - ChatUtils.chat("§eHoppity's Hunt is not active. The next Hoppity's Hunt is in §b${timeUntil.format()}§e.") - event.blockedReason = "hoppity_egg" - } - return - } } internal fun Matcher.getEggType(event: LorenzChatEvent): HoppityEggType = @@ -143,9 +153,9 @@ object HoppityEggsManager { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!isActive()) return if (!config.showClaimedEggs) return - if (ReminderUtils.isBusy(config.showDuringContest)) return + if (isBuzy()) return if (!ChocolateFactoryAPI.isHoppityEvent()) return val displayList = HoppityEggType.entries @@ -159,9 +169,44 @@ object HoppityEggsManager { @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { + if (!isActive()) return HoppityEggType.checkClaimed() + checkWarn() } + private fun checkWarn() { + if (!warningActive) { + warningActive = HoppityEggType.entries.all { it.isClaimed() } + } + + if (warningActive) { + if (HoppityEggType.entries.all { !it.isClaimed() }) { + warn() + } + } + } + + private fun warn() { + if (!config.warnUnclaimedEggs) return + if (isBuzy()) return + if (lastWarnTime.passedSince() < 30.seconds) return + + lastWarnTime = now() + val amount = HoppityEggType.entries.size + val message = "All $amount Hoppity Eggs are ready to be found!" + if (config.warpUnclaimedEggs) { + ChatUtils.clickableChat( + message, + onClick = { HypixelCommands.warp(config.warpDestination) }, + "§eClick to /warp ${config.warpDestination}!" + ) + } else ChatUtils.chat(message) + LorenzUtils.sendTitle("§e$amount Hoppity Eggs!", 5.seconds) + SoundUtils.repeatSound(100, 10, SoundUtils.plingSound) + } + + private fun isBuzy() = ReminderUtils.isBusy(config.showDuringContest) + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( @@ -172,4 +217,5 @@ object HoppityEggsManager { event.move(44, "event.chocolateFactory.hoppityEggs", "event.hoppityEggs") } + fun isActive() = LorenzUtils.inSkyBlock && ChocolateFactoryAPI.isHoppityEvent() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt index 97da18d3c59a..2b0d9d72f760 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.event.lobby.waypoints.christmas import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.WinterAPI import at.hannibal2.skyhanni.data.jsonobjects.repo.EventWaypointsJson import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -123,5 +124,5 @@ class PresentWaypoints { } private fun isEnabled(): Boolean = - LorenzUtils.inHypixelLobby && (config.allWaypoints || config.allEntranceWaypoints) + LorenzUtils.inHypixelLobby && (config.allWaypoints || config.allEntranceWaypoints && WinterAPI.isDecember()) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt index 0abf9d2459eb..20afee4f1cad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/JyrreTimer.kt @@ -33,6 +33,7 @@ class JyrreTimer { } private fun resetDisplay() { + if (display.isEmpty()) return display = if (config.showInactive) drawDisplay() else emptyList() duration = 0.seconds } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt index d4b741472818..4ba88f1cd8fc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt @@ -7,16 +7,18 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.Entity import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class ChumBucketHider { private val config get() = SkyHanniMod.feature.fishing.chumBucketHider - private val titleEntity = mutableListOf() - private val hiddenEntities = mutableListOf() + private val titleEntity = TimeLimitedSet(5.seconds) + private val hiddenEntities = TimeLimitedSet(5.seconds) @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { @@ -50,7 +52,7 @@ class ChumBucketHider { // Second text line if (name.contains("/10 §aChums")) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity) { + for (title in titleEntity.toSet()) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.isCanceled = true @@ -62,7 +64,7 @@ class ChumBucketHider { // Chum Bucket if (config.hideBucket.get() && entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket") }) { val entityLocation = entity.getLorenzVec() - for (title in titleEntity) { + for (title in titleEntity.toSet()) { if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { hiddenEntities.add(entity) event.isCanceled = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 92ebceccddd4..db008f6b68da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -52,8 +53,8 @@ object FarmingFortuneDisplay { "§7You have §6\\+(?\\d{1,3})☘ .*" ) private val tooltipFortunePattern by patternGroup.pattern( - "tooltip", - "^§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?\$" + "tooltip.new", + "^§7Farming Fortune: §a\\+(?[\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(?\\d+)\\))?(?: §d\\(\\+(?\\d+)\\))?\$" ) private val armorAbilityPattern by patternGroup.pattern( "armorability", @@ -83,8 +84,10 @@ object FarmingFortuneDisplay { var displayedFortune = 0.0 var reforgeFortune = 0.0 + var gemstoneFortune = 0.0 var itemBaseFortune = 0.0 var greenThumbFortune = 0.0 + var pesterminatorFortune = 0.0 private var foundTabUniversalFortune = false private var foundTabCropFortune = false @@ -305,6 +308,7 @@ object FarmingFortuneDisplay { fun getSunderFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("sunder") ?: 0) * 12.5 fun getHarvestingFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("harvesting") ?: 0) * 12.5 fun getCultivatingFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("cultivating") ?: 0) * 2.0 + fun getPesterminatorFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("pesterminator") ?: 0) * 1.0 fun getAbilityFortune(item: ItemStack?) = item?.let { getAbilityFortune(it.getInternalName(), it.getLore()) @@ -334,22 +338,25 @@ object FarmingFortuneDisplay { fun loadFortuneLineData(tool: ItemStack?, enchantmentFortune: Double) { displayedFortune = 0.0 reforgeFortune = 0.0 + gemstoneFortune = 0.0 itemBaseFortune = 0.0 greenThumbFortune = 0.0 + pesterminatorFortune = getPesterminatorFortune(tool) - //TODO code cleanup + // TODO code cleanup (after ff rework) for (line in tool?.getLore()!!) { tooltipFortunePattern.matchMatcher(line) { - displayedFortune = group(1)!!.toDouble() - reforgeFortune = group(2)?.toDouble() ?: 0.0 + displayedFortune = group("display")?.toDouble() ?: 0.0 + reforgeFortune = groupOrNull("reforge")?.toDouble() ?: 0.0 + gemstoneFortune = groupOrNull("gemstone")?.toDouble() ?: 0.0 } ?: continue itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) { 5.0 } else { val dummiesFF = (tool.getFarmingForDummiesCount() ?: 0) * 1.0 - displayedFortune - reforgeFortune - enchantmentFortune - dummiesFF + displayedFortune - reforgeFortune - gemstoneFortune - pesterminatorFortune - enchantmentFortune - dummiesFF } greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { displayedFortune - reforgeFortune - itemBaseFortune diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index c175c219f574..05668871fa4a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -99,7 +99,7 @@ object GardenNextJacobContest { return } - event.addData { + event.addIrrelevant { add("Current time: ${SimpleTimeMark.now()}") add("") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt index 4007677043c0..6625af1237bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt @@ -332,7 +332,7 @@ object GardenPlotAPI { for (j in 0..plotSize step plotSize) { val start = LorenzVec(chunkMinX + i, minHeight, chunkMinZ + j) val end = LorenzVec(chunkMinX + i, maxHeight, chunkMinZ + j) - tryDraw3DLine(start, end, cornerColor, 2, true) + tryDraw3DLine(start, end, cornerColor, 3, true) } } @@ -341,9 +341,9 @@ object GardenPlotAPI { val start = LorenzVec(chunkMinX + x, minHeight, chunkMinZ) val end = LorenzVec(chunkMinX + x, maxHeight, chunkMinZ) // Front lines - tryDraw3DLine(start, end, lineColor, 1, true) + tryDraw3DLine(start, end, lineColor, 2, true) // Back lines - tryDraw3DLine(start.add(z = plotSize), end.add(z = plotSize), lineColor, 1, true) + tryDraw3DLine(start.add(z = plotSize), end.add(z = plotSize), lineColor, 2, true) } // Render vertical on Z-Axis @@ -351,9 +351,9 @@ object GardenPlotAPI { val start = LorenzVec(chunkMinX, minHeight, chunkMinZ + z) val end = LorenzVec(chunkMinX, maxHeight, chunkMinZ + z) // Left lines - tryDraw3DLine(start, end, lineColor, 1, true) + tryDraw3DLine(start, end, lineColor, 2, true) // Right lines - tryDraw3DLine(start.add(x = plotSize), end.add(x = plotSize), lineColor, 1, true) + tryDraw3DLine(start.add(x = plotSize), end.add(x = plotSize), lineColor, 2, true) } // Render horizontal @@ -367,7 +367,7 @@ object GardenPlotAPI { val start = LorenzVec(chunkMinX, y, chunkMinZ) val isRedLine = y == buildLimit val color = if (isRedLine) Color.red else lineColor - val depth = if (isRedLine) 2 else 1 + val depth = if (isRedLine) 3 else 2 // (minX, minZ) -> (minX, minZ + 96) tryDraw3DLine(start, start.add(z = plotSize), color, depth, true) // (minX, minZ + 96) -> (minX + 96, minZ + 96) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index 70dbcb1e8546..be5bde924e0e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -71,8 +71,10 @@ class ToolTooltipTweaks { val displayedFortune = FarmingFortuneDisplay.displayedFortune val reforgeFortune = FarmingFortuneDisplay.reforgeFortune + val gemstoneFortune = FarmingFortuneDisplay.gemstoneFortune val baseFortune = FarmingFortuneDisplay.itemBaseFortune val greenThumbFortune = FarmingFortuneDisplay.greenThumbFortune + val pesterminatorFortune = FarmingFortuneDisplay.pesterminatorFortune val totalFortune = displayedFortune + hiddenFortune @@ -91,8 +93,10 @@ class ToolTooltipTweaks { iterator.addStat(" §7Base: §6+", baseFortune) iterator.addStat(" §7Tool: §6+", toolFortune) iterator.addStat(" §7${reforgeName?.removeColor()}: §9+", reforgeFortune) + iterator.addStat(" §7Gemstone: §d+", gemstoneFortune) iterator.addStat(" §7Ability: §2+", abilityFortune) iterator.addStat(" §7Green Thumb: §a+", greenThumbFortune) + iterator.addStat(" §7Pesterminator: §a+", pesterminatorFortune) iterator.addStat(" §7Sunder: §a+", sunderFortune) iterator.addStat(" §7Harvesting: §a+", harvestingFortune) iterator.addStat(" §7Cultivating: §a+", cultivatingFortune) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt index fb82c8be9237..9b866bd3fffb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt @@ -1,10 +1,11 @@ package at.hannibal2.skyhanni.features.garden.contest +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.FarmingContestEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isAnyOf import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SkyBlockTime @@ -39,7 +41,13 @@ object FarmingContestAPI { ) private val contests = mutableMapOf() - var inContest = false + private var internalContest = false + val inContest + get() = internalContest && LorenzUtils.skyBlockIsland.isAnyOf( + IslandType.GARDEN, + IslandType.HUB, + IslandType.THE_FARMING_ISLANDS + ) var contestCrop: CropType? = null private var startTime = SimpleTimeMark.farPast() var inInventory = false @@ -49,21 +57,20 @@ object FarmingContestAPI { } @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - if (event.repeatSeconds(1)) { - if (!LorenzUtils.inSkyBlock) return - if (!GardenAPI.inGarden()) return + fun onSecondPassed(event: SecondPassedEvent) { + if (!LorenzUtils.inSkyBlock) return - checkActiveContest() + if (internalContest && startTime.passedSince() > 20.minutes) { + FarmingContestEvent(contestCrop!!, FarmingContestPhase.STOP).postAndCatch() + internalContest = false } + + if (!GardenAPI.inGarden()) return + + checkActiveContest() } private fun checkActiveContest() { - if (inContest && startTime.passedSince() > 20.minutes) { - FarmingContestEvent(contestCrop!!, FarmingContestPhase.STOP).postAndCatch() - inContest = false - } - val currentCrop = readCurrentCrop() val currentContest = currentCrop != null @@ -76,7 +83,7 @@ object FarmingContestAPI { FarmingContestEvent(contestCrop!!, FarmingContestPhase.STOP).postAndCatch() } } - inContest = currentContest + internalContest = currentContest } else { if (currentCrop != contestCrop && currentCrop != null) { FarmingContestEvent(currentCrop, FarmingContestPhase.CHANGE).postAndCatch() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 44fa5f7a1f61..72021eea6fc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -213,8 +213,15 @@ object GardenCropMilestoneDisplay { } } - val format = (farmingFortuneSpeed * 60).addSeparators() - lineMap[MilestoneTextEntry.CROPS_PER_MINUTE] = Renderable.string("§7Crops/Minute§8: §e$format") + val secondFormat = (farmingFortuneSpeed).addSeparators() + lineMap[MilestoneTextEntry.CROPS_PER_SECOND] = Renderable.string("§7Crops/Second§8: §e$secondFormat") + + val minuteFormat = (farmingFortuneSpeed * 60).addSeparators() + lineMap[MilestoneTextEntry.CROPS_PER_MINUTE] = Renderable.string("§7Crops/Minute§8: §e$minuteFormat") + + val hourFormat = (farmingFortuneSpeed * 60 * 60).addSeparators() + lineMap[MilestoneTextEntry.CROPS_PER_HOUR] = Renderable.string("§7Crops/Hour§8: §e$hourFormat") + val formatBps = speed.round(config.blocksBrokenPrecision).addSeparators() lineMap[MilestoneTextEntry.BLOCKS_PER_SECOND] = Renderable.string("§7Blocks/Second§8: §e$formatBps") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 4d3cc3ae17bd..111fa58dfbef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -125,6 +125,12 @@ object CaptureFarmingGear { ChatUtils.chat("Toggled expired pumpkin fortune to: ${storage.pumpkinFortune}") } + fun reverseCocoaBeansFortune() { + val storage = GardenAPI.storage?.fortune ?: return + storage.cocoaBeansFortune = !storage.cocoaBeansFortune + ChatUtils.chat("Toggled supreme chocolate bar fortune to: ${storage.cocoaBeansFortune}") + } + private fun getUniqueVisitorsForTier(tier: Int): Int { return when { tier == 0 -> 0 @@ -353,6 +359,9 @@ object CaptureFarmingGear { if (msg == "PUMPKINS EXPORTATION COMPLETE!") { storage.pumpkinFortune = true } + if (msg == "CHOCOLATE BARS EXPORTATION COMPLETE!") { + storage.cocoaBeansFortune = true + } if (msg == "[NPC] Carrolyn: Thank you for the carrots.") { storage.carrotFortune = true ChatUtils.chat("§aYou have already given Carrolyn enough Exportable Carrots.") @@ -361,5 +370,9 @@ object CaptureFarmingGear { storage.pumpkinFortune = true ChatUtils.chat("§aYou have already given Carrolyn enough Expired Pumpkins.") } + if (msg == "[NPC] Carrolyn: Thank you for the chocolate.") { + storage.cocoaBeansFortune = true + ChatUtils.chat("§aYou have already given Carrolyn enough Supreme Chocolate Bars.") + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index a23f34c66e0d..0b27856fd4cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.garden.fortuneguide import at.hannibal2.skyhanni.data.CropAccessoryData -import at.hannibal2.skyhanni.data.GardenCropUpgrades.Companion.getUpgradeLevel +import at.hannibal2.skyhanni.data.GardenCropUpgrades.getUpgradeLevel import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay @@ -86,7 +86,7 @@ object FFStats { fun getCropStats(crop: CropType, tool: ItemStack) { cropPage.clear() - cropPage[FortuneStats.BASE] = Pair(totalBaseFF[FFTypes.TOTAL] ?: 100.0, 1277.0) + cropPage[FortuneStats.BASE] = Pair(totalBaseFF[FFTypes.TOTAL] ?: 100.0, if (usingSpeedBoots) 1373.0 else 1377.0) cropPage[FortuneStats.CROP_UPGRADE] = Pair((crop.getUpgradeLevel()?.toDouble() ?: 0.0) * 5.0, 45.0) cropPage[FortuneStats.ACCESSORY] = Pair(CropAccessoryData.cropAccessory?.getFortune(crop) ?: 0.0, 30.0) cropPage[FortuneStats.FFD] = Pair((tool.getFarmingForDummiesCount() ?: 0).toDouble(), 5.0) @@ -103,28 +103,33 @@ object FFStats { cropPage[FortuneStats.HARVESTING] = Pair(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0) cropPage[FortuneStats.COLLECTION] = Pair(FarmingFortuneDisplay.getCollectionFortune(tool), 48.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 20.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 30.0) } in dicerCrops -> { cropPage[FortuneStats.SUNDER] = Pair(FarmingFortuneDisplay.getSunderFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 20.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 20.0) } CropType.MUSHROOM -> { cropPage[FortuneStats.BASE_TOOL] = Pair(FarmingFortuneDisplay.getToolFortune(tool), 30.0) cropPage[FortuneStats.HARVESTING] = Pair(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 16.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 16.0) } CropType.COCOA_BEANS -> { cropPage[FortuneStats.BASE_TOOL] = Pair(FarmingFortuneDisplay.getToolFortune(tool), 20.0) cropPage[FortuneStats.SUNDER] = Pair(FarmingFortuneDisplay.getSunderFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 16.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 16.0) } CropType.CACTUS -> { cropPage[FortuneStats.HARVESTING] = Pair(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 16.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 16.0) } else -> {} @@ -139,6 +144,11 @@ object FFStats { val pumpkinFortune = if (storage.pumpkinFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPIRED_PUMPKIN] = Pair(pumpkinFortune, 12.0) } + if (crop == CropType.COCOA_BEANS) { + val storage = GardenAPI.storage?.fortune ?: return + val cocoaBeansFortune = if (storage.cocoaBeansFortune) 12.0 else 0.0 + cropPage[FortuneStats.SUPREME_CHOCOLATE_BAR] = Pair(cocoaBeansFortune, 12.0) + } cropPage[FortuneStats.CROP_TOTAL] = Pair( cropPage.toList().sumOf { it.second.first }, @@ -156,10 +166,12 @@ object FFStats { } private fun getArmorFFData(item: ItemStack, out: MutableMap) { - out[FFTypes.TOTAL] = 0.0 FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) + out[FFTypes.TOTAL] = 0.0 out[FFTypes.BASE] = FarmingFortuneDisplay.itemBaseFortune out[FFTypes.REFORGE] = FarmingFortuneDisplay.reforgeFortune + out[FFTypes.GEMSTONE] = FarmingFortuneDisplay.gemstoneFortune + out[FFTypes.PESTERMINATOR] = FarmingFortuneDisplay.pesterminatorFortune out[FFTypes.ABILITY] = FarmingFortuneDisplay.getAbilityFortune(item) out[FFTypes.TOTAL] = out.values.sum() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt index 16d2e759441a..fdbe4635f9ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt @@ -4,8 +4,10 @@ enum class FFTypes { TOTAL, BASE, REFORGE, + GEMSTONE, ABILITY, GREEN_THUMB, + PESTERMINATOR, BASE_FF, ANITA, FARMING_LVL, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt index 2f438e726b3d..863bc95187e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt @@ -11,6 +11,7 @@ enum class FortuneStats(val label: String, val tooltip: String) { CROP_UPGRADE("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n§2You get 5☘ per level"), BASE_TOOL("§2Base tool fortune", "§7§2Crop specific fortune from your tool"), REFORGE("§2Tool reforge", "§7§2Fortune from reforging your tool"), + GEMSTONE("§2Tool gemstone", "§7§2Fortune from gemstones on your tool"), FFD("§2Farming for Dummies", "§7§2Fortune for each applied book\n§2You get 1☘ per applied book"), COUNTER("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n§2You get 16☘ per digit - 4"), COLLECTION("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n§2You get 8☘ per digit - 4"), @@ -28,5 +29,10 @@ enum class FortuneStats(val label: String, val tooltip: String) { "§2Expired Pumpkin", "§7§2Gain 12☘ from giving 3,000 to Carrolyn in Scarleton!\n" + "§eRun /shpumpkin to toggle the stat" - ) + ), + SUPREME_CHOCOLATE_BAR( + "§2Supreme Chocolate Bar", + "§7§2Gain 12☘ from giving 3,000 to Carrolyn in Scarleton!\n" + + "§eRun /shcocoabeans to toggle the stat" + ), } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt index ed3023eaeae3..605081e4e90d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt @@ -16,13 +16,14 @@ class OverviewPage : FFGuideGUI.FFGuidePage() { private var equipmentFF = mutableMapOf() private var armorFF = mutableMapOf() + // TODO display armor stats for gemstones and pesterminator override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { val timeUntilCakes = TimeUtils.formatDuration(FFStats.cakeExpireTime - System.currentTimeMillis()) GuiRenderUtils.drawFarmingBar( "§6Universal Farming Fortune", "§7§2Farming fortune in that is\n§2applied to every crop\n§eNot the same as tab FF\n" + - "§eSee on the grass block page", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1277, + "§eSee on the grass block page", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, if (FFStats.usingSpeedBoots) 1373 else 1377, FFGuideGUI.guiLeft + 15, FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay ) @@ -87,19 +88,20 @@ class OverviewPage : FFGuideGUI.FFGuidePage() { line = if (currentArmor == 0) "§7§2Total fortune from your armor\n§2Select a piece for more info" else "§7§2Total fortune from your\n${armorItem.getItem().displayName}" - var value = if (currentArmor == 0) { - 325 - } else if (FFStats.usingSpeedBoots) { + var value = if (FFStats.usingSpeedBoots) { when (currentArmor) { - 1 -> 76.67 - 2, 3 -> 81.67 - else -> 85 + 0 -> 421 + 1 -> 101.67 + 2, 3 -> 106.67 + 4 -> 106 + else -> 0 } } else { when (currentArmor) { - 1 -> 78.75 - 2, 3 -> 83.75 - else -> 78.75 + 0 -> 425 + 1, 4 -> 103.75 + 2, 3 -> 108.75 + else -> 0 } } GuiRenderUtils.drawFarmingBar( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index 0d86757ea4e0..f7287330d32a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -9,9 +9,9 @@ import at.hannibal2.skyhanni.utils.DisplayTableEntry import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.itemName +import at.hannibal2.skyhanni.utils.ItemUtils.loreCosts import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round -import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil @@ -22,7 +22,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.JsonPrimitive -import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkyMartCopperPrice { @@ -40,25 +39,6 @@ class SkyMartCopperPrice { var inInventory = false } - private fun ItemStack.loreCosts(): MutableList { - var found = false - val list = mutableListOf() - for (lines in getLore()) { - if (lines == "§7Cost") { - found = true - continue - } - - if (!found) continue - if (lines.isEmpty()) return list - - NEUInternalName.fromItemNameOrNull(lines)?.let { - list.add(it) - } - } - return list - } - @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt index 1351ab5bd4ca..1d1c4e0b6ffa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt @@ -121,28 +121,27 @@ object PestAPI { var firstScoreboardCheck = false private fun fixPests(loop: Int = 2) { - val accurateAmount = getPlotsWithAccuratePests().sumOf { it.pests } - val inaccurateAmount = getPlotsWithInaccuratePests().size - if (scoreboardPests == accurateAmount + inaccurateAmount) { // if we can assume all inaccurate plots have 1 pest each - for (plot in getPlotsWithInaccuratePests()) { - plot.pests = 1 + DelayedRun.runDelayed(2.seconds) { + val accurateAmount = getPlotsWithAccuratePests().sumOf { it.pests } + val inaccurateAmount = getPlotsWithInaccuratePests().size + if (scoreboardPests == accurateAmount + inaccurateAmount) { // if we can assume all inaccurate plots have 1 pest each + for (plot in getPlotsWithInaccuratePests()) { + plot.pests = 1 + plot.isPestCountInaccurate = false + } + } else if (inaccurateAmount == 1) { // if we can assume all the inaccurate pests are in the only inaccurate plot + val plot = getPlotsWithInaccuratePests().firstOrNull() ?: return@runDelayed + plot.pests = scoreboardPests - accurateAmount plot.isPestCountInaccurate = false - } - } else if (inaccurateAmount == 1) { // if we can assume all the inaccurate pests are in the only inaccurate plot - val plot = getPlotsWithInaccuratePests().firstOrNull() ?: return - plot.pests = scoreboardPests - accurateAmount - plot.isPestCountInaccurate = false - } else if (accurateAmount + inaccurateAmount > scoreboardPests) { // when logic fails and we reach impossible pest counts - getInfestedPlots().forEach { - it.pests = 0 - it.isPestCountInaccurate = true - } - if (loop > 0) { - DelayedRun.runDelayed(2.seconds) { - fixPests(loop - 1) + } else if (accurateAmount + inaccurateAmount > scoreboardPests) { // when logic fails and we reach impossible pest counts + getInfestedPlots().forEach { + it.pests = 0 + it.isPestCountInaccurate = true } + if (loop > 0) { + fixPests(loop - 1) + } else sendPestError() } - else sendPestError() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 5983e5ab62d1..19e07863830d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -600,7 +600,7 @@ object GardenVisitorFeatures { return } - event.addData { + event.addIrrelevant { val visitors = VisitorAPI.getVisitors() add("visitors: ${visitors.size}") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index efb19579e254..229e58e4eef5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -99,6 +99,9 @@ class GardenVisitorTimer { } millis = TimeUtils.getDuration(timeInfo) } + } ?: run { + display = "§cVisitor time info not in tab list" + return } if (lastVisitors != -1 && visitorsAmount - lastVisitors == 1) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 18f8a923925c..53d8539b43b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -39,11 +39,35 @@ import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.pluralize import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.TimeUtils.formatted import java.util.function.Supplier +import kotlin.time.Duration.Companion.milliseconds + +internal var confirmedUnknownLines = mutableListOf() +internal var unconfirmedUnknownLines = listOf() +internal var unknownLinesSet = TimeLimitedSet(500.milliseconds) { onRemoval(it) } + +private fun onRemoval(line: String) { + if (!unconfirmedUnknownLines.contains(line)) return + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } + confirmedUnknownLines.add(line) + if (!config.unknownLinesWarning) return + val pluralize = pluralize(confirmedUnknownLines.size, "unknown line", withNumber = true) + val message = "CustomScoreboard detected $pluralize" + ErrorManager.logErrorWithData( + CustomScoreboardUtils.UndetectedScoreboardLines(message), + message, + "Unknown Lines" to confirmedUnknownLines, + "Island" to HypixelData.skyBlockIsland, + "Area" to HypixelData.skyBlockArea, + "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, + noStackTrace = true, + betaOnly = true, + ) +} -internal var unknownLines = listOf() internal var amountOfUnknownLines = 0 enum class ScoreboardElement( @@ -639,10 +663,14 @@ private fun getQuiverDisplayPair(): List { ).getChatColor() } else { "" - }) + when (arrowConfig.arrowAmountDisplay) { - ArrowAmountDisplay.NUMBER -> QuiverAPI.currentAmount.addSeparators() - ArrowAmountDisplay.PERCENTAGE -> "${QuiverAPI.currentAmount.asArrowPercentage()}%" - else -> QuiverAPI.currentAmount.addSeparators() + }) + if (QuiverAPI.wearingSkeletonMasterChestplate) { + "∞" + } else { + when (arrowConfig.arrowAmountDisplay) { + ArrowAmountDisplay.NUMBER -> QuiverAPI.currentAmount.addSeparators() + ArrowAmountDisplay.PERCENTAGE -> "${QuiverAPI.currentAmount.asArrowPercentage()}%" + else -> QuiverAPI.currentAmount.addSeparators() + } } return listOf( @@ -773,30 +801,15 @@ private fun getFooterDisplayPair(): List = ).flatten() private fun getExtraDisplayPair(): List { - if (unknownLines.isEmpty()) return listOf("" to HorizontalAlignment.LEFT) - - val size = unknownLines.size - if (amountOfUnknownLines != size && config.unknownLinesWarning) { - val message = "CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}" - ErrorManager.logErrorWithData( - CustomScoreboardUtils.UndetectedScoreboardLines(message), - message, - "Unknown Lines" to unknownLines, - "Island" to HypixelData.skyBlockIsland, - "Area" to HypixelData.skyBlockArea, - "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, - noStackTrace = true, - betaOnly = true, - ) - amountOfUnknownLines = size - } + if (confirmedUnknownLines.isEmpty()) return listOf("" to HorizontalAlignment.LEFT) + amountOfUnknownLines = confirmedUnknownLines.size - return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + unknownLines.map { it to HorizontalAlignment.LEFT } + return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + confirmedUnknownLines.map { it to HorizontalAlignment.LEFT } } private fun getExtraShowWhen(): Boolean { - if (unknownLines.isEmpty()) { + if (confirmedUnknownLines.isEmpty()) { amountOfUnknownLines = 0 } - return unknownLines.isNotEmpty() + return confirmedUnknownLines.isNotEmpty() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt index fdc2232bef27..e5637ab97e7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardPattern.kt @@ -297,10 +297,6 @@ object ScoreboardPattern { "essence", "^\\s*.*Essence: §.(?-?\\d+(:?,\\d{3})*(?:\\.\\d+)?)$" ) - val brokenRedstonePattern by miscSb.pattern( - "brokenredstone", - "\\s*(?:(?:§.)*⚡ (§.)*Redston|e: (?:§.)*\\d+%)\\s*" - ) val redstonePattern by miscSb.pattern( "redstone", "\\s*(§.)*⚡ §cRedstone: (§.)*\\d{1,3}%$" @@ -390,7 +386,7 @@ object ScoreboardPattern { ) val winterTotalDmgPattern by eventsSb.pattern( "wintereventtotaldmg", - "(§.)*Your Total Damage: §.\\d+( §e\\(#\\d+\\)?)?$" + "(§.)*Your Total Damage: §.\\d+.*$" ) val winterCubeDmgPattern by eventsSb.pattern( "wintereventcubedmg", diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index da50f3a21f8b..a5a991cfc35f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.PurseAPI import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.misc.ServerRestartTitle import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeResets @@ -14,7 +15,7 @@ object UnknownLinesHandler { fun handleUnknownLines() { val sidebarLines = ScoreboardData.sidebarLinesFormatted - unknownLines = sidebarLines + unconfirmedUnknownLines = sidebarLines .map { it.removeResets() } .filter { it.isNotBlank() } .filter { it.trim().length > 3 } @@ -86,7 +87,6 @@ object UnknownLinesHandler { SbPattern.bossDamagePattern, SbPattern.slayerQuestPattern, SbPattern.essencePattern, - SbPattern.brokenRedstonePattern, SbPattern.redstonePattern, SbPattern.visitingPattern, SbPattern.flightDurationPattern, @@ -123,7 +123,7 @@ object UnknownLinesHandler { SbPattern.cluesPattern, ) - unknownLines = unknownLines.filterNot { line -> + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { line -> patternsToExclude.any { pattern -> pattern.matches(line) } } @@ -134,16 +134,16 @@ object UnknownLinesHandler { val objectiveLine = sidebarLines.firstOrNull { SbPattern.objectivePattern.matches(it) } ?: "Objective" - unknownLines = unknownLines.filter { sidebarLines.nextAfter(objectiveLine) != it } + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(objectiveLine) != it } // TODO create function - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(objectiveLine, 2) != it && !SbPattern.thirdObjectiveLinePattern.matches(it) } // Remove jacobs contest for (i in 1..3) - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.jacobsContestPattern.matches(line) } ?: "§eJacob's Contest", i) != it @@ -151,24 +151,43 @@ object UnknownLinesHandler { // Remove slayer for (i in 1..2) - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.slayerQuestPattern.matches(line) } ?: "Slayer Quest", i) != it } // remove trapper mob location - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.mobLocationPattern.matches(line) } ?: "Tracker Mob Location:") != it } // da - unknownLines = unknownLines.filter { + unconfirmedUnknownLines = unconfirmedUnknownLines.filter { sidebarLines.nextAfter(sidebarLines.firstOrNull { line -> SbPattern.darkAuctionCurrentItemPattern.matches(line) } ?: "Current Item:") != it } + + + /* + * handle broken scoreboard lines + */ + confirmedUnknownLines.forEach { line -> + if (!unconfirmedUnknownLines.contains(line)) { + confirmedUnknownLines = confirmedUnknownLines.filterNot { it == line }.toMutableList() + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } + } + } + unconfirmedUnknownLines.forEach { line -> + if (confirmedUnknownLines.contains(line)) { + unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } + } else if (!unknownLinesSet.contains(line)) { + ChatUtils.debug("Unknown Scoreboard line: '$line'") + unknownLinesSet.add(line) + } + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt index 608b66b2bdd8..049cbc35c388 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverDisplay.kt @@ -64,7 +64,7 @@ class QuiverDisplay { fun onQuiverUpdate(event: QuiverUpdateEvent) { arrow = event.currentArrow amount = event.currentAmount - hideAmount = event.hideAmount + hideAmount = QuiverAPI.wearingSkeletonMasterChestplate updateDisplay() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt index 59fd5e51d725..40ef08c6aff5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/quiver/QuiverWarning.kt @@ -2,15 +2,24 @@ package at.hannibal2.skyhanni.features.gui.quiver import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.ArrowType +import at.hannibal2.skyhanni.data.QuiverAPI +import at.hannibal2.skyhanni.data.QuiverAPI.amount import at.hannibal2.skyhanni.data.TitleManager import at.hannibal2.skyhanni.events.DungeonCompleteEvent import at.hannibal2.skyhanni.events.KuudraCompleteEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.QuiverUpdateEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.nether.kuudra.KuudraAPI import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.DelayedRun +import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull +import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.SoundUtils +import at.hannibal2.skyhanni.utils.StringUtils.createCommaSeparatedList import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -19,8 +28,7 @@ class QuiverWarning { private val config get() = SkyHanniMod.feature.combat.quiverConfig private var lastLowQuiverReminder = SimpleTimeMark.farPast() - private var lowDuringInstance = false - private var amount = 0 + private var arrowsInInstance = mutableSetOf() @SubscribeEvent fun onDungeonComplete(event: DungeonCompleteEvent) { @@ -33,15 +41,28 @@ class QuiverWarning { } private fun onInstanceComplete() { - if (!lowDuringInstance) return - lowDuringInstance = false + val arrows = arrowsInInstance + arrowsInInstance.clear() + arrows.filter { it.amount <= config.lowQuiverAmount } - if (config.reminderAfterRun) { - lowQuiverAlert() + if (arrows.isNotEmpty() && config.reminderAfterRun) { + DelayedRun.runNextTick { + instanceAlert(arrows) + } } } - private fun lowQuiverAlert() { + private fun instanceAlert(arrows: Set) { + val arrowsText = arrows.map { arrowType -> + val rarity = arrowType.internalName.getItemStackOrNull()?.getItemRarityOrNull()?.chatColorCode ?: "§f" + "$rarity${arrowType.arrow}" + }.createCommaSeparatedList() + TitleManager.sendTitle("§cLow on arrows!", 5.seconds, 3.6, 7f) + ChatUtils.chat("Low on $arrowsText!") + SoundUtils.repeatSound(100, 30, SoundUtils.plingSound) + } + + private fun lowQuiverAlert(amount: Int) { if (lastLowQuiverReminder.passedSince() < 30.seconds) return lastLowQuiverReminder = SimpleTimeMark.now() TitleManager.sendTitle("§cLow on arrows!", 5.seconds, 3.6, 7f) @@ -50,17 +71,25 @@ class QuiverWarning { @SubscribeEvent fun onQuiverUpdate(event: QuiverUpdateEvent) { - amount = event.currentAmount + val amount = event.currentAmount + val arrow = event.currentArrow ?: return + if (arrow == QuiverAPI.NONE_ARROW_TYPE) return + + if (inInstance()) arrowsInInstance.add(arrow) if (amount > config.lowQuiverAmount) return - if (DungeonAPI.inDungeon() || LorenzUtils.inKuudraFight) { - lowDuringInstance = true - } if (config.lowQuiverNotification) { - lowQuiverAlert() + lowQuiverAlert(amount) } } + @SubscribeEvent + fun onWorldSwitch(event: LorenzWorldChangeEvent) { + arrowsInInstance.clear() + } + + private fun inInstance() = DungeonAPI.inDungeon() || KuudraAPI.inKuudra() + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(35, "inventory.quiverAlert", "combat.quiverConfig.lowQuiverNotification") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 9ad8be984844..e0bd277692a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -10,6 +10,8 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.minion.MinionFeatures import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValueCalculator import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList @@ -62,6 +64,7 @@ class ChestValue { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return + if (!inInventory) return if (event.isMod(5)) { update() } @@ -227,6 +230,10 @@ class ChestValue { private fun isValidStorage(): Boolean { val name = InventoryUtils.openInventoryName().removeColor() if (Minecraft.getMinecraft().currentScreen !is GuiChest) return false + if (BazaarApi.inBazaarInventory) return false + if (MinionFeatures.minionInventoryOpen) return false + if (MinionFeatures.minionStorageInventoryOpen) return false + if ((name.contains("Backpack") && name.contains("Slot #") || name.startsWith("Ender Chest (")) && !InventoryUtils.isNeuStorageEnabled.getValue() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 5fcaf580b706..c250396b9f06 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -135,7 +135,7 @@ class HideNotClickableItems { ChatUtils.error("No hide reason for not clickable item!") } else { event.toolTip.add("§c$hideReason") - if (config.itemsBypass) { + if (config.itemsBypass && !hideReason.contains("SkyBlock Menu")) { event.toolTip.add(" §7(Bypass by holding the ${KeyboardManager.getModifierKeyName()} key)") } } @@ -440,7 +440,7 @@ class HideNotClickableItems { return true } - if (stack.cleanName() == "Green Candy" || stack.cleanName() == "Purple Candy") return false + if (stack.cleanName() == "Green Candy" || stack.cleanName() == "Purple Candy" || stack.cleanName() == "Dark Candy") return false hideReason = "This item is not a spooky candy!" return true diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt index 9d3f921049d5..c95533184629 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SuperCraftFeatures.kt @@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class SuperCraftFeatures { - private val craftedPattern by RepoPattern.pattern( +object SuperCraftFeatures { + val craftedPattern by RepoPattern.pattern( "inventory.supercrafting.craft.new", "§eYou Supercrafted §r§r§r§.(?[^§]+)(?:§r§8x(?[\\d,]+))?§r§e!" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt similarity index 96% rename from src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt rename to src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt index 43ca734fc681..9b7cab11a05f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseCopyUnderbidPrice.kt @@ -1,4 +1,4 @@ -package at.hannibal2.skyhanni.features.misc.items +package at.hannibal2.skyhanni.features.inventory.auctionhouse import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator @@ -31,7 +31,7 @@ class AuctionHouseCopyUnderbidPrice { ) private val allowedInventoriesPattern by patternGroup.pattern( "allowedinventories", - "(?:Auctions Browser|Manage Auctions|Auctions: \".*\"?)" + "Auctions Browser|Manage Auctions|Auctions: \".*\"?" ) @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt new file mode 100644 index 000000000000..9f1cce065bc5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/auctionhouse/AuctionHouseOpenPriceWebsite.kt @@ -0,0 +1,89 @@ +package at.hannibal2.skyhanni.features.inventory.auctionhouse + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.InventoryCloseEvent +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack +import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent +import io.github.moulberry.notenoughupdates.util.Utils +import net.minecraft.entity.player.InventoryPlayer +import net.minecraft.item.ItemStack +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +class AuctionHouseOpenPriceWebsite { + + private val config get() = SkyHanniMod.feature.inventory.auctions + private var lastClick = SimpleTimeMark.farPast() + + private val patternGroup = RepoPattern.group("inventory.auctionhouse") + + /** + * REGEX-TEST: Auctions: "hyperion" + */ + private val ahSearchPattern by patternGroup.pattern( + "title.search", + "Auctions: \"(?.*)\"?" + ) + + private var searchTerm = "" + private var displayItem: ItemStack? = null + + @SubscribeEvent + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { + if (!isEnabled()) return + ahSearchPattern.matchMatcher(event.inventoryName) { + searchTerm = group("searchTerm").removeSuffix("\"").replace(" ", "%20") + displayItem = createDisplayItem() + } + } + + private fun createDisplayItem() = Utils.createItemStack( + "PAPER".asInternalName().getItemStack().item, + "§bPrice History", + "§7Click here to open", + "§7the price history", + "§7of §e$searchTerm", + "§7on §csky.coflnet.com" + ) + + @SubscribeEvent + fun onInventoryClose(event: InventoryCloseEvent) { + displayItem = null + } + + @SubscribeEvent + fun replaceItem(event: ReplaceItemEvent) { + if (!isEnabled()) return + if (event.inventory is InventoryPlayer) return + + if (event.slotNumber == 8) { + displayItem?.let { + event.replaceWith(it) + } + } + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + if (!isEnabled()) return + displayItem ?: return + if (event.slotId != 8) return + event.isCanceled = true + if (lastClick.passedSince() > 0.3.seconds) { + val url = "https://sky.coflnet.com/api/mod/open/$searchTerm" + OSUtils.openBrowser(url) + lastClick = SimpleTimeMark.now() + } + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.openPriceWebsite +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt index c1b4582c9201..a161bab74baa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.isBazaarItem import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut +import at.hannibal2.skyhanni.utils.CollectionUtils.addString import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -126,18 +127,24 @@ class CraftMaterialsFromBazaar { private fun MutableList.addMultipliers() { for (m in listOf(1, 5, 16, 32, 64, 512)) { - val nameColor = if (m == multiplier) "§amount" else "§e" - val priceColor = if (m == multiplier) "§6" else "§7" + val isThisMultiply = m == multiplier + val nameColor = if (isThisMultiply) "§a" else "§e" + val priceColor = if (isThisMultiply) "§6" else "§7" val price = priceColor + NumberUtil.format(calculateTotalPrice(neededMaterials, m)) - add( - Renderable.clickAndHover( - "${nameColor}Mulitply x$m $price", - listOf("§eClick here to multiply the items needed times $m!"), - onClick = { - multiplier = m - updateBazaarDisplay() - }) - ) + val text = "${nameColor}Mulitply x$m $price" + if (!isThisMultiply) { + add( + Renderable.clickAndHover( + text, + listOf("§eClick here to multiply the items needed times $m!"), + onClick = { + multiplier = m + updateBazaarDisplay() + }) + ) + } else { + addString(text) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt index e52fcdacb581..45fbd65de143 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt @@ -68,6 +68,13 @@ enum class ChocolateAmount(val chocolate: () -> Long) { } } + fun addToCurrent(amount: Long) { + profileStorage?.let { + it.currentChocolate += amount + updateBestUpgrade() + } + } + private fun updateBestUpgrade() { profileStorage?.let { if (it.bestUpgradeAvailableAt == 0L || it.bestUpgradeCost == 0L) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt index c2cabf08e483..cc7731f802be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -76,6 +77,7 @@ object ChocolateFactoryCustomReminder { fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (!isEnabled()) return if (!inChocolateMenu()) return + if (ReminderUtils.isBusy()) return configReminder.position.renderRenderables(display, posLabel = "Chocolate Factory Custom Reminder") } @@ -85,6 +87,7 @@ object ChocolateFactoryCustomReminder { if (!isEnabled()) return if (!configReminder.always) return if (Minecraft.getMinecraft().currentScreen is GuiChest) return + if (ReminderUtils.isBusy()) return configReminder.position.renderRenderables(display, posLabel = "Chocolate Factory Custom Reminder") } @@ -133,7 +136,10 @@ object ChocolateFactoryCustomReminder { if (configUpgradeWarnings.upgradeWarningSound) { SoundUtils.playBeepSound() } - ChatUtils.chat("You can now purchase §f$targetName §ein Chocolate factory!") + ChatUtils.clickableChat("You can now purchase §f$targetName §ein Chocolate factory!", + onClick = { + HypixelCommands.chocolateFactory() + }) } private fun reset() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt index 892a96e4656b..87aa21023ca6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt @@ -6,8 +6,10 @@ import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.ClipboardUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.toRoman import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.renderables.Renderable import com.google.gson.JsonElement import com.google.gson.JsonPrimitive @@ -55,6 +57,8 @@ object ChocolateFactoryStats { "§6${ChocolateFactoryTimeTowerManager.timeTowerCharges()}" } + val timeTowerFull = ChocolateFactoryTimeTowerManager.timeTowerFullTimemark() + val prestigeEstimate = ChocolateAmount.PRESTIGE.formattedTimeUntilGoal(ChocolateFactoryAPI.chocolateForPrestige) val chocolateUntilPrestigeCalculation = ChocolateFactoryAPI.chocolateForPrestige - ChocolateAmount.PRESTIGE.chocolate() @@ -68,7 +72,7 @@ object ChocolateFactoryStats { val upgradeAvailableAt = ChocolateAmount.CURRENT.formattedTimeUntilGoal(profileStorage.bestUpgradeCost) val map = buildMap { - put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory Stats") + put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory ${ChocolateFactoryAPI.currentPrestige.toRoman()}") put(ChocolateFactoryStat.CURRENT, "§eCurrent Chocolate: §6${ChocolateAmount.CURRENT.formatted}") put(ChocolateFactoryStat.THIS_PRESTIGE, "§eThis Prestige: §6${ChocolateAmount.PRESTIGE.formatted}") @@ -90,6 +94,17 @@ object ChocolateFactoryStats { put(ChocolateFactoryStat.EMPTY_4, "") put(ChocolateFactoryStat.TIME_TOWER, "§eTime Tower: §6$timeTowerInfo") + put( + ChocolateFactoryStat.TIME_TOWER_FULL, + if (ChocolateFactoryTimeTowerManager.timeTowerFull()) { + "§eFull Tower Charges: §a§lNow\n" + + "§eHappens at: §a§lNow" + } else { + "§eFull Tower Charges: §b${timeTowerFull.timeUntil().format()}\n" + + "§eHappens at: §b${timeTowerFull.formattedDate("EEEE, MMM d h:mm a")}" + } + + ) put(ChocolateFactoryStat.TIME_TO_PRESTIGE, "§eTime To Prestige: $prestigeEstimate") put( ChocolateFactoryStat.RAW_PER_SECOND, @@ -101,19 +116,15 @@ object ChocolateFactoryStats { ) put(ChocolateFactoryStat.TIME_TO_BEST_UPGRADE, "§eBest Upgrade: $upgradeAvailableAt") } - val text = config.statsDisplayList.filter { it.shouldDisplay() }.mapNotNull { map[it] } + val text = config.statsDisplayList.filter { it.shouldDisplay() }.flatMap { map[it]?.split("\n") ?: listOf() } display = listOf(Renderable.clickAndHover( Renderable.verticalContainer(text.map(Renderable::string)), tips = listOf("§bCopy to Clipboard!"), onClick = { val list = text.toMutableList() - val titleHeader = list.indexOf("§6§lChocolate Factory Stats") - if (titleHeader != -1) { - list[titleHeader] = "${LorenzUtils.getPlayerName()}'s Chocolate Factory Stats" - } else { - list.add(0, "${LorenzUtils.getPlayerName()}'s Chocolate Factory Stats") - } + list.add(0, "${LorenzUtils.getPlayerName()}'s Chocolate Factory Stats") + ClipboardUtils.copyToClipboard(list.joinToString("\n") { it.removeColor() }) } )) @@ -152,6 +163,9 @@ object ChocolateFactoryStats { EMPTY_3(""), EMPTY_4(""), TIME_TOWER("§eTime Tower: §62/3 Charges", { ChocolateFactoryTimeTowerManager.currentCharges() != -1 }), + TIME_TOWER_FULL( + "§eTime Tower Full Charges: §b5h 13m 59s\n§bHappens at: Monday, May 13 5:32 AM", + { ChocolateFactoryTimeTowerManager.currentCharges() != -1 || ChocolateFactoryTimeTowerManager.timeTowerFull() }), TIME_TO_PRESTIGE("§eTime To Prestige: §b1d 13h 59m 4s", { ChocolateFactoryAPI.currentPrestige != 5 }), RAW_PER_SECOND("§eRaw Per Second: §62,136"), CHOCOLATE_UNTIL_PRESTIGE("§eChocolate To Prestige: §65,851", { ChocolateFactoryAPI.currentPrestige != 5 }), diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt index e83e60e2bd15..695d1d48040f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt @@ -21,6 +21,7 @@ object ChocolateFactoryTimeTowerManager { private val profileStorage get() = ChocolateFactoryAPI.profileStorage private var lastTimeTowerWarning = SimpleTimeMark.farPast() + private var lastTimeTowerReminder = SimpleTimeMark.farPast() @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { @@ -33,6 +34,10 @@ object ChocolateFactoryTimeTowerManager { if (ChocolateFactoryAPI.inChocolateFactory) return + if (config.timeTowerReminder) { + timeTowerReminder() + } + val nextCharge = SimpleTimeMark(profileStorage.nextTimeTower) if (nextCharge.isInPast() && !nextCharge.isFarPast() && currentCharges() < maxCharges()) { @@ -92,11 +97,42 @@ object ChocolateFactoryTimeTowerManager { fun timeTowerActive(): Boolean { val currentTime = profileStorage?.lastDataSave ?: 0 - val endTime = profileStorage?.currentTimeTowerEnds ?: 0 + val endTime = timeTowerEnds() return endTime > currentTime } + private fun timeTowerEnds(): Long { + return profileStorage?.currentTimeTowerEnds ?: 0 + } + + private fun timeTowerReminder() { + if (lastTimeTowerReminder.passedSince() < 20.seconds) return + + val timeUntil = SimpleTimeMark(timeTowerEnds()).timeUntil() + if (timeUntil < 1.minutes && timeUntil.isPositive()) { + ChatUtils.clickableChat( + "§cYour Time Tower is about to end! " + + "Open the Chocolate Factory to avoid wasting the multiplier!", + onClick = { + HypixelCommands.chocolateFactory() + } + ) + SoundUtils.playBeepSound() + lastTimeTowerReminder = SimpleTimeMark.now() + } + } + + fun timeTowerFullTimemark(): SimpleTimeMark { + val profileStorage = profileStorage ?: return SimpleTimeMark.farPast() + if (timeTowerFull()) return SimpleTimeMark.farPast() + val nextChargeDuration = SimpleTimeMark(profileStorage.nextTimeTower) + val remainingChargesAfter = profileStorage.maxTimeTowerUses - (profileStorage.currentTimeTowerUses + 1) + val endTime = nextChargeDuration + (profileStorage.timeTowerCooldown).hours * remainingChargesAfter + + return endTime + } + fun timeTowerActiveDuration(): Duration { if (!timeTowerActive()) return Duration.ZERO val currentTime = profileStorage?.lastDataSave ?: 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt index a0b87a27cf3a..ab55e5fb2942 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt @@ -3,17 +3,25 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.DisplayTableEntry import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.itemName +import at.hannibal2.skyhanni.utils.ItemUtils.loreCosts import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.groupOrNull +import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.million import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.UtilsPatterns import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -22,13 +30,19 @@ object ChocolateShopPrice { private val config get() = ChocolateFactoryAPI.config.chocolateShopPrice private var display = emptyList() + private var products = emptyList() private val menuNamePattern by ChocolateFactoryAPI.patternGroup.pattern( "shop.title", "Chocolate Shop" ) + private val itemBoughtPattern by ChocolateFactoryAPI.patternGroup.pattern( + "shop.bought", + "§aYou bought §r§.(?[\\w ]+)§r(?:§8 x(?\\d+)§r)?§a!" + ) var inInventory = false + private var callUpdate = false var inventoryItems = emptyMap() @SubscribeEvent @@ -41,51 +55,74 @@ object ChocolateShopPrice { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return - if (!menuNamePattern.matches(event.inventoryName)) return + val isInShop = menuNamePattern.matches(event.inventoryName) + val isInShopOptions = UtilsPatterns.shopOptionsPattern.matches(event.inventoryName) + + if (!isInShop && !isInShopOptions) return + if (event.inventoryItems[48]?.getLore()?.first() != "§7To Chocolate Shop" && isInShopOptions) return inInventory = true + callUpdate = isInShop + inventoryItems = event.inventoryItems + if (!callUpdate) { + products.forEach { it.slot = null } + } update() } - private fun update() { - val multiplier = 1.million - // TODO merge core with SkyMartCopperPrice into a utils - val table = mutableListOf() - val inventoryItems = inventoryItems + private fun updateProducts() { + val newProducts = mutableListOf() for ((slot, item) in inventoryItems) { + val lore = item.getLore() val chocolate = ChocolateFactoryAPI.getChocolateBuyCost(lore) ?: continue val internalName = item.getInternalName() val itemPrice = internalName.getPriceOrNull() ?: continue + val otherItemsPrice = item.loreCosts().sumOf { it.getPrice() }.takeIf { it != 0.0 } + + newProducts.add(Product(slot, item.itemName, internalName, chocolate, itemPrice, otherItemsPrice)) + } + products = newProducts + } - val factor = (itemPrice / chocolate) * multiplier + private fun update() { + if (callUpdate) updateProducts() + + val multiplier = 1.million + // TODO merge core with SkyMartCopperPrice into a utils + val table = mutableListOf() + + for (product in products) { + + val profit = product.itemPrice - (product.otherItemPrice ?: 0.0) + val factor = (profit / product.chocolate) * multiplier val perFormat = NumberUtil.format(factor) - val itemName = item.itemName val hover = buildList { - add(itemName) + add(product.name) add("") - add("§7Item price: §6${NumberUtil.format(itemPrice)} ") - add("§7Chocolate amount: §c${NumberUtil.format(chocolate)} ") - + add("§7Item price: §6${NumberUtil.format(product.itemPrice)} ") + product.otherItemPrice?.let { + add("§7Additional cost: §6${NumberUtil.format(it)} ") + } + add("§7Profit per purchase: §6${NumberUtil.format(profit)} ") add("") + add("§7Chocolate amount: §c${NumberUtil.format(product.chocolate)} ") add("§7Profit per million chocolate: §6${perFormat} ") - add("") - val formattedTimeUntilGoal = ChocolateAmount.CURRENT.formattedTimeUntilGoal(chocolate) + val formattedTimeUntilGoal = ChocolateAmount.CURRENT.formattedTimeUntilGoal(product.chocolate) add("§7Time until affordable: §6$formattedTimeUntilGoal ") - } table.add( DisplayTableEntry( - "$itemName§f:", + "${product.name}§f:", "§6§l$perFormat", factor, - internalName, + product.item, hover, - highlightsOnHoverSlots = listOf(slot) + highlightsOnHoverSlots = product.slot?.let { listOf(it) } ?: emptyList() ) ) } @@ -102,6 +139,7 @@ object ChocolateShopPrice { @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { inInventory = false + callUpdate = false } @SubscribeEvent @@ -115,5 +153,28 @@ object ChocolateShopPrice { } } + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!inInventory) return + itemBoughtPattern.matchMatcher(event.message) { + val item = group("item") + val amount = groupOrNull("amount")?.toIntOrNull() ?: 1 + val product = products.find { it.name.removeColor() == item } ?: return + + ChocolateAmount.addToCurrent(product.chocolate * -amount) + } + + } + private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled + + private data class Product( + var slot: Int?, + val name: String, + val item: NEUInternalName, + val chocolate: Long, + val itemPrice: Double, + val otherItemPrice: Double?, + ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt index 07d96854b4d2..9da53010e88d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt @@ -38,7 +38,7 @@ class HighlightMiningCommissionMobs { // Crystal Hollows AUTOMATON("Automaton Slayer", { it is EntityIronGolem }), TEAM_TREASURITE_MEMBER("Team Treasurite Member Slayer", { it.name == "Team Treasurite" }), - YOG("Yog Slayer", { it is EntityMagmaCube }), + YOG("Yog Slayer", { it is EntityMagmaCube && it.hasMaxHealth(35_000) }), THYST("Thyst Slayer", { it is EntityEndermite && it.hasMaxHealth(5_000) }), CORLEONE("Corleone Slayer", { it.hasMaxHealth(1_000_000) && it.name == "Team Treasurite" }), SLUDGE("Sludge Slayer", { diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt index db2ad5a01c7c..10e5a365cd15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningCommissionsBlocksColor.kt @@ -10,7 +10,6 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent -import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzUtils @@ -106,7 +105,6 @@ object MiningCommissionsBlocksColor { if (block.highlight != newValue) { if (newValue && block in ignoredTabListCommissions) continue block.highlight = newValue - ChatUtils.debug("changed from tab list: ${block.displayName} -> $newValue") dirty = true } } @@ -124,7 +122,6 @@ object MiningCommissionsBlocksColor { block.highlight = false dirty = true ignoredTabListCommissions.add(block) - ChatUtils.debug("finished from chat: $name") } } @@ -137,7 +134,9 @@ object MiningCommissionsBlocksColor { inCrystalHollows = IslandType.CRYSTAL_HOLLOWS.isInIsland() && HypixelData.skyBlockArea != "Crystal Nucleus" } - val newEnabled = (inDwarvenMines || inCrystalHollows || inGlaciteArea) && config.enabled + // TODO add dwarven mines support +// val newEnabled = (inDwarvenMines || inCrystalHollows || inGlaciteArea) && config.enabled + val newEnabled = (inCrystalHollows || inGlaciteArea) && config.enabled var reload = false if (newEnabled != enabled) { enabled = newEnabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index e0f787822bbf..7fa5700f03ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -29,8 +29,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils -import at.hannibal2.skyhanni.utils.LocationUtils.canBeSeen import at.hannibal2.skyhanni.utils.LocationUtils.distanceTo +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec @@ -199,10 +199,12 @@ class MinionFeatures { } private fun removeBuggedMinions() { + if (!IslandType.PRIVATE_ISLAND.isInIsland()) return val minions = minions ?: return val removedEntities = mutableListOf() for (location in minions.keys) { + if (location.distanceToPlayer() > 30) continue val entitiesNearby = EntityUtils.getEntities().map { it.distanceTo(location) } if (!entitiesNearby.any { it == 0.0 }) { removedEntities.add(location) @@ -339,7 +341,7 @@ class MinionFeatures { val minions = minions ?: return for (minion in minions) { val location = minion.key.add(y = 1.0) - if (!location.canBeSeen()) continue + if (location.distanceToPlayer() > 50) continue val lastEmptied = minion.value.lastClicked if (playerLocation.distance(location) >= config.emptiedTime.distance) continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt index 2dac01bb2986..09ee41e8d298 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt @@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent /** * I need these features in my dev env */ -class MiscFeatures { +object MiscFeatures { @SubscribeEvent fun onEnderTeleport(event: EnderTeleportEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index df0555572e5c..42b6d4251153 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -220,7 +220,7 @@ class NonGodPotEffectDisplay { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { val packet = event.packet if (!checkFooter) return if (packet is S47PacketPlayerListHeaderFooter) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt index 3a93588b6547..c770a1fab01e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ReplaceRomanNumerals.kt @@ -4,16 +4,16 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.hypixel.chat.event.SystemMessageEvent import at.hannibal2.skyhanni.events.ChatHoverEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.features.inventory.patternGroup import at.hannibal2.skyhanni.mixins.hooks.GuiChatHook import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.applyIfPossible import at.hannibal2.skyhanni.utils.StringUtils.isRoman +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import net.minecraft.event.ClickEvent import net.minecraft.event.HoverEvent import net.minecraft.util.ChatComponentText -import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -21,6 +21,16 @@ class ReplaceRomanNumerals { // Using toRegex here since toPattern doesn't seem to provide the necessary functionality private val splitRegex = "((§\\w)|(\\s+)|(\\W))+|(\\w*)".toRegex() + // + /** + * REGEX-TEST: §eSelect an option: §r§a[§aOk, then what?§a] + */ + private val isSelectOptionPattern by patternGroup.pattern( + "string.isselectoption", + "§eSelect an option: .*" + ) + + // TODO: Remove after pr 1717 is ready and switch to ItemHoverEvent @SubscribeEvent(priority = EventPriority.LOWEST) fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return @@ -44,12 +54,14 @@ class ReplaceRomanNumerals { @SubscribeEvent fun onSystemMessage(event: SystemMessageEvent) { - if (!isEnabled()) return + if (!isEnabled() || event.message.isSelectOption()) return event.applyIfPossible { it.transformLine() } } + private fun String.isSelectOption(): Boolean = isSelectOptionPattern.matches(this) + private fun String.transformLine() = splitRegex.findAll(this).map { it.value }.joinToString("") { - it.takeIf { it.isValidRomanNumeral() }?.coloredRomanToDecimal() ?: it + it.takeIf { it.isValidRomanNumeral() && it.removeFormatting().romanToDecimal() != 2000 }?.coloredRomanToDecimal() ?: it } private fun String.removeFormatting() = removeColor().replace(",", "") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 6943c97e514f..c394e3a71676 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -81,7 +81,7 @@ class TpsCounter { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!config.tpsDisplay) return hasPacketReceived = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt index a44be9824bce..d010198dd7c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.misc.items.enchants import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.features.chroma.ChromaManager +import at.hannibal2.skyhanni.utils.LorenzColor import com.google.gson.annotations.Expose import java.util.TreeSet @@ -25,11 +27,18 @@ open class Enchant : Comparable { open fun getFormat(level: Int): String { val config = SkyHanniMod.feature.inventory.enchantParsing + // TODO change color to string (support for bold) - if (level >= maxLevel) return config.perfectEnchantColor.get().getChatColor() - if (level > goodLevel) return config.greatEnchantColor.get().getChatColor() - if (level == goodLevel) return config.goodEnchantColor.get().getChatColor() - return config.poorEnchantColor.get().getChatColor() + val colour = when { + level >= maxLevel -> config.perfectEnchantColor + level > goodLevel -> config.greatEnchantColor + level == goodLevel -> config.goodEnchantColor + else -> config.poorEnchantColor + } + + // TODO when chroma is disabled maybe use the neu chroma style instead of gold + if (colour.get() == LorenzColor.CHROMA && !(ChromaManager.config.enabled.get() || EnchantParser.isSbaLoaded)) return "§6§l" + return colour.get().getChatColor() } override fun toString() = "$nbtName $goodLevel $maxLevel\n" diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt index 593e844d49db..5c8f9b893d64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.ChatHoverEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.features.chroma.ChromaManager import at.hannibal2.skyhanni.mixins.hooks.GuiChatHook import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ConditionalUtils @@ -22,6 +23,7 @@ import net.minecraft.event.HoverEvent import net.minecraft.item.ItemStack import net.minecraft.util.ChatComponentText import net.minecraft.util.IChatComponent +import net.minecraftforge.fml.common.Loader import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.TreeSet @@ -58,6 +60,8 @@ object EnchantParser { private val loreCache: Cache = Cache() + val isSbaLoaded by lazy { Loader.isModLoaded("skyblockaddons") } + // Maps for all enchants private var enchants: EnchantsJson = EnchantsJson() @@ -79,6 +83,7 @@ object EnchantParser { config.commaFormat, config.hideVanillaEnchants, config.hideEnchantDescriptions, + ChromaManager.config.enabled, ) { markCacheDirty() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index b855a49c8f70..614dcb7e73bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -4,12 +4,12 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed @@ -34,6 +34,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.findMatcher import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.getLorenzVec @@ -84,6 +85,10 @@ object TrevorFeatures { "clickoption", "Click an option: §r§a§l\\[YES]§r§7 - §r§c§l\\[NO]" ) + private val areaTrappersDenPattern by patternGroup.pattern( + "area.trappersden", + "Trapper's Den" + ) private var timeUntilNextReady = 0 private var trapperReady: Boolean = true @@ -98,6 +103,7 @@ object TrevorFeatures { var questActive = false var inBetweenQuests = false + var inTrapperDen = false private val config get() = SkyHanniMod.feature.misc.trevorTheTrapper @@ -302,7 +308,7 @@ object TrevorFeatures { @SubscribeEvent(priority = EventPriority.HIGHEST) fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!inTrapperDen()) return + if (!inTrapperDen) return if (!config.trapperTalkCooldown) return val entity = event.entity if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { @@ -323,6 +329,11 @@ object TrevorFeatures { resetTrapper() } + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + inTrapperDen = areaTrappersDenPattern.matches(LorenzUtils.skyBlockArea) + } + enum class TrapperStatus(baseColor: LorenzColor) { READY(LorenzColor.DARK_GREEN), WAITING(LorenzColor.DARK_AQUA), @@ -335,8 +346,6 @@ object TrevorFeatures { fun onFarmingIsland() = IslandType.THE_FARMING_ISLANDS.isInIsland() - fun inTrapperDen() = ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §bTrapper's Den") - @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(11, "misc.trevorTheTrapper.textFormat") { element -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt index 73aee171e917..cc3be8af74bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt @@ -137,7 +137,7 @@ object TrevorTracker { private fun shouldDisplay(): Boolean { if (!config.dataTracker) return false if (!TrevorFeatures.onFarmingIsland()) return false - if (TrevorFeatures.inTrapperDen()) return true + if (TrevorFeatures.inTrapperDen) return true return when (config.displayType) { true -> (TrevorFeatures.inBetweenQuests || TrevorFeatures.questActive) else -> TrevorFeatures.questActive diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt index 120f8b914276..4565e68033d4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt @@ -4,11 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent -import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -16,21 +14,20 @@ class VolcanoExplosivityDisplay { private val config get() = SkyHanniMod.feature.crimsonIsle private val patternGroup = RepoPattern.group("crimson.volcano") - private val headerPattern by patternGroup.pattern( - "header.tablistline", - "(?:§.)*Volcano Explosivity:(?:[\\S ]+)*" - ) + + /** + * REGEX-TEST: Volcano: §r§8INACTIVE + */ private val statusPattern by patternGroup.pattern( - "status.tablistline", - " *(?(?:§.)*\\S+)" + "tablistline", + " *Volcano: (?(?:§.)*\\S+)" ) private var display = "" @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { if (!isEnabled()) return - val text = event.tabList.nextAfter({ headerPattern.matches(it) }) ?: return - statusPattern.matchMatcher(text) { + event.tabList.matchFirst(statusPattern) { display = "§bVolcano Explosivity§7: ${group("status")}" } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt index eab95363b410..28b03f597272 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -71,6 +72,12 @@ class HideMobNames { } } + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + lastMobName.clear() + mobNamesHidden.clear() + } + private fun shouldNameBeHidden(name: String): Boolean { for (pattern in patterns) { pattern.matchMatcher(name) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index a90d0eb9f4ba..95ba800608ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -1,130 +1,91 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.SlayerAPI import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent -import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.ItemClickEvent +import at.hannibal2.skyhanni.events.ScoreboardChangeEvent +import at.hannibal2.skyhanni.features.event.diana.DianaAPI +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter +import at.hannibal2.skyhanni.utils.DelayedRun +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.getLorenzVec -import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.entity.EntityLivingBase import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds class SlayerQuestWarning { private val config get() = SkyHanniMod.feature.slayer - private val talkToMaddoxPattern by RepoPattern.pattern( - "slayer.questwarning.talkto", - " {3}§r§5§l» §r§7Talk to Maddox to claim your .+ Slayer XP!" - ) + private var lastWeaponUse = SimpleTimeMark.farPast() + private val voidItem = "ASPECT_OF_THE_VOID".asInternalName() + private val endItem = "ASPECT_OF_THE_END".asInternalName() - private var needSlayerQuest = false - private var lastWarning = 0L - private var currentReason = "" - private var dirtySidebar = false - private var hasAutoSlayer = false + private val outsideRiftData = SlayerData() + private val insideRiftData = SlayerData() - // TODO add check if player has clicked on an item, before mobs around you gets damage + class SlayerData { + var currentSlayerState: String? = null + var lastSlayerType: SlayerType? = null + } @SubscribeEvent - fun onChat(event: LorenzChatEvent) { - if (!(LorenzUtils.inSkyBlock)) return + fun onScoreboardChange(event: ScoreboardChangeEvent) { + val slayerType = event.newList.nextAfter("Slayer Quest") + val slayerProgress = event.newList.nextAfter("Slayer Quest", skip = 2) ?: "no slayer" + val new = slayerProgress.removeColor() + val slayerData = getSlayerData() - val message = event.message + if (slayerData.currentSlayerState == new) return - // died - if (message == " §r§c§lSLAYER QUEST FAILED!") { - needNewQuest("The old slayer quest has failed!") - } - if (message == " §r§5§lSLAYER QUEST STARTED!") { - needSlayerQuest = false - hasAutoSlayer = true - dirtySidebar = true + slayerData.currentSlayerState?.let { + change(it, new) } - - // no auto slayer - talkToMaddoxPattern.matchMatcher(message) { - needNewQuest("You have no Auto-Slayer active!") + slayerData.currentSlayerState = new + slayerType?.let { + slayerData.lastSlayerType = SlayerType.getByName(it) } - if (message == " §r§a§lSLAYER QUEST COMPLETE!") { - needSlayerQuest = false - } - - if (message == "§aYour Slayer Quest has been cancelled!") { - needSlayerQuest = false - } - - // TODO auto slayer disabled bc of no more money in bank or purse } - private fun needNewQuest(reason: String) { - currentReason = reason - needSlayerQuest = true - } - - @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - if (!(LorenzUtils.inSkyBlock)) return + private fun getSlayerData() = if (RiftAPI.inRift()) outsideRiftData else insideRiftData - if (dirtySidebar && event.repeatSeconds(3)) { - checkSidebar() - } - } - - private fun checkSidebar() { - var loaded = false - - var slayerQuest = false - var bossSlain = false - var slayBoss = false - var nextIsType = false - for (line in ScoreboardData.sidebarLinesFormatted) { - if (nextIsType) { - nextIsType = false - } - if (line == "Slayer Quest") { - slayerQuest = true - nextIsType = true + private fun change(old: String, new: String) { + if (new.contains("Combat")) { + if (!old.contains("Combat")) { + needSlayerQuest = false } - if (line == "§aBoss slain!") { - bossSlain = true - } - if (line == "§eSlay the boss!") { - slayBoss = true - } - if (line == "§ewww.hypixel.net" || line == "§ewww.alpha.hypixel.net") { - loaded = true + } + if (new == "no slayer") { + if (old == "Slay the boss!") { + needNewQuest("The old slayer quest has failed!") } } - - if (loaded) { - dirtySidebar = false - if (slayerQuest && !needSlayerQuest) { - if (bossSlain) { - if (!hasAutoSlayer) { - needNewQuest("You have no Auto-Slayer active!") - hasAutoSlayer = false - } - } else if (slayBoss) { - needNewQuest("You probably switched the server during an active boss and now hypixel doesn't know what to do.") + if (new == "Boss slain!") { + DelayedRun.runDelayed(2.seconds) { + if (getSlayerData().currentSlayerState == "Boss slain!") { + needNewQuest("You have no Auto-Slayer active!") } } } } - @SubscribeEvent - fun onWorldChange(event: LorenzWorldChangeEvent) { - if (!needSlayerQuest) { - dirtySidebar = true - } + private var needSlayerQuest = false + private var lastWarning = 0L + private var currentReason = "" + + private fun needNewQuest(reason: String) { + currentReason = reason + needSlayerQuest = true } private fun tryWarn() { @@ -136,6 +97,10 @@ class SlayerQuestWarning { if (!config.questWarning) return if (lastWarning + 10_000 > System.currentTimeMillis()) return + if (DianaAPI.isDoingDiana()) return + // prevent warnings when mobs are hit by other players + if (lastWeaponUse.passedSince() > 500.milliseconds) return + lastWarning = System.currentTimeMillis() ChatUtils.chat(chatMessage) @@ -170,7 +135,23 @@ class SlayerQuestWarning { ) } } + return (getSlayerData().lastSlayerType == slayerType) && slayerType.clazz.isInstance(entity) + } - return slayerType.clazz.isInstance(entity) + @SubscribeEvent + fun onItemClick(event: ItemClickEvent) { + val internalName = event.itemInHand?.getInternalNameOrNull() + + if (event.clickType == ClickType.RIGHT_CLICK) { + if (internalName == voidItem || internalName == endItem) { + // ignore harmless teleportation + return + } + if (internalName == null) { + // ignore harmless right click + return + } + } + lastWeaponUse = SimpleTimeMark.now() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt index c7a1f2fde3f6..0fc237b0d248 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt @@ -14,4 +14,8 @@ enum class SlayerType(val displayName: String, val rngName: String, val clazz: C INFERNO("Inferno Demonlord", "inferno", EntityBlaze::class.java), VAMPIRE("Riftstalker Bloodfiend", "vampire", EntityZombie::class.java) ; + + companion object { + fun getByName(name: String): SlayerType? = entries.firstOrNull {name.contains(it.displayName)} + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt index 24fda1ae8407..d501e3f0d892 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha import at.hannibal2.skyhanni.utils.LorenzUtils @@ -19,6 +20,11 @@ class HellionShieldHelper { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "slayer.blazeColoredMobs", "slayer.blazes.hellion.coloredMobs") } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + hellionShieldMobs.clear() + } } fun EntityLiving.setHellionShield(shield: HellionShield?) { diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt index 5903136fa810..7622ac4962f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt @@ -9,6 +9,8 @@ import net.minecraft.util.BlockPos import net.minecraft.world.IBlockAccess import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable + +// Taken and modified from Skytils fun modifyGetModelFromBlockState( blockRendererDispatcher: BlockRendererDispatcher, state: IBlockState?, diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt index ccdb69cdb2c6..ad6232646d4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt @@ -15,6 +15,8 @@ import net.minecraft.client.renderer.GlStateManager */ object FontRendererHook { + private val config get() = ChromaManager.config + private const val CHROMA_FORMAT_INDEX = 22 private const val WHITE_FORMAT_INDEX = 15 @@ -63,9 +65,8 @@ object FontRendererHook { @JvmStatic fun beginChromaRendering(text: String, shadow: Boolean) { - if (!LorenzUtils.inSkyBlock) return - if (!ChromaManager.config.enabled) return - if (ChromaManager.config.allChroma && ChromaManager.config.ignoreChat && cameFromChat) { + if (!isEnabled()) return + if (config.allChroma && config.ignoreChat && cameFromChat) { endChromaFont() return } @@ -78,7 +79,7 @@ object FontRendererHook { currentDrawState = if (shadow) DRAW_CHROMA_SHADOW else DRAW_CHROMA // Best feature ngl - if (ChromaManager.config.allChroma) { + if (config.allChroma) { // Handles setting the base color of text when they don't use color codes i.e. MoulConfig if (shadow) { GlStateManager.color(0.33f, 0.33f, 0.33f, RenderUtils.getAlpha()) @@ -100,9 +101,7 @@ object FontRendererHook { @JvmStatic fun forceWhiteColorCode(formatIndex: Int): Int { - if (!LorenzUtils.inSkyBlock) return formatIndex - - if (!ChromaManager.config.enabled) return formatIndex + if (!isEnabled()) return formatIndex val drawState = currentDrawState ?: return formatIndex if (drawState.getChromaState() && formatIndex <= WHITE_FORMAT_INDEX) { // If it's a color code @@ -114,40 +113,40 @@ object FontRendererHook { @JvmStatic fun restoreChromaState() { - if (!LorenzUtils.inSkyBlock) return - if (!ChromaManager.config.enabled) return + if (!isEnabled()) return currentDrawState?.restoreChromaEnv() } @JvmStatic fun endChromaRendering() { - if (!LorenzUtils.inSkyBlock) return - if (!ChromaManager.config.enabled) return + if (!isEnabled()) return if (previewChroma) { previewChroma = false endChromaFont() } - if (ChromaManager.config.allChroma) endChromaFont() + if (config.allChroma) endChromaFont() currentDrawState?.endChromaEnv() } @JvmStatic fun insertZColorCode(constant: String): String { - return if (LorenzUtils.inSkyBlock && !ChromaManager.config.enabled) constant else "0123456789abcdefklmnorz" + return if (LorenzUtils.inSkyBlock && !isChromaEnabled()) constant else "0123456789abcdefklmnorz" } @JvmStatic fun toggleChromaAndResetStyle(formatIndex: Int): Boolean { - if (!LorenzUtils.inSkyBlock) return false - if (!ChromaManager.config.enabled) return false + if (!isEnabled()) return false if (formatIndex == CHROMA_FORMAT_INDEX) { toggleChromaOn() return true } return false } + + private fun isChromaEnabled() = config.enabled.get() + private fun isEnabled() = LorenzUtils.inSkyBlock && isChromaEnabled() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt index 92e545a44bf5..25d415889b0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt @@ -11,7 +11,7 @@ class MixinPatcherFontRendererHookHook { fun overridePatcherFontRenderer(string: String, shadow: Boolean, cir: CallbackInfoReturnable) { if (!LorenzUtils.onHypixel) return - if (ChromaManager.config.enabled) { + if (ChromaManager.config.enabled.get()) { cir.cancel() cir.returnValue = false } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java index 6269e17f9fb9..7c4265897b4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java @@ -12,6 +12,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +// Taken from Skytils @Mixin(BlockRendererDispatcher.class) public abstract class MixinBlockRendererDispatcher implements IResourceManagerReloadListener { @Inject(method = "getModelFromBlockState", at = @At("RETURN"), cancellable = true) diff --git a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt index fdf023a068d1..3653e01fa554 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/PacketTest.kt @@ -90,7 +90,7 @@ object PacketTest { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!enabled) return val packet = event.packet packet.print() diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt index c76d7318ff40..2ca9bce5bdf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyParticlesCommand.kt @@ -34,7 +34,7 @@ object CopyNearbyParticlesCommand { } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) - fun onChatPacket(event: PacketEvent.ReceiveEvent) { + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { if (!saveNextTick) return // command was sent in or around a tick so skipping the tick if (System.currentTimeMillis() <= searchTime + 5) return diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index d1dce7fe3060..1448cd250b98 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.chat.Text.prefix import at.hannibal2.skyhanni.utils.chat.Text.url import net.minecraft.client.Minecraft import net.minecraft.util.ChatComponentText +import net.minecraft.util.ChatStyle import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.LinkedList @@ -125,6 +126,7 @@ object ChatUtils { * Sends a message to the user that they can click and run an action * @param message The message to be sent * @param onClick The runnable to be executed when the message is clicked + * @param hover The string to be shown when the message is hovered * @param expireAt When the click action should expire, default never * @param prefix Whether to prefix the message with the chat prefix, default true * @param prefixColor Color that the prefix should be, default yellow (§e) @@ -134,6 +136,7 @@ object ChatUtils { fun clickableChat( message: String, onClick: () -> Any, + hover: String = "§eClick here!", expireAt: SimpleTimeMark = SimpleTimeMark.farFuture(), prefix: Boolean = true, prefixColor: String = "§e", @@ -142,7 +145,7 @@ object ChatUtils { val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" chat(Text.text(msgPrefix + message) { this.onClick(expireAt, oneTimeClick, onClick) - this.hover = "§eClick here!".asComponent() + this.hover = hover.asComponent() }) } @@ -268,4 +271,11 @@ object ChatUtils { } ) } + + fun IChatComponent.changeColor(color: LorenzColor): IChatComponent { + chatStyle = ChatStyle().also { + it.color = color.toChatFormatting() + } + return this + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 70fdb6c4e62d..a6564f1969bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -191,7 +191,7 @@ object EntityUtils { @SubscribeEvent fun onEntityRenderPost(event: RenderLivingEvent.Post<*>) { - SkyHanniRenderEntityEvent.Post(event.entity, event.renderer, event.x, event.y, event.z) + SkyHanniRenderEntityEvent.Post(event.entity, event.renderer, event.x, event.y, event.z).postAndCatch() } @SubscribeEvent @@ -204,7 +204,7 @@ object EntityUtils { @SubscribeEvent fun onEntityRenderSpecialsPost(event: RenderLivingEvent.Specials.Post<*>) { - SkyHanniRenderEntityEvent.Specials.Post(event.entity, event.renderer, event.x, event.y, event.z) + SkyHanniRenderEntityEvent.Specials.Post(event.entity, event.renderer, event.x, event.y, event.z).postAndCatch() } fun EntityLivingBase.isCorrupted() = baseMaxHealth == health.toInt().derpy() * 3 || isRunicAndCorrupt() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt index 8962e402e35a..e68af00ca8f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -401,7 +401,7 @@ object GuiRenderUtils { GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.shadeModel(7425) val tessellator = Tessellator.getInstance() val worldRenderer = tessellator.worldRenderer diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt index a2328297da1d..10ef1f737aef 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt @@ -54,6 +54,10 @@ object HypixelCommands { send("party transfer $player") } + fun particleQuality(quality: String) { + send("pq $quality") + } + fun partyAllInvite() { send("party settings allinvite") } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt index d4aa86b50030..e1a277d36800 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt @@ -73,7 +73,7 @@ object ItemNameResolver { UtilsPatterns.enchantmentNamePattern.matchMatcher(enchantmentName) { val name = group("name").trim { it <= ' ' } val ultimate = group("format").lowercase().contains("§l") - ((if (ultimate && name != "Ultimate Wise") "ULTIMATE_" else "") + ((if (ultimate && name != "Ultimate Wise" && name != "Ultimate Jerry") "ULTIMATE_" else "") + turboCheck(name).replace(" ", "_").replace("-", "_").uppercase() + ";" + group("level").romanToDecimal()) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index c7c70d949432..be314a03032a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -111,7 +111,8 @@ object ItemUtils { if (name == "§fWisp's Ice-Flavored Water I Splash Potion") { return NEUInternalName.WISP_POTION } - return NEUItems.getInternalName(this)?.asInternalName() + val internalName = NEUItems.getInternalName(this)?.replace("ULTIMATE_ULTIMATE_", "ULTIMATE_") + return internalName?.asInternalName() } fun ItemStack.isVanilla() = NEUItems.isVanillaItem(this) @@ -386,4 +387,23 @@ object ItemUtils { } return name } + + fun ItemStack.loreCosts(): MutableList { + var found = false + val list = mutableListOf() + for (lines in getLore()) { + if (lines == "§7Cost") { + found = true + continue + } + + if (!found) continue + if (lines.isEmpty()) return list + + NEUInternalName.fromItemNameOrNull(lines)?.let { + list.add(it) + } + } + return list + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index bb9ab0c036c4..8309a8f86466 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.test.command.ErrorManager import net.minecraft.item.EnumDyeColor +import net.minecraft.util.EnumChatFormatting import java.awt.Color enum class LorenzColor(val chatColorCode: Char, private val color: Color, private val coloredLabel: String) { @@ -62,6 +63,9 @@ enum class LorenzColor(val chatColorCode: Char, private val color: Color, privat CHROMA -> EnumDyeColor.WHITE } + fun toChatFormatting(): EnumChatFormatting? = + EnumChatFormatting.entries.firstOrNull { it.toString() == getChatColor() } + companion object { fun EnumDyeColor.toLorenzColor() = when (this) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 7d37953b1e63..20bf02bb7dac 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -216,7 +216,7 @@ object RenderUtils { GlStateManager.disableLighting() GlStateManager.enableCull() GlStateManager.enableTexture2D() - GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, 1, 1, 0) GlStateManager.enableBlend() GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) val time = Minecraft.getMinecraft().theWorld.totalWorldTime + partialTicks.toDouble() @@ -433,7 +433,7 @@ object RenderUtils { GlStateManager.scale(finalScale, finalScale, finalScale) GlStateManager.enableBlend() GlStateManager.disableLighting() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableTexture2D() minecraft.fontRendererObj.drawString( finalText, @@ -675,7 +675,7 @@ object RenderUtils { GlStateManager.enableBlend() GlStateManager.depthFunc(GL11.GL_LEQUAL) GlStateManager.disableCull() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableAlpha() GlStateManager.disableTexture2D() @@ -733,7 +733,7 @@ object RenderUtils { GlStateManager.enableBlend() GlStateManager.depthFunc(GL11.GL_LEQUAL) GlStateManager.disableCull() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableAlpha() GlStateManager.disableTexture2D() color.bindColor() @@ -785,7 +785,7 @@ object RenderUtils { GlStateManager.enableBlend() GlStateManager.depthFunc(GL11.GL_LEQUAL) GlStateManager.disableCull() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.enableAlpha() GlStateManager.disableTexture2D() color.bindColor() @@ -986,7 +986,7 @@ object RenderUtils { } GlStateManager.pushMatrix() GlStateManager.enableBlend() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) val minecraft = Minecraft.getMinecraft() val fontRenderer = minecraft.fontRendererObj @@ -1049,7 +1049,7 @@ object RenderUtils { fun drawFilledBoundingBox(aabb: AxisAlignedBB, c: Color, alphaMultiplier: Float = 1f) { GlStateManager.enableBlend() GlStateManager.disableLighting() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.disableTexture2D() val tessellator = Tessellator.getInstance() val worldRenderer = tessellator.worldRenderer @@ -1533,7 +1533,7 @@ object RenderUtils { GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GL11.glLineWidth(lineWidth.toFloat()) if (!depth) { GL11.glDisable(GL11.GL_DEPTH_TEST) @@ -1732,7 +1732,7 @@ object RenderUtils { GlStateManager.disableTexture2D() GlStateManager.enableBlend() GlStateManager.disableAlpha() - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0) GlStateManager.shadeModel(7425) val tessellator = Tessellator.getInstance() val worldrenderer = tessellator.worldRenderer diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt b/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt index 5178798a9b9b..d818facfe271 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SimpleTimeMark.kt @@ -1,6 +1,9 @@ package at.hannibal2.skyhanni.utils import java.time.Instant +import java.time.LocalDateTime +import java.time.ZoneId +import java.time.format.DateTimeFormatter import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds @@ -32,6 +35,13 @@ value class SimpleTimeMark(private val millis: Long) : Comparable? = getExtraAttributes()?.takeIf { it.hasKey("enchantments") }?.run { val enchantments = this.getCompoundTag("enchantments") enchantments.keySet.associateWith { enchantments.getInteger(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt index 2e06ba423fb1..fb596bea79a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.UtilsPatterns.seasonPattern +import kotlin.time.Duration.Companion.seconds enum class SkyblockSeason( val season: String, @@ -20,7 +21,11 @@ enum class SkyblockSeason( companion object { - fun getCurrentSeason(): SkyblockSeason? = getSeasonByName(SkyBlockTime.now().monthName) + fun getCurrentSeason(): SkyblockSeason? = currentSeason.getValue() + + private val currentSeason = RecalculatingValue(1.seconds) { + getSeasonByName(SkyBlockTime.now().monthName) + } private fun getSeasonByName(name: String): SkyblockSeason? = seasonPattern.matchMatcher(name) { entries.find { it.season.endsWith(group("season")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index 1ba5bc8faa3e..ea930bee4e66 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.events.TablistFooterUpdateEvent import at.hannibal2.skyhanni.mixins.hooks.tabListGuard @@ -14,6 +15,7 @@ import com.google.common.collect.Ordering import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.client.network.NetworkPlayerInfo +import net.minecraft.network.play.server.S38PacketPlayerListItem import net.minecraft.world.WorldSettings import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.relauncher.Side @@ -106,9 +108,19 @@ object TabListData { return result.dropLast(1) } + var dirty = false + + @SubscribeEvent(receiveCanceled = true) + fun onPacketReceive(event: PacketEvent.ReceiveEvent) { + if (event.packet is S38PacketPlayerListItem) { + dirty = true + } + } + @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (!event.isMod(2)) return + if (!dirty) return + dirty = false val tabList = readTabList() ?: return if (tablistCache != tabList) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt index d903ada07741..8b4b0c3724be 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedCache.kt @@ -4,10 +4,15 @@ import com.google.common.cache.CacheBuilder import java.util.concurrent.TimeUnit import kotlin.time.Duration -class TimeLimitedCache(expireAfterWrite: Duration) { +class TimeLimitedCache( + expireAfterWrite: Duration, + private val removalListener: (K?, V?) -> Unit = { _, _ -> }, +) { private val cache = CacheBuilder.newBuilder() - .expireAfterWrite(expireAfterWrite.inWholeMilliseconds, TimeUnit.MILLISECONDS).build() + .expireAfterWrite(expireAfterWrite.inWholeMilliseconds, TimeUnit.MILLISECONDS) + .removalListener { removalListener(it.key, it.value) } + .build() fun put(key: K, value: V) = cache.put(key, value) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt index 39dac5247f5b..5f0ccd4040aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt @@ -2,9 +2,12 @@ package at.hannibal2.skyhanni.utils import kotlin.time.Duration -class TimeLimitedSet(expireAfterWrite: Duration) { +class TimeLimitedSet( + expireAfterWrite: Duration, + private val removalListener: (T) -> Unit = {}, +) { - private val cache = TimeLimitedCache(expireAfterWrite) + private val cache = TimeLimitedCache(expireAfterWrite) { key, _ -> key?.let { removalListener(it) } } fun add(element: T) = cache.put(element, Unit) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt index 989204c0ae9d..075bf95025e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt @@ -28,9 +28,13 @@ object UtilsPatterns { ".{2}Abiphone .*" ) + /** + * REGEX-TEST: §fEnchanted Book + * REGEX-TEST: §f§f§fEnchanted Book + */ val enchantedBookPattern by patternGroup.pattern( "item.name.enchanted.book", - ".{2}?Enchanted Book" + "(?:§.)+Enchanted Book" ) val baitPattern by patternGroup.pattern( @@ -92,4 +96,9 @@ object UtilsPatterns { "tablist.profile", "(?:§.)+Profile: §r§a(?[\\w\\s]+[^ §]).*" ) + + val shopOptionsPattern by patternGroup.pattern( + "inventory.shopoptions", + "Shop Trading Options" + ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt index 6c1e0bd2e0c6..b26d88c4bb49 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt @@ -26,6 +26,7 @@ import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderYAligned import io.github.notenoughupdates.moulconfig.gui.GuiScreenElementWrapper import net.minecraft.client.Minecraft import net.minecraft.client.gui.Gui +import net.minecraft.client.gui.GuiIngameMenu import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraft.client.renderer.GlStateManager import net.minecraft.item.ItemStack @@ -150,6 +151,7 @@ interface Renderable { override fun render(posX: Int, posY: Int) { if (isHovered(posX, posY) && condition() && shouldAllowLink(true, bypassChecks) && (button - 100).isKeyClicked() + && !NEUItems.neuHasFocus() && Minecraft.getMinecraft().currentScreen !is GuiIngameMenu ) { onClick() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt index 14e4fde134a1..61149866bf9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableTooltips.kt @@ -2,10 +2,12 @@ package at.hannibal2.skyhanni.utils.renderables import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned import io.github.moulberry.notenoughupdates.util.Utils import net.minecraft.client.Minecraft +import net.minecraft.client.gui.GuiIngameMenu import net.minecraft.client.gui.ScaledResolution import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.RenderHelper @@ -41,6 +43,7 @@ object RenderableTooltips { val tooltip = tooltip ?: return val tips = tooltip.tips if (tips.isEmpty()) return + if (NEUItems.neuHasFocus() || Minecraft.getMinecraft().currentScreen is GuiIngameMenu) return val x = Utils.getMouseX() + 12 val y = Utils.getMouseY() - if (tips.size > 1) 2 else -7