66import com .fix3dll .skyblockaddons .core .InventoryType ;
77import com .fix3dll .skyblockaddons .core .Island ;
88import com .fix3dll .skyblockaddons .core .ItemType ;
9+ import com .fix3dll .skyblockaddons .core .PetInfo ;
910import com .fix3dll .skyblockaddons .core .PlayerStat ;
1011import com .fix3dll .skyblockaddons .core .SkillType ;
1112import com .fix3dll .skyblockaddons .core .SkyblockKeyBinding ;
1213import com .fix3dll .skyblockaddons .core .SkyblockOre ;
1314import com .fix3dll .skyblockaddons .core .SkyblockRarity ;
15+ import com .fix3dll .skyblockaddons .core .SkyblockRune ;
1416import com .fix3dll .skyblockaddons .core .Translations ;
1517import com .fix3dll .skyblockaddons .core .feature .Feature ;
1618import com .fix3dll .skyblockaddons .core .feature .FeatureSetting ;
@@ -1302,12 +1304,16 @@ private void flyingCheck() {
13021304 *
13031305 * <p>Depending on the enabled {@link FeatureSetting settings}, the following lines may be added:
13041306 * <ul>
1307+ * <li><b>Lowest BIN prices</b> - from <a href="https://moulberry.codes">moulberry.codes</a></li>
13051308 * <li><b>Bazaar buy/sell prices</b> — resolved via the Hypixel Bazaar API.
13061309 * Enchanted books are looked up by their enchantment ID
13071310 * (e.g. {@code ENCHANTMENT_SHARPNESS_5}) rather than {@code ENCHANTED_BOOK}.</li>
13081311 * <li><b>NPC sell price</b> — resolved from the SkyBlock items API.</li>
13091312 * </ul>
13101313 *
1314+ * <p>Special item types (PET, RUNE, NEW_YEAR_CAKE, POTION, perfect stat boost items)
1315+ * are resolved to their API-specific item IDs before lookup.
1316+ *
13111317 * <p>If {@link FeatureSetting#ALWAYS_SHOW_BULK_PRICE} is disabled and
13121318 * {@code LEFT SHIFT} is not held, prices are shown for a single item.
13131319 * When the stack count is greater than one and shift is held, prices are
@@ -1334,15 +1340,106 @@ private void addItemPricesToTooltip(String itemId,
13341340 TooltipFlag tooltipFlag ,
13351341 List <Component > components ) {
13361342 Feature feature = Feature .ITEM_PRICES_IN_TOOLTIP ;
1343+ boolean boldLines = feature .isEnabled (FeatureSetting .BOLD_PRICE_LINES );
13371344 UnaryOperator <Style > textColor = style -> feature .isChroma ()
1338- ? style .withColor (DrawUtils .CHROMA_TEXT_COLOR ) // TextColor
1339- : style .withColor (feature .getColor ()); // int
1345+ ? style .withBold ( boldLines ). withColor (DrawUtils .CHROMA_TEXT_COLOR ) // TextColor
1346+ : style .withBold ( boldLines ). withColor (feature .getColor ()); // int
13401347 boolean lshift = feature .isEnabled (FeatureSetting .ALWAYS_SHOW_BULK_PRICE )
13411348 || InputConstants .isKeyDown (MC .getWindow (), GLFW .GLFW_KEY_LEFT_SHIFT );
13421349 int count = itemStack .getCount ();
13431350 int countToBeShown = lshift ? count : 1 ;
13441351
13451352 int addedLines = 0 ;
1353+
1354+ if (feature .isEnabled (FeatureSetting .LOWEST_BIN_PRICES_IN_TOOLTIP )) {
1355+ if (itemId == null ) itemId = ItemUtils .getSkyblockItemID (itemStack );
1356+
1357+ String apiItemId = itemId ;
1358+ String extraString = null ;
1359+ switch (apiItemId ) {
1360+ case "PET" -> {
1361+ PetManager .Pet pet = PetManager .getInstance ().getPetFromItemStack (itemStack );
1362+
1363+ if (pet != null ) {
1364+ PetInfo petInfo = pet .getPetInfo ();
1365+
1366+ if (petInfo != null ) {
1367+ apiItemId = petInfo .getPetSkyblockId () + ";" + petInfo .getPetRarity ().ordinal ();
1368+
1369+ int petLevel = pet .getPetLevel ();
1370+ if (petLevel != 0 && pet .getPetLevel () % 100 == 0 ) {
1371+ extraString = "+" + petLevel ;
1372+ apiItemId += extraString ;
1373+ }
1374+ }
1375+ }
1376+ }
1377+ case "RUNE" -> {
1378+ CompoundTag extraAttributes = ItemUtils .getExtraAttributes (itemStack );
1379+
1380+ if (extraAttributes != null ) {
1381+ SkyblockRune rune = ItemUtils .getRuneData (extraAttributes );
1382+
1383+ if (rune != null ) {
1384+ apiItemId = rune .getType () + "_RUNE;" + rune .getLevel ();
1385+ }
1386+ }
1387+ }
1388+ case "NEW_YEAR_CAKE" -> {
1389+ CompoundTag extraAttributes = ItemUtils .getExtraAttributes (itemStack );
1390+
1391+ if (extraAttributes != null ) {
1392+ int cakeYears = extraAttributes .getIntOr ("new_years_cake" , -1 );
1393+
1394+ if (cakeYears != -1 ) {
1395+ apiItemId += "+" + cakeYears ;
1396+ }
1397+ }
1398+ }
1399+ case "POTION" -> {
1400+ CompoundTag extraAttributes = ItemUtils .getExtraAttributes (itemStack );
1401+
1402+ if (extraAttributes != null ) {
1403+ String potion = extraAttributes .getStringOr ("potion" , "" );
1404+ int potionLevel = extraAttributes .getIntOr ("potion_level" , -1 );
1405+
1406+ if (!potion .isEmpty () && potionLevel != -1 ) {
1407+ apiItemId += "_" + potion .toUpperCase (Locale .ENGLISH ) + ";" + potionLevel ;
1408+ }
1409+ }
1410+ }
1411+ case null -> {
1412+ return ;
1413+ }
1414+ default -> {
1415+ CompoundTag extraAttributes = ItemUtils .getExtraAttributes (itemStack );
1416+
1417+ if (extraAttributes != null ) {
1418+ int baseStatBoost = extraAttributes .getIntOr ("baseStatBoostPercentage" , -1 );
1419+
1420+ if (baseStatBoost == 50 ) {
1421+ extraString = "+PERFECT" ;
1422+ apiItemId += extraString ;
1423+ }
1424+ }
1425+ }
1426+ }
1427+
1428+ double lowestBinPrice = main .getLowestBinData ().getOrDefault (apiItemId , -1.0D );
1429+ if (extraString != null && lowestBinPrice == -1.0D ) {
1430+ lowestBinPrice = main .getLowestBinData ().getOrDefault (
1431+ apiItemId .replace (extraString , "" ), -1.0D
1432+ );
1433+ }
1434+
1435+ if (lowestBinPrice > 0.0D ) {
1436+ Component priceComponent = TextUtils .formatPrice (lowestBinPrice , 0 , boldLines );
1437+
1438+ components .add (Component .literal (Translations .getMessage ("tooltip.lowestBinPrice" ))
1439+ .withStyle (textColor ).append (priceComponent ));
1440+ }
1441+ }
1442+
13461443 if (feature .isEnabled (FeatureSetting .BAZAAR_PRICES_IN_TOOLTIP )) {
13471444 if (itemId == null ) itemId = ItemUtils .getSkyblockItemID (itemStack );
13481445
@@ -1360,8 +1457,8 @@ private void addItemPricesToTooltip(String itemId,
13601457 BazaarData .Product product = main .getBazaarData ().getProducts ().get (apiItemId );
13611458
13621459 if (product != null ) {
1363- Component buyPrice = TextUtils .formatPrice (product .getInstaBuyPrice () * countToBeShown );
1364- Component sellPrice = TextUtils .formatPrice (product .getInstaSellPrice () * countToBeShown );
1460+ Component buyPrice = TextUtils .formatPrice (product .getInstaBuyPrice () * countToBeShown , 1 , boldLines );
1461+ Component sellPrice = TextUtils .formatPrice (product .getInstaSellPrice () * countToBeShown , 1 , boldLines );
13651462
13661463 components .add (Component .literal (Translations .getMessage ("tooltip.buyPrice" ))
13671464 .withStyle (textColor ).append (buyPrice ));
@@ -1379,7 +1476,8 @@ private void addItemPricesToTooltip(String itemId,
13791476 ItemsData .Item item = main .getItemsData ().getItemMap ().get (itemId );
13801477
13811478 if (item != null && item .getNpcSellPrice () != 0.0D ) {
1382- Component npcSellPrice = TextUtils .formatPrice (item .getNpcSellPrice () * countToBeShown );
1479+ double price = item .getNpcSellPrice () * countToBeShown ;
1480+ Component npcSellPrice = TextUtils .formatPrice (price , price <= 10.0D ? 2 : 0 , boldLines );
13831481
13841482 components .add (Component .literal (Translations .getMessage ("tooltip.npcSellPrice" ))
13851483 .withStyle (textColor ).append (npcSellPrice ));
0 commit comments