MV List Y Alignment

I'm looking for a plugin workaround for an issue I've run into with Luna Engine that even the developers aren't too sure how to fix. As you can see, the name, value, and icon are not centered with each other. The name is too low and the value is too high. This is not a font issue. I've checked.

1617427373099.png

1617427394181.png

Is there an existing plugin that can allow me to manually adjust the Y-value of the name and item value (quantity/ price/ cost)?

And, if not, then this is my request for one.
Thank you
That would potentially be an easy plugin to make, but I know there are a few differences between MZ and MV code that makes plugins incompatible, and I don't know which differences those are specifically. I've heard they're mostly in windows/graphics, which this is. I could probably whip one up that would work in MZ.... but I have no idea if it would work in MV, as I don't have access to it or its code.

It would basically overwrite one base function to add in offsets set in plugin parameters. In MZ, it would be Window_Base.prototype.drawItemName. And edits to maybe three others, one for item window(quantity), one for skill window(skill cost) and one for shop window(item price).

I could attempt it, but no guarantees it would work since I don't have MV, so I can't check source code and I can't test it on anything but MZ.
That would potentially be an easy plugin to make, but I know there are a few differences between MZ and MV code that makes plugins incompatible, and I don't know which differences those are specifically. I've heard they're mostly in windows/graphics, which this is. I could probably whip one up that would work in MZ.... but I have no idea if it would work in MV, as I don't have access to it or its code.

It would basically overwrite one base function to add in offsets set in plugin parameters. In MZ, it would be Window_Base.prototype.drawItemName. And edits to maybe three others, one for item window(quantity), one for skill window(skill cost) and one for shop window(item price).

I could attempt it, but no guarantees it would work since I don't have MV, so I can't check source code and I can't test it on anything but MZ.

I'd appreciate the attempt nonetheless. Even if it doesn't work it'd give me an idea of what to do. I'm not too well versed in JS, so it'd definitely help. Of course, this is only if you want to.
I'd appreciate the attempt nonetheless. Even if it doesn't work it'd give me an idea of what to do. I'm not too well versed in JS, so it'd definitely help. Of course, this is only if you want to.
Well, the graphical side of programming has ALWAYS been my weak point, and I like being able to solve problems. Not to mention it feels good when learning something that you have the skills to achieve something. Of course it helps that your request is (potentially) an easy one. Not like you're wanting to overhaul the entire window layout or something.

I'll throw something together. Not sure how long it will take, but it shouldn't be more than a day. (not 24 hours of programming time, but I have a 10 month old daughter, so that 24 hour period might net me maybe an hour or two lol)
Well, the graphical side of programming has ALWAYS been my weak point, and I like being able to solve problems. Not to mention it feels good when learning something that you have the skills to achieve something. Of course it helps that your request is (potentially) an easy one. Not like you're wanting to overhaul the entire window layout or something.

I'll throw something together. Not sure how long it will take, but it shouldn't be more than a day. (not 24 hours of programming time, but I have a 10 month old daughter, so that 24 hour period might net me maybe an hour or two lol)
If you can put something together, that'd be great! Don't rush or anything, I've got some other things in the game I've got to focus on as well, so I'll be preoccupied. Take your time!
I'd appreciate the attempt nonetheless. Even if it doesn't work it'd give me an idea of what to do. I'm not too well versed in JS, so it'd definitely help. Of course, this is only if you want to.
Spoiler: Code
JavaScript:
/*:
@param nameX
@text Item Name X Offset
@default 0

@param nameY
@text Item Name Y Offset
@default 0

@param iconX
@text Item Icon X Offset
@default 0

@param iconY
@text Item Icon Y Offset
@default 0

@param costX
@text Skill Cost X Offset
@default 0

@param costY
@text Skill Cost Y Offset
@default 0

@param quanX
@text Item Quantity X Offset
@default 0

@param quanY
@text Item Quantity Y Offset
@default 0

@param priceX
@text Item Price X Offset
@default 0

@param priceY
@text Item Price Y Offset
@default 0
*/

offsets = PluginManager.parameters("Drak_DrawItemOffsets");
for (k of Object.keys(offsets)) offsets[k] = Number(offsets[k]);

Window_Base.prototype.drawItemName = function(item, x, y, width) {
    if (item) {
        const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;
        const textMargin = ImageManager.iconWidth + 4;
        const itemWidth = Math.max(0, width - textMargin);
        this.resetTextColor();
        this.drawIcon(item.iconIndex, x + offsets.iconX, iconY + offsets.iconY);
        this.drawText(item.name, x + textMargin + offsets.nameX, y, itemWidth + offsets.nameY);
    }
};

Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
    if (this.needsNumber()) {
        this.drawText(":", x + offsets.quanX, y + offsets.quanY, width - this.textWidth("00"), "right");
        this.drawText($gameParty.numItems(item), x + offsets.quanX, y + offsets.quanY, width, "right");
    }
};

Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
    if (this._actor.skillTpCost(skill) > 0) {
        this.changeTextColor(ColorManager.tpCostColor());
        this.drawText(this._actor.skillTpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    } else if (this._actor.skillMpCost(skill) > 0) {
        this.changeTextColor(ColorManager.mpCostColor());
        this.drawText(this._actor.skillMpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    }
};

Window_ShopBuy.prototype.drawItem = function(index) {
    const item = this.itemAt(index);
    const price = this.price(item);
    const rect = this.itemLineRect(index);
    const priceWidth = this.priceWidth();
    const priceX = rect.x + rect.width - priceWidth;
    const nameWidth = rect.width - priceWidth;
    this.changePaintOpacity(this.isEnabled(item));
    this.drawItemName(item, rect.x, rect.y, nameWidth);
    this.drawText(price, priceX + offsets.priceX, rect.y + offsets.priceY, priceWidth, "right");
    this.changePaintOpacity(true);
};

Give this a try. Save it as Drak_DrawItemOffsets.js. Added X offsets to everything you mentioned just to make it feel a little more... complete. Felt wrong just using half the point data lol. Try it out and see if it works. If it does, awesome. If not and we can narrow it down to a problem with the differences between MV and MZ, I recommend either having someone who DOES have MV either convert it or write a new one from scratch.

Just make sure you only put numbers into the parameters. I didn't add a failsafe for putting something else in there. 1, it's past my bedtime and I'm tired, and 2, I figured you'd be able to figure out REALLY quick if you did.

Good luck!
Spoiler: Code
JavaScript:
/*:
@param nameX
@text Item Name X Offset
@default 0

@param nameY
@text Item Name Y Offset
@default 0

@param iconX
@text Item Icon X Offset
@default 0

@param iconY
@text Item Icon Y Offset
@default 0

@param costX
@text Skill Cost X Offset
@default 0

@param costY
@text Skill Cost Y Offset
@default 0

@param quanX
@text Item Quantity X Offset
@default 0

@param quanY
@text Item Quantity Y Offset
@default 0

@param priceX
@text Item Price X Offset
@default 0

@param priceY
@text Item Price Y Offset
@default 0
*/

offsets = PluginManager.parameters("Drak_DrawItemOffsets");
for (k of Object.keys(offsets)) offsets[k] = Number(offsets[k]);

Window_Base.prototype.drawItemName = function(item, x, y, width) {
    if (item) {
        const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;
        const textMargin = ImageManager.iconWidth + 4;
        const itemWidth = Math.max(0, width - textMargin);
        this.resetTextColor();
        this.drawIcon(item.iconIndex, x + offsets.iconX, iconY + offsets.iconY);
        this.drawText(item.name, x + textMargin + offsets.nameX, y, itemWidth + offsets.nameY);
    }
};

Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
    if (this.needsNumber()) {
        this.drawText(":", x + offsets.quanX, y + offsets.quanY, width - this.textWidth("00"), "right");
        this.drawText($gameParty.numItems(item), x + offsets.quanX, y + offsets.quanY, width, "right");
    }
};

Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
    if (this._actor.skillTpCost(skill) > 0) {
        this.changeTextColor(ColorManager.tpCostColor());
        this.drawText(this._actor.skillTpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    } else if (this._actor.skillMpCost(skill) > 0) {
        this.changeTextColor(ColorManager.mpCostColor());
        this.drawText(this._actor.skillMpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    }
};

Window_ShopBuy.prototype.drawItem = function(index) {
    const item = this.itemAt(index);
    const price = this.price(item);
    const rect = this.itemLineRect(index);
    const priceWidth = this.priceWidth();
    const priceX = rect.x + rect.width - priceWidth;
    const nameWidth = rect.width - priceWidth;
    this.changePaintOpacity(this.isEnabled(item));
    this.drawItemName(item, rect.x, rect.y, nameWidth);
    this.drawText(price, priceX + offsets.priceX, rect.y + offsets.priceY, priceWidth, "right");
    this.changePaintOpacity(true);
};

Give this a try. Save it as Drak_DrawItemOffsets.js. Added X offsets to everything you mentioned just to make it feel a little more... complete. Felt wrong just using half the point data lol. Try it out and see if it works. If it does, awesome. If not and we can narrow it down to a problem with the differences between MV and MZ, I recommend either having someone who DOES have MV either convert it or write a new one from scratch.

Just make sure you only put numbers into the parameters. I didn't add a failsafe for putting something else in there. 1, it's past my bedtime and I'm tired, and 2, I figured you'd be able to figure out REALLY quick if you did.

Good luck!
It works somewhat, the quantity/ cost/ price is there and able to be edited, but the icon and name have completely vanished. I notice it does this when placed under Luna Engine. Placing it above Luna Engine doesn't do anything, so I assume it's more of incompatibility with LE than MV, but I can probably figure it out!

Thanks for everything!
It is almost certainly a compatibility problem.

Drakkonis' plugin overwrites Window_Base's "drawItemName()" function and doesn't call any previous functionality - and I can tell you Luna Engine also does the exact same thing. So both scripts are overwriting the default behavior and the one on the bottom of the plugins list ends up being the "final" overwrite (i.e. Luna overwrites the default function and then Drakkonis' plugin overwrites Luna's function).

Meaning whatever functionality was "added" by Luna during its overwrite will simply disappear, breaking whatever it was meant to do.

In theory, this problem can be handled if you just re-add the functionality Luna had... but that requires you to know what Luna Engine actually DID during its overwrite.

There is a particular issue with creating compatibility/fixes with VisuStella-created plugins like Luna Engine and it's that they tend to obfuscate their code to make it hard to plagiarize. Unfortunately, by nature, this also makes it equally hard to understand the code and to modify it as well. Only the creators are meant to have access to an unobfuscated copy and if they can't fix/are unwilling to attend to the issue you're typically stuck out of luck.

Because whoever else wants to make a separate plugin modifying Luna functionality would have to work through the obfuscation to do it which is something of a tall order to ask, especially if they're not being paid to do it.

Thus, the only suggestion I can offer involves a tacky direct edit on the Luna Engine itself in order to modify what "legible" parts of the script you can see (you can tell where it overwrites "drawItemName()", only because it necessarily has to reference the function name to overwrite it at all).

If you are desperate enough to try, go do a Ctrl-F for this line in the LunaEngine.js file:
JavaScript:
s.Window_Base.prototype.drawItemName=function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:312;if(t){var o=s.Window_Base._iconWidth+4;this.resetTextColor(),this.drawIcon(t.iconIndex,e+2+this.textPadding(),n+2),this.drawText(t.name,e+o+this.textPadding(),n,i-o)}}
Yes, I am aware that they compressed all their code onto a single line in their plugin, which will probably make it hard to navigate with no matter what editor you use (when you find the start of that bit you can press enter and put it onto a new line to make it easier to handle, it shouldn't matter).

The relevant bits you are looking to alter are: "this.drawIcon(t.iconIndex,e+2+this.textPadding(),n+2)" and "this.drawText(t.name,e+o+this.textPadding(),n,i-o)".

The argument order for those functions is meant to be "drawIcon(icon_index, x, y)" and "drawText(text, x, y, width)".

So if, for instance, you want to shift the text up by 4 pixels, you would need to modify it to look something like this:
JavaScript:
this.drawText(t.name, e+o+this.textPadding(), n-4 , i-o)
And if you wanted to shift the icon 3 pixels to the left, you would do something like this:
JavaScript:
this.drawIcon(t.iconIndex, e+2+this.textPadding()-3, n+2)

I do not believe the logic for drawing skill cost was touched/overwritten by Luna Engine, you can edit/use a plugin that modifies Window_SkillCost's "drawSkillCost()" to alter x/y and it should take effect even with Luna running. If there was some later/older version of Luna you're using than what I have access to that DID overwrite that function, you will have to find where it did in the plugin and do similar edits as you did for "drawItemName()".

I will say though, I can't help but be skeptical at the idea that there really isn't anything listed in configuration options for Luna Engine to allow you to alter the x/y position of the skill names anywhere among there. It seems like it should be a feature that exists, especially if the code itself has an overwrite to add/change the logic of the "drawItemName()" function.

I'd first and foremost suggest checking through the configurations first to make 100% sure there's nothing in there that handles it and only then try to "hack" the plugin itself to force your change through.
Yeah, it really sucks when you want to modify just one single line in the middle of a function, you generally have to overwrite the whole thing with a version that's identical EXCEPT for your one change, so aliasing won't work. With some tweaking and taking advantage of Javascript's prototyping, I MIGHT be able to jury-rig a workaround, unless LE does the same thing. I'm gonna look into it.
The biggest problem I can see is the fact that in the base draw item name, the icon position is calculated from the name text's position, so without modifying LE's overwrite, icon offset won't be customizable. If I prototype my own specific instances, it will ignore LE's overwrite, which would basically reset item names and icons do the default aesthetic, which wouldn't NEED the offsets. Best case scenario there would be calling the base version with modified values from the top-level prototypes, which in theory would allow for fixing the y of the item's name... but you wouldn't be able to change the icon's y position independent from it, unless I also prototype each instance of icon draw as well. It'll make things a little... clunky-looking, but hopefully will work.
It works somewhat, the quantity/ cost/ price is there and able to be edited, but the icon and name have completely vanished. I notice it does this when placed under Luna Engine. Placing it above Luna Engine doesn't do anything, so I assume it's more of incompatibility with LE than MV, but I can probably figure it out!

Thanks for everything!
Ok, this version might work. Remove the Window_Base prototype function, then stick this somewhere in there:
JavaScript:
Window_Selectable.prototype.drawItemName = function(item, x, y, width) {
    Window_Base.prototype.drawItemName.call(this, item, x + offsets.nameX, y + offsets.nameY, width);
}

Window_Selectable.prototype.drawIcon = function(index, x, y) {
    Window_Base.prototype.drawIcon.call(this, index, x + offsets.iconX, y + offsets.iconY);
}

Or if you prefer, erase everything in the file and paste in this:
Spoiler: Code
JavaScript:
/*:
@param nameX
@text Item Name X Offset
@default 0

@param nameY
@text Item Name Y Offset
@default 0

@param iconX
@text Item Icon X Offset
@default 0

@param iconY
@text Item Icon Y Offset
@default 0

@param costX
@text Skill Cost X Offset
@default 0

@param costY
@text Skill Cost Y Offset
@default 0

@param quanX
@text Item Quantity X Offset
@default 0

@param quanY
@text Item Quantity Y Offset
@default 0

@param priceX
@text Item Price X Offset
@default 0

@param priceY
@text Item Price Y Offset
@default 0
*/

offsets = PluginManager.parameters("Drak_DrawItemOffsets");
for (k of Object.keys(offsets)) offsets[k] = Number(offsets[k]);

Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
    if (this.needsNumber()) {
        this.drawText(":", x + offsets.quanX, y + offsets.quanY, width - this.textWidth("00"), "right");
        this.drawText($gameParty.numItems(item), x + offsets.quanX, y + offsets.quanY, width, "right");
    }
};

Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
    if (this._actor.skillTpCost(skill) > 0) {
        this.changeTextColor(ColorManager.tpCostColor());
        this.drawText(this._actor.skillTpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    } else if (this._actor.skillMpCost(skill) > 0) {
        this.changeTextColor(ColorManager.mpCostColor());
        this.drawText(this._actor.skillMpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    }
};

Window_ShopBuy.prototype.drawItem = function(index) {
    const item = this.itemAt(index);
    const price = this.price(item);
    const rect = this.itemLineRect(index);
    const priceWidth = this.priceWidth();
    const priceX = rect.x + rect.width - priceWidth;
    const nameWidth = rect.width - priceWidth;
    this.changePaintOpacity(this.isEnabled(item));
    this.drawItemName(item, rect.x, rect.y, nameWidth);
    this.drawText(price, priceX + offsets.priceX, rect.y + offsets.priceY, priceWidth, "right");
    this.changePaintOpacity(true);
};

Window_Selectable.prototype.drawItemName = function(item, x, y, width) {
    Window_Base.prototype.drawItemName.call(this, item, x + offsets.nameX, y + offsets.nameY, width);
}

Window_Selectable.prototype.drawIcon = function(index, x, y) {
    Window_Base.prototype.drawIcon.call(this, index, x + offsets.iconX, y + offsets.iconY);
}

This should keep LE's functionality intact while simply modifying the x/y values they'll use. Keep in mind that in the original drawItemName function, icon position is calculated based on the item name's position, so if you modify the name's Y AND the icon's Y, the icon's offset will actually be the name offset PLUS the icon offset. So if the name looks good but the icon is drawn too low even with 0 offset, start moving icon's offset to negative values.

If this still doesn't work, it's possible LE modifies these two functions as well... in which case I might have to ACTUALLY prototype each specific window type that deals with items, or there's something else LE does that would make my edits incompatible PERIOD.
Ok, this version might work. Remove the Window_Base prototype function, then stick this somewhere in there:
JavaScript:
Window_Selectable.prototype.drawItemName = function(item, x, y, width) {
    Window_Base.prototype.drawItemName.call(this, item, x + offsets.nameX, y + offsets.nameY, width);
}

Window_Selectable.prototype.drawIcon = function(index, x, y) {
    Window_Base.prototype.drawIcon.call(this, index, x + offsets.iconX, y + offsets.iconY);
}

Or if you prefer, erase everything in the file and paste in this:
Spoiler: Code
JavaScript:
/*:
@param nameX
@text Item Name X Offset
@default 0

@param nameY
@text Item Name Y Offset
@default 0

@param iconX
@text Item Icon X Offset
@default 0

@param iconY
@text Item Icon Y Offset
@default 0

@param costX
@text Skill Cost X Offset
@default 0

@param costY
@text Skill Cost Y Offset
@default 0

@param quanX
@text Item Quantity X Offset
@default 0

@param quanY
@text Item Quantity Y Offset
@default 0

@param priceX
@text Item Price X Offset
@default 0

@param priceY
@text Item Price Y Offset
@default 0
*/

offsets = PluginManager.parameters("Drak_DrawItemOffsets");
for (k of Object.keys(offsets)) offsets[k] = Number(offsets[k]);

Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
    if (this.needsNumber()) {
        this.drawText(":", x + offsets.quanX, y + offsets.quanY, width - this.textWidth("00"), "right");
        this.drawText($gameParty.numItems(item), x + offsets.quanX, y + offsets.quanY, width, "right");
    }
};

Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
    if (this._actor.skillTpCost(skill) > 0) {
        this.changeTextColor(ColorManager.tpCostColor());
        this.drawText(this._actor.skillTpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    } else if (this._actor.skillMpCost(skill) > 0) {
        this.changeTextColor(ColorManager.mpCostColor());
        this.drawText(this._actor.skillMpCost(skill), x + offsets.costX, y + offsets.costY, width, "right");
    }
};

Window_ShopBuy.prototype.drawItem = function(index) {
    const item = this.itemAt(index);
    const price = this.price(item);
    const rect = this.itemLineRect(index);
    const priceWidth = this.priceWidth();
    const priceX = rect.x + rect.width - priceWidth;
    const nameWidth = rect.width - priceWidth;
    this.changePaintOpacity(this.isEnabled(item));
    this.drawItemName(item, rect.x, rect.y, nameWidth);
    this.drawText(price, priceX + offsets.priceX, rect.y + offsets.priceY, priceWidth, "right");
    this.changePaintOpacity(true);
};

Window_Selectable.prototype.drawItemName = function(item, x, y, width) {
    Window_Base.prototype.drawItemName.call(this, item, x + offsets.nameX, y + offsets.nameY, width);
}

Window_Selectable.prototype.drawIcon = function(index, x, y) {
    Window_Base.prototype.drawIcon.call(this, index, x + offsets.iconX, y + offsets.iconY);
}

This should keep LE's functionality intact while simply modifying the x/y values they'll use. Keep in mind that in the original drawItemName function, icon position is calculated based on the item name's position, so if you modify the name's Y AND the icon's Y, the icon's offset will actually be the name offset PLUS the icon offset. So if the name looks good but the icon is drawn too low even with 0 offset, start moving icon's offset to negative values.

If this still doesn't work, it's possible LE modifies these two functions as well... in which case I might have to ACTUALLY prototype each specific window type that deals with items, or there's something else LE does that would make my edits incompatible PERIOD.
Woah, hey, it works almost perfectly!

The only problem being that whenever I enter the skill menu, I get
"ReferenceError
ColorManager is not defined".

Out of curiosity, I removed the lines:
JavaScript:
        this.changeTextColor(ColorManager.mpCostColor());
and
JavaScript:
        this.changeTextColor(ColorManager.tpCostColor());

Which allowed me to enter the menu without error, however, the font changed to match the name, and the "TP" at the end disappeared.
I feel like that was to be expected when removing a piece of code called "ColorManager", haha
Woah, hey, it works almost perfectly!

The only problem being that whenever I enter the skill menu, I get
"ReferenceError
ColorManager is not defined".

Out of curiosity, I removed the lines:
JavaScript:
        this.changeTextColor(ColorManager.mpCostColor());
and
JavaScript:
        this.changeTextColor(ColorManager.tpCostColor());

Which allowed me to enter the menu without error, however, the font changed to match the name, and the "TP" at the end disappeared.
I feel like that was to be expected when removing a piece of code called "ColorManager", haha
Huh.... must be a difference between MZ and MV then. If you find that function in MV's base code, you should be able to copy over the lines THEY use for that over where the problem lines were. I had the same problem in reverse when I was using Yanfly's SkillCore instead of VisuStella's. Yanfly's is for MV, VisuStella's is for MZ. I was missing costs and cost labels until I removed similar lines from the Yanfly version. lol
Which allowed me to enter the menu without error, however, the font changed to match the name, and the "TP" at the end disappeared.
I feel like that was to be expected when removing a piece of code called "ColorManager", haha
If the font of the cost changed to match the name, that would imply that LE does something there to change the font. If that's the case, I'm not sure I can do anything for the skill costs and still be compatible, since I don't have the plugin's source code. You might have to remove the skillcost function entirely and use the offsets to line everything else up with the costs, or for that specific function, do as Trihan suggested and try to find it in the LE script and change the values manually.
Huh.... must be a difference between MZ and MV then.
Correct, the ColorManager doesn't exist in MV.

Text colors are stored in Window_Base itself there. MV's version of "drawSkillCost()" looks like this:
JavaScript:
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
    if (this._actor.skillTpCost(skill) > 0) {
        this.changeTextColor(this.tpCostColor());
        this.drawText(this._actor.skillTpCost(skill), x, y, width, 'right');
    } else if (this._actor.skillMpCost(skill) > 0) {
        this.changeTextColor(this.mpCostColor());
        this.drawText(this._actor.skillMpCost(skill), x, y, width, 'right');
    }
};

Original thread: https://forums.rpgmakerweb.com/threads/list-y-alignment.135105/