Merge pull request #3095 from open-osrs/upstream-1712

This commit is contained in:
Owain van Brakel
2021-12-17 14:32:20 +01:00
committed by GitHub
3 changed files with 27 additions and 9 deletions

View File

@@ -710,13 +710,15 @@ public class GrandExchangePlugin extends Plugin
case "setGETitle":
setGeTitle();
break;
case "geExamineText":
case "geBuyExamineText":
case "geSellExamineText":
{
boolean buy = "geBuyExamineText".equals(event.getEventName());
String[] stack = client.getStringStack();
int sz = client.getStringStackSize();
String fee = stack[sz - 2];
String examine = stack[sz - 3];
String text = setExamineText(examine, fee);
String text = setExamineText(examine, fee, buy);
if (text != null)
{
stack[sz - 1] = text;
@@ -807,12 +809,12 @@ public class GrandExchangePlugin extends Plugin
}
}
private String setExamineText(String examine, String fee)
private String setExamineText(String examine, String fee, boolean buy)
{
final int itemId = client.getVar(VarPlayer.CURRENT_GE_ITEM);
StringBuilder sb = new StringBuilder();
if (config.enableGELimits())
if (buy && config.enableGELimits())
{
final ItemStats itemStats = itemManager.getItemStats(itemId, false);
@@ -823,7 +825,7 @@ public class GrandExchangePlugin extends Plugin
}
}
if (config.enableGELimitReset())
if (buy && config.enableGELimitReset())
{
Instant resetTime = getLimitResetTime(itemId);
if (resetTime != null)
@@ -851,7 +853,13 @@ public class GrandExchangePlugin extends Plugin
return null;
}
return shortenExamine(examine) + "<br>" + sb + "<br>" + fee;
if (!fee.isEmpty())
{
sb.append("<br>").append(fee);
}
// Sell offers include an additional fee text which doesn't fit, so we truncate the examine text
return (!buy ? shortenExamine(examine) : examine) + "<br>" + sb;
}
private static String shortenExamine(String examine)

View File

@@ -339,7 +339,7 @@ public class GroundItemsPlugin extends Plugin
MenuAction menuType = menuEntry.getType();
if (menuType == MenuAction.GROUND_ITEM_FIRST_OPTION || menuType == MenuAction.GROUND_ITEM_SECOND_OPTION
|| menuType == MenuAction.GROUND_ITEM_THIRD_OPTION || menuType == MenuAction.GROUND_ITEM_FOURTH_OPTION
|| menuType == MenuAction.GROUND_ITEM_FIFTH_OPTION || menuType == MenuAction.SPELL_CAST_ON_GROUND_ITEM)
|| menuType == MenuAction.GROUND_ITEM_FIFTH_OPTION || menuType == MenuAction.EXAMINE_ITEM_GROUND)
{
for (MenuEntryWithCount entryWCount : newEntries)
{

View File

@@ -51,8 +51,8 @@ LABEL35:
sload 0 ; examine
sload 1 ; Convenience fee
sload 2 ; "<$string0><br><br><$string1>"
sconst "geExamineText"
sload 2 ; "<$string0><br><br><$string1>" or "<$string0><br><$string1>"
sconst "geSellExamineText"
runelite_callback
sstore 2 ; final text
pop_string ; Convenience fee
@@ -157,6 +157,16 @@ LABEL35:
LABEL131:
sload 0
sstore 2
sload 0 ; examine
sload 1 ; ""
sload 2 ; examine
sconst "geBuyExamineText"
runelite_callback
sstore 2 ; final text
pop_string ; ""
pop_string ; examine
iconst 1
iload 1
if_sethide