ge: fix showing active trade price on buy offers
The previously added script event was only for sell offers. Also remove buy limit from sell offers since it is not applicable.
This commit is contained in:
@@ -710,13 +710,15 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
case "setGETitle":
|
case "setGETitle":
|
||||||
setGeTitle();
|
setGeTitle();
|
||||||
break;
|
break;
|
||||||
case "geExamineText":
|
case "geBuyExamineText":
|
||||||
|
case "geSellExamineText":
|
||||||
{
|
{
|
||||||
|
boolean buy = "geBuyExamineText".equals(event.getEventName());
|
||||||
String[] stack = client.getStringStack();
|
String[] stack = client.getStringStack();
|
||||||
int sz = client.getStringStackSize();
|
int sz = client.getStringStackSize();
|
||||||
String fee = stack[sz - 2];
|
String fee = stack[sz - 2];
|
||||||
String examine = stack[sz - 3];
|
String examine = stack[sz - 3];
|
||||||
String text = setExamineText(examine, fee);
|
String text = setExamineText(examine, fee, buy);
|
||||||
if (text != null)
|
if (text != null)
|
||||||
{
|
{
|
||||||
stack[sz - 1] = text;
|
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);
|
final int itemId = client.getVar(VarPlayer.CURRENT_GE_ITEM);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if (config.enableGELimits())
|
if (buy && config.enableGELimits())
|
||||||
{
|
{
|
||||||
final ItemStats itemStats = itemManager.getItemStats(itemId, false);
|
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);
|
Instant resetTime = getLimitResetTime(itemId);
|
||||||
if (resetTime != null)
|
if (resetTime != null)
|
||||||
@@ -851,7 +853,13 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
return null;
|
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)
|
private static String shortenExamine(String examine)
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ LABEL35:
|
|||||||
|
|
||||||
sload 0 ; examine
|
sload 0 ; examine
|
||||||
sload 1 ; Convenience fee
|
sload 1 ; Convenience fee
|
||||||
sload 2 ; "<$string0><br><br><$string1>"
|
sload 2 ; "<$string0><br><br><$string1>" or "<$string0><br><$string1>"
|
||||||
sconst "geExamineText"
|
sconst "geSellExamineText"
|
||||||
runelite_callback
|
runelite_callback
|
||||||
sstore 2 ; final text
|
sstore 2 ; final text
|
||||||
pop_string ; Convenience fee
|
pop_string ; Convenience fee
|
||||||
@@ -157,6 +157,16 @@ LABEL35:
|
|||||||
LABEL131:
|
LABEL131:
|
||||||
sload 0
|
sload 0
|
||||||
sstore 2
|
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
|
iconst 1
|
||||||
iload 1
|
iload 1
|
||||||
if_sethide
|
if_sethide
|
||||||
|
|||||||
Reference in New Issue
Block a user