mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-10 10:20:44 -07:00
Merge branch 'ground-items-offsets' into 'master'
Ground Items Height Offset Corrections See merge request 2009scape/rt4-client!13
This commit is contained in:
commit
955c5b5e73
1 changed files with 32 additions and 16 deletions
|
|
@ -24,7 +24,7 @@ import kotlin.math.roundToInt
|
|||
cmds ::set(low,med,high,insane,hide), ::(tag,ignore)item ID, ::(reset)groundconfig
|
||||
Special thanks to Chisato for the original skeleton.
|
||||
""",
|
||||
version = 1.0
|
||||
version = 1.1
|
||||
)
|
||||
open class plugin : Plugin() {
|
||||
|
||||
|
|
@ -113,27 +113,24 @@ open class plugin : Plugin() {
|
|||
for (x in 0..103) {
|
||||
for (y in 0..103) {
|
||||
val objstacknodeLL = SceneGraph.objStacks[Player.plane][x][y]
|
||||
var itemCount = 0
|
||||
var tempNode = objstacknodeLL?.head() as ObjStackNode?
|
||||
while (tempNode != null) {
|
||||
itemCount++
|
||||
tempNode = objstacknodeLL.next() as ObjStackNode?
|
||||
}
|
||||
var offset = itemCount * 12
|
||||
if (objstacknodeLL != null) {
|
||||
var item = objstacknodeLL.head() as ObjStackNode?
|
||||
while (item != null) {
|
||||
val itemDef = ObjTypeList.get(item.value.type)
|
||||
var haValue = if (itemDef.id == coindId) item.value.amount else (itemDef.cost * 0.6 * item.value.amount).roundToInt()
|
||||
val geValue = (gePriceMap[itemDef.id.toString()]?.toInt() ?: 0) * item.value.amount
|
||||
|
||||
// If the HA value or GE value is below the hide threshold, don't render
|
||||
val highestValue = maxOf(haValue, geValue)
|
||||
if ((highestValue < hideBelowValue || isHidden(itemDef.id)) && !isTagged(itemDef.id)) {
|
||||
val itemCount = getDisplayedStackSize(objstacknodeLL)
|
||||
var offset = itemCount * 12
|
||||
var item = objstacknodeLL.head() as ObjStackNode?
|
||||
|
||||
while (item != null) {
|
||||
|
||||
if(!shouldDisplayItem(item)) {
|
||||
item = objstacknodeLL.next() as ObjStackNode?
|
||||
continue
|
||||
}
|
||||
|
||||
val itemDef = ObjTypeList.get(item.value.type)
|
||||
val haValue = if (itemDef.id == coindId) item.value.amount else (itemDef.cost * 0.6 * item.value.amount).roundToInt()
|
||||
val geValue = (gePriceMap[itemDef.id.toString()]?.toInt() ?: 0) * item.value.amount
|
||||
val highestValue = maxOf(haValue, geValue)
|
||||
|
||||
val screenPos: IntArray = CalculateSceneGraphScreenPosition((x shl 7) + 64, (y shl 7) + 64, 64)
|
||||
if (screenPos[0] < 0 || screenPos[1] < 0) {
|
||||
// Item is offscreen
|
||||
|
|
@ -169,6 +166,25 @@ open class plugin : Plugin() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getDisplayedStackSize(objstacknodeLL: LinkedList): Int{
|
||||
var displayedStackSize = 0;
|
||||
var stackItem = objstacknodeLL.head() as ObjStackNode?
|
||||
while (stackItem != null) {
|
||||
if(shouldDisplayItem(stackItem)){
|
||||
displayedStackSize++
|
||||
}
|
||||
stackItem = objstacknodeLL.next() as ObjStackNode?
|
||||
}
|
||||
return displayedStackSize;
|
||||
}
|
||||
private fun shouldDisplayItem(item: ObjStackNode): Boolean {
|
||||
val itemDef = ObjTypeList.get(item.value.type)
|
||||
val haValue = if (itemDef.id == coindId) item.value.amount else (itemDef.cost * 0.6 * item.value.amount).roundToInt()
|
||||
val geValue = (gePriceMap[itemDef.id.toString()]?.toInt() ?: 0) * item.value.amount
|
||||
val highestValue = maxOf(haValue, geValue)
|
||||
return !((highestValue < hideBelowValue || isHidden(itemDef.id)) && !isTagged(itemDef.id))
|
||||
}
|
||||
|
||||
override fun OnMiniMenuCreate(currentEntries: Array<out MiniMenuEntry>?) {
|
||||
if (currentEntries != null && IsKeyPressed(Keyboard.KEY_CTRL)) {
|
||||
for ((index, entry) in currentEntries.withIndex()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue