Battle Status Customization

Hi. I decided to get rid off Yanfly's Battle Status Window plugin and use the default one with Active Turn Battle mode.
However I'd like to make some changes and what I want to modify in this window - https://prnt.sc/p5jrlr

- Add Actors faces on the left
- Add prefix [Lv. x] to Actor's name (where X is current level of actor)

I checked rpg_windows.js and I found following code (RPG maker MV 1.5.1 - rpg_windows.js - line from 5496 to 5541):
Spoiler
Code:
Window_BattleStatus.prototype.drawItem = function(index) {
    var actor = $gameParty.battleMembers()[index];
    this.drawBasicArea(this.basicAreaRect(index), actor);
    this.drawGaugeArea(this.gaugeAreaRect(index), actor);
};

Window_BattleStatus.prototype.basicAreaRect = function(index) {
    var rect = this.itemRectForText(index);
    rect.width -= this.gaugeAreaWidth() + 15;
    return rect;
};

Window_BattleStatus.prototype.gaugeAreaRect = function(index) {
    var rect = this.itemRectForText(index);
    rect.x += rect.width - this.gaugeAreaWidth();
    rect.width = this.gaugeAreaWidth();
    return rect;
};

Window_BattleStatus.prototype.gaugeAreaWidth = function() {
    return 330;
};

Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorName(actor, rect.x + 0, rect.y, 150);
    this.drawActorIcons(actor, rect.x + 156, rect.y, rect.width - 156);
};

Window_BattleStatus.prototype.drawGaugeArea = function(rect, actor) {
    if ($dataSystem.optDisplayTp) {
        this.drawGaugeAreaWithTp(rect, actor);
    } else {
        this.drawGaugeAreaWithoutTp(rect, actor);
    }
};

Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorMp(actor, rect.x + 123, rect.y, 96);
    this.drawActorTp(actor, rect.x + 234, rect.y, 96);
};

Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function(rect, actor) {
    this.drawActorHp(actor, rect.x + 0, rect.y, 201);
    this.drawActorMp(actor, rect.x + 216,  rect.y, 114);
};

What and where add to code to achieve ?
Re drawing faces:
Do you want the faces to be scaled down to reflect the size of item line? Or do you want to increase the size of your item line to accommodate the full face image? I believe the default height for actor faces is 144, but you may have changed this though.

Re drawing levels:
the simplest way to do this is to use the function inherited from Window_Base, drawActorLevel(). Because the function is inherited you can just slot this into your drawBasicArea() function between drawActorName() and drawActorIcons(), remember to adjust their x and width parameters accordingly to take into the account the width of the level text, by default this is 120.

An example might look like this:

Code:
Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorName(actor, rect.x + 0, rect.y, 150);
    this.drawActorLevel(actor, rect.x + 156, rect.y)
    this.drawActorIcons(actor, rect.x + 156 + 126, rect.y, rect.width - 156 - 126);
    // ^note that the x and width parameters are being increased and decreased respectively by the level text's width.
};

If this doesn't give you the desired result you could always create your own distinct function for drawing actor levels in the battlestatus window while referring to the original found in Window_Base. For instance, say I didn't want the text for level to be blue. I would copy the original Window_Base.prototype.drawActorLevel, change "Window_Base" to "Window_BattleStatus" and then remove the line that changes the text colour to systemColor. My end result would look like this:

Code:
Window_BattleStatus.prototype.drawActorLevel = function(actor, x, y) {
    this.drawText(TextManager.levelA, x, y, 48);
    this.drawText(actor.level, x + 84, y, 36, 'right');
};

From here I can adjust the x, y, width, alignment and so on so forth within my battlestatus window without it affecting my other windows.

Note: changes to Window_BattleStatus will affect Window_BattleActor. This is fine as they are by default designed to be largely same.
Thanks @Silva - I prepared images with height matching my rows heights and I want simply draw them next to ATB gauges on left side or something similar to MOG BattleHud plugin (example).

Unfourtunately Mog's plugin has compability issues with my current plugin list (most of them are Yanfly's) so I can't use it.
I would suggest using the drawFace function from Window_Base. The easiest way of retrieving these alternative faces is to just make sure the indexes match the actors normal face index and that the sheetnames match but with one extra character. eg. "faces1" for normal faces and then "faces1b" for battlestatus faces. You can then easily create the parameters before calling drawFace like so:

Code:
var faceName = actor.faceName() + "b";
var faceIndex = actor.faceIndex();
this.drawFace(faceName, faceIndex, x, y, width, height) // replace x, y, width, height with your own values
Thank you so much @Silva. I've got what I needed in 100%!
Result:

For those who wants the same result I give you edited code (and save it as plugin)
Code:
    Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
       
        var faceName = actor.faceName();
        var faceIndex = actor.faceIndex();   
        var actorData = "[ Lv. " + actor.level + " ] " + actor.name();
       
        this.drawText(actorData, rect.x + 112, rect.y, 150);           
        this.drawFace(faceName, faceIndex, 0, rect.y+4, 96,29);
        this.drawActorIcons(actor, rect.x + 232 + 56, rect.y, rect.width - 156 - 126);
    };
Happy to hear. 🙂

If you're able to get the image appearing properly using the actors normal face name and index you can always substitute drawFace() with drawActorFace(), like so:

Code:
   Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
       var actorData = "[ Lv. " + actor.level + " ] " + actor.name();
     
       this.drawText(actorData, rect.x + 112, rect.y, 150);           
       this.drawActorFace(actor, 0, rect.y+4, 96, 29);
       this.drawActorIcons(actor, rect.x + 232 + 56, rect.y, rect.width - 156 - 126);
   };

Just shortens your code a tiny bit.
Thank you very much 🙂
giphy.gif

Original thread: https://forums.rpgmakerweb.com/threads/battle-status-customization.113250/