`;
};
HUDManager.getLogList = function () {
let result = '';
this._log.forEach(function (info) {
result += `
${info[0]}
by ${info[1]}
${info[4]}
${info[2]}
`;
}, this);
return result;
};
HUDManager.initManager = function () {
this.checkInternet();
};
HUDManager.initManager();
//-----------------------------------------------------------------------------
// Game_Temp
//-----------------------------------------------------------------------------
_.Game_Temp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function () {
_.Game_Temp_initialize.apply(this, arguments);
this.isManipulatingHud = false;
};
//-----------------------------------------------------------------------------
// Game_Map
//-----------------------------------------------------------------------------
_.Game_Map_isEventRunning = Game_Map.prototype.isEventRunning;
Game_Map.prototype.isEventRunning = function () {
return _.Game_Map_isEventRunning.apply(this, arguments) || $gameTemp.isManipulatingHud;
};
//-----------------------------------------------------------------------------
// Game_BattlerBase
//-----------------------------------------------------------------------------
Object.defineProperties(Game_BattlerBase.prototype, {
// Max TP
mtp: {
get: function () {
return this.maxTp();
},
configurable: true
}
});
//-----------------------------------------------------------------------------
// Scene_Map
//-----------------------------------------------------------------------------
_.Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function () {
_.Scene_Map_start.apply(this, arguments);
if (this._hud) {
HUDManager.setup($dataMapHUD, this._hud);
this._hud.refresh();
this.createHudUpperLayer();
}
};
_.Scene_Map_createMapNameWindow = Scene_Map.prototype.createMapNameWindow;
Scene_Map.prototype.createMapNameWindow = function () {
_.Scene_Map_createMapNameWindow.apply(this, arguments);
this.createHudLowerLayer();
};
Scene_Map.prototype.createHudLowerLayer = function () {
if (_.isPlaytest) this.createHudBackground();
this.createHud();
};
Scene_Map.prototype.createHudUpperLayer = function () {
if (_.isPlaytest) this.addHudLines();
if (this._fadeSprite) {
this.removeChild(this._fadeSprite);
this.addChild(this._fadeSprite);
}
};
Scene_Map.prototype.createHudBackground = function () {
this._hudBackground = new Sprite(new Bitmap(Graphics.boxWidth, Graphics.boxHeight));
this._hudBackground.bitmap.fillRect(0, 0, Graphics.boxWidth, Graphics.boxHeight, 'rgba(0, 0, 0, 0.3)');
this._hudBackground.opacity = 0;
this.addChild(this._hudBackground);
};
Scene_Map.prototype.createHud = function () {
this._hud = new MapHUD();
this.addChild(this._hud);
};
Scene_Map.prototype.addHudLines = function () {
const highlight = HUDManager.getHighlight();
this.addChild(highlight.getHorizontalLine());
this.addChild(highlight.getVerticalLine());
};
Scene_Map.prototype.startHud = function () {
if (this._mapLoaded) {
this._hudBackground.opacity = 255;
HUDManager.createWindow();
$gameTemp.isManipulatingHud = true;
}
};
Scene_Map.prototype.endHud = function () {
this._hudBackground.opacity = 0;
$gameTemp.isManipulatingHud = false;
};
//-----------------------------------------------------------------------------
// Scene_Battle
//-----------------------------------------------------------------------------
_.Scene_Battle_start = Scene_Battle.prototype.start;
Scene_Battle.prototype.start = function () {
_.Scene_Battle_start.apply(this, arguments);
if (this._hud) {
HUDManager.setup($dataBattleHUD, this._hud);
this._hud.refresh();
this.createHudUpperLayer();
}
};
_.Scene_Battle_createSpriteset = Scene_Battle.prototype.createSpriteset;
Scene_Battle.prototype.createSpriteset = function () {
_.Scene_Battle_createSpriteset.apply(this, arguments);
this.createHudLowerLayer();
};
Scene_Battle.prototype.createHudLowerLayer = function () {
if (_.isPlaytest) this.createHudBackground();
this.createHud();
};
Scene_Battle.prototype.createHudUpperLayer = function () {
if (_.isPlaytest) this.addHudLines();
if (this._fadeSprite) {
this.removeChild(this._fadeSprite);
this.addChild(this._fadeSprite);
}
};
Scene_Battle.prototype.createHudBackground = function () {
this._hudBackground = new Sprite(new Bitmap(Graphics.boxWidth, Graphics.boxHeight));
this._hudBackground.bitmap.fillRect(0, 0, Graphics.boxWidth, Graphics.boxHeight, 'rgba(0, 0, 0, 0.3)');
this._hudBackground.opacity = 0;
this.addChild(this._hudBackground);
};
Scene_Battle.prototype.createHud = function () {
this._hud = new BattleHUD();
this.addChild(this._hud);
};
Scene_Battle.prototype.addHudLines = function () {
const highlight = HUDManager.getHighlight();
this.addChild(highlight.getHorizontalLine());
this.addChild(highlight.getVerticalLine());
};
Scene_Battle.prototype.startHud = function () {
this._hudBackground.opacity = 255;
HUDManager.createWindow();
$gameTemp.isManipulatingHud = true;
};
Scene_Battle.prototype.endHud = function () {
this._hudBackground.opacity = 0;
$gameTemp.isManipulatingHud = false;
};
//-----------------------------------------------------------------------------
// Sprite_HUDCursor
//-----------------------------------------------------------------------------
function Sprite_HUDCursor() {
this.initialize.apply(this, arguments);
}
Sprite_HUDCursor.prototype = Object.create(Sprite.prototype);
Sprite_HUDCursor.prototype.constructor = Sprite_HUDCursor;
Sprite_HUDCursor.prototype.initialize = function () {
Sprite.prototype.initialize.call(this);
this.bitmap = new Bitmap(1, 1);
this.anchor.set(0.5);
this._spriteTarget = null;
this._speed = 8;
this._size = 10;
this.mode = '';
this.__isCursor = true;
this.createHudLines();
};
Sprite_HUDCursor.prototype.drawSquare = function (color) {
const bit = this.bitmap;
bit.fillRect(0, 0, bit.width, this._size, color);
bit.fillRect(0, bit.height - this._size, bit.width, this._size, color);
bit.fillRect(0, 0, this._size, bit.height, color);
bit.fillRect(bit.width - this._size, 0, this._size, bit.height, color);
};
Sprite_HUDCursor.prototype.fillSquare = function (color) {
const bit = this.bitmap;
const size = this._size * 2;
bit.fillRect(this._size, this._size, bit.width - size, bit.height - size, color);
};
Sprite_HUDCursor.prototype.update = function () {
Sprite.prototype.update.apply(this, arguments);
if (this._spriteTarget) {
this.opacity += this._speed;
if (this.opacity <= 100 || this.opacity >= 250) this._speed *= (-1);
const ctrl = Input.isPressed('control');
const shift = Input.isPressed('shift');
if (ctrl && this.mode !== 'ctrl') {
this.mode = 'ctrl';
this.refreshColor();
}
if (!ctrl && this.mode !== '') {
this.mode = '';
this.refreshColor();
}
}
};
Sprite_HUDCursor.prototype.setup = function (spr) {
if (spr) {
if (!spr.bitmap.isReady() && spr.delayHilight) {
spr.bitmap.addLoadListener(this.setupSprite.bind(this, spr));
} else {
this.setupSprite(spr);
}
} else {
this._spriteTarget = null;
this.bitmap.clear();
}
};
Sprite_HUDCursor.prototype.setupSprite = function (spr) {
const bit = this.bitmap;
const w = (spr.width * spr._baseXScale) + (this._size * 2);
const h = (spr.height * spr._baseYScale) + (this._size * 2);
bit.resize(w, h);
this._frame.width = w;
this._frame.height = h;
this._refresh();
this.refreshColor();
this._spriteTarget = spr;
};
Sprite_HUDCursor.prototype.refreshColor = function () {
let color = '#f08080';
if (this.mode === 'ctrl') {
color = '#80f080';
}
this.bitmap.clear();
if (!HUDManager.highlightType) {
this.drawSquare(color);
} else {
this.fillSquare(color);
}
};
Sprite_HUDCursor.prototype.createHudLines = function () {
this.horzLine = new Sprite(new Bitmap(Graphics.boxWidth, 2));
this.vertLine = new Sprite(new Bitmap(2, Graphics.boxHeight));
const temp = [this.horzLine, this.vertLine];
temp.forEach(function (sprite) {
sprite.anchor.set(0.5);
sprite.x = Graphics.boxWidth / 2;
sprite.y = Graphics.boxHeight / 2;
sprite.opacity = 0;
}.bind(this));
this.horzLine.bitmap.fillRect(0, 0, Graphics.boxWidth, 2, "rgba(255, 0, 0, 0.7)");
this.vertLine.bitmap.fillRect(0, 0, 2, Graphics.boxHeight, "rgba(255, 0, 0, 0.7)");
};
Sprite_HUDCursor.prototype.getHorizontalLine = function () {
return this.horzLine;
};
Sprite_HUDCursor.prototype.getVerticalLine = function () {
return this.vertLine;
};
//-----------------------------------------------------------------------------
// Sprite_HUDObject
//-----------------------------------------------------------------------------
function Sprite_HUDObject() {
this.initialize.apply(this, arguments);
}
Sprite_HUDObject.prototype = Object.create(Sprite.prototype);
Sprite_HUDObject.prototype.constructor = Sprite_HUDObject;
Sprite_HUDObject.prototype.initialize = function (bitmap, data) {
Sprite.prototype.initialize.call(this, bitmap);
this.anchor.set(0.5);
this.cancelAsTarget();
this.highlight = null;
this.snapRange = 24;
this.xSnaps = [];
this.ySnaps = [];
this._hasReset = true;
this._isActive = false;
this.setupAnimationInfo(data.animateInfo);
};
Sprite_HUDObject.prototype.setupAnimationInfo = function (aniInfo) {
//Dynamic Visibility
this._condition = '';
this._isVisible = true;
//X Animation
this._xSpeed = aniInfo.x.spd;
this._xLoop = aniInfo.x.loop;
this._xMin = aniInfo.x.min;
this._xMax = aniInfo.x.max;
this._xDir = 1;
this._xOffset = 0;
//Y Animation
this._ySpeed = aniInfo.y.spd;
this._yLoop = aniInfo.y.loop;
this._yMin = aniInfo.y.min;
this._yMax = aniInfo.y.max;
this._yDir = 1;
this._yOffset = 0;
//Scale Animation
this._sSpeed = (aniInfo.s.spd) / (100);
this._sLoop = aniInfo.s.loop;
this._sMin = aniInfo.s.min;
this._sMax = aniInfo.s.max;
this._sDir = 1;
this._scale = 1;
this._sCheck = 1;
this._baseXScale = 1;
this._baseYScale = 1;
//Rotation Animation
this._rSpeed = (aniInfo.r.spd) / (360);
this._rLoop = aniInfo.r.loop;
this._rMin = (aniInfo.r.min) * (Math.PI / 180);
this._rMax = (aniInfo.r.max) * (Math.PI / 180);
this._rDir = 1;
this.resetAnimations();
};
Sprite_HUDObject.prototype.resetAnimations = function () {
this._xOffset = this._xMin;
this._yOffset = this._yMin;
this._scale = this._sMin;
this._sCheck = this._sMin;
this.scale.x = this._baseXScale + (this._sMin - 1);
this.scale.y = this._baseYScale + (this._sMin - 1);
this.rotation = this._rMin;
this.updatePosition();
};
Sprite_HUDObject.prototype.update = function () {
Sprite.prototype.update.call(this);
this.updateActivity();
this.updateCondition();
if (this._isActive || ($gameTemp.isManipulatingHud && HUDManager.showPiecesType)) {
if (this.isTarget) {
this.updateMovement();
this.updateSnapLines();
this.updatePrecision();
this.updateLayers();
}
this.updateAnimations();
this.updateHighlightPosition();
}
};
Sprite_HUDObject.prototype.updateHighlightPosition = function () {
if (this.isTarget && this.highlight) {
this.highlight.x = this._originalX;
this.highlight.y = this._originalY;
}
};
Sprite_HUDObject.prototype.updateMovement = function () {
if (TouchInput.isPressed()) {
if (!Input.isPressed('ok')) this._originalX = TouchInput.x;
if (!Input.isPressed('cancel')) this._originalY = TouchInput.y;
if (!Input.isPressed('control')) this.updateSnap();
}
};
Sprite_HUDObject.prototype.updateLayers = function () {
if (this.prevY !== this.y) {
for (let i = 0; i < this.layerPeers.length; i++) {
const y = this.layerPeers[i];
const sign1 = this.prevY - y > 0;
const sign2 = this.y - y > 0;
if (sign1 !== sign2) {
HUDManager.refreshLayers();
break;
}
}
this.prevY = this.y;
}
};
Sprite_HUDObject.prototype.updateSnapLines = function () {
if (!this.horzLine || !this.vertLine) return;
const xLock = Input.isPressed('ok');
const yLock = Input.isPressed('cancel');
if (xLock) {
this.vertLine.x = this._originalX;
this.vertLine.opacity = 255;
if (!this.vertLine.isLocked) {
this.vertLine.isLocked = true;
this.vertLine.setColorTone([255, 255, 0, 0]);
}
} else if (HUDManager.snapMode) {
if (this.xSnaps.contains(this._originalX)) {
this.vertLine.x = this._originalX;
this.vertLine.opacity = 255;
} else {
this.vertLine.opacity = 0;
}
if (this.vertLine.isLocked) {
this.vertLine.isLocked = false;
this.vertLine.setColorTone([0, 0, 0, 0]);
}
} else {
if (this._originalX === this.xSnaps[1]) {
this.vertLine.x = this.xSnaps[1];
this.vertLine.opacity = 255;
} else {
this.vertLine.opacity = 0;
}
if (this.vertLine.isLocked) {
this.vertLine.isLocked = false;
this.vertLine.setColorTone([0, 0, 0, 0]);
}
}
if (yLock) {
this.horzLine.y = this._originalY;
this.horzLine.opacity = 255;
if (!this.horzLine.isLocked) {
this.horzLine.isLocked = true;
this.horzLine.setColorTone([255, 255, 0, 0]);
}
} else if (HUDManager.snapMode) {
if (this.ySnaps.contains(this._originalY)) {
this.horzLine.y = this._originalY;
this.horzLine.opacity = 255;
} else {
this.horzLine.opacity = 0;
}
if (this.horzLine.isLocked) {
this.horzLine.isLocked = false;
this.horzLine.setColorTone([0, 0, 0, 0]);
}
} else {
if (this._originalY === this.ySnaps[1]) {
this.horzLine.y = this.ySnaps[1];
this.horzLine.opacity = 255;
} else {
this.horzLine.opacity = 0;
}
if (this.horzLine.isLocked) {
this.horzLine.isLocked = false;
this.horzLine.setColorTone([0, 0, 0, 0]);
}
}
if (!xLock && !yLock) {
if (this.horzLine.opacity > 0 || this.vertLine.opacity > 0) {
if (!TouchInput.isPressed() || Input.isPressed('control')) {
this.horzLine.opacity = 0;
this.vertLine.opacity = 0;
}
}
}
};
Sprite_HUDObject.prototype.updateSnap = function () {
for (let i = 0; i < this.xSnaps.length; i++) {
const snap = this.xSnaps[i];
if (Math.abs(this._originalX - snap) < this.snapRange) {
this._originalX = snap;
break;
}
}
for (let i = 0; i < this.ySnaps.length; i++) {
const snap = this.ySnaps[i];
if (Math.abs(this._originalY - snap) < this.snapRange) {
this._originalY = snap;
break;
}
}
};
Sprite_HUDObject.prototype.updatePrecision = function () {
const speed = (Input.isPressed('shift')) ? 10 : 1;
if (Input.isRepeated('up')) {
this._originalY -= speed;
}
if (Input.isRepeated('down')) {
this._originalY += speed;
}
if (Input.isRepeated('left')) {
this._originalX -= speed;
}
if (Input.isRepeated('right')) {
this._originalX += speed;
}
};
Sprite_HUDObject.prototype.updateAnimations = function () {
this.updateAnimation('_xOffset', this._xSpeed, this._xLoop, this._xMin, this._xMax, '_xDir');
this.updateAnimation('_yOffset', this._ySpeed, this._yLoop, this._yMin, this._yMax, '_yDir');
this.updateAnimation('_scale', this._sSpeed, this._sLoop, this._sMin, this._sMax, '_sDir');
this.updateAnimation('rotation', this._rSpeed, this._rLoop, this._rMin, this._rMax, '_rDir');
this.updatePosition();
this.updateScale();
if ($gameTemp.isManipulatingHud) {
if (!TouchInput.isPressed()) {
if (this._hasReset) this._hasReset = false;
} else if (!this._hasReset) {
this._hasReset = true;
this.resetAnimations();
}
}
};
Sprite_HUDObject.prototype.updateCondition = function () {
if (this._condition) {
this._isVisible = this._isActive || ($gameTemp.isManipulatingHud && HUDManager.showPiecesType);
if (this.opacity > 0 && !this._isVisible) {
this._originalOpacity = this.opacity;
this.opacity = 0;
} else if (this.opacity <= 0 && this._isVisible) {
this.opacity = this._originalOpacity;
this.refresh(true);
}
}
};
// fix
Sprite_HUDObject.prototype.updateAnimation = function (mainVar, spd, loop, min, max, dirVar) {
if (spd) {
if (!loop) {
if (this[mainVar] <= min && this[dirVar] < 0) {
this[mainVar] = min;
this[dirVar] = 1;
}
if (this[mainVar] >= max && this[dirVar] > 0) {
this[mainVar] = max;
this[dirVar] = -1;
}
} else {
if (this[mainVar] >= max) {
this[mainVar] = min;
}
}
const newVal = this[mainVar] + (spd * this[dirVar]);
if (newVal < min) {
this[mainVar] = min;
} else if (newVal > max) {
this[mainVar] = max;
} else {
this[mainVar] = newVal;
}
}
};
Sprite_HUDObject.prototype.updatePosition = function () {
this.x = this._originalX + this._xOffset;
this.y = this._originalY + this._yOffset;
};
Sprite_HUDObject.prototype.updateScale = function () {
if (this._sCheck !== this._scale) {
this._sCheck = this._scale;
this.updateRealScale();
}
};
Sprite_HUDObject.prototype.updateRealScale = function () {
this.scale.x = this._baseXScale + (this._sCheck - 1);
this.scale.y = this._baseYScale + (this._sCheck - 1);
};
Sprite_HUDObject.prototype.setHighlight = function (highlight) {
this.highlight = highlight;
this.horzLine = this.highlight.horzLine;
this.vertLine = this.highlight.vertLine;
};
Sprite_HUDObject.prototype.setAsTarget = function () {
this.isTarget = true;
this.setupSnaps();
this.layerPeers = HUDManager.getSpritesOnLayer(this.z);
this.prevY = this.y;
};
Sprite_HUDObject.prototype.cancelAsTarget = function () {
this.isTarget = false;
};
Sprite_HUDObject.prototype.refresh = function (refreshProperties) {
if (!!refreshProperties) {
this.refreshProperties();
}
};
Sprite_HUDObject.prototype.refreshProperties = function () {
this.updateRealScale();
this._condition = this["Condition"];
this.updateActivity();
if (this.isTarget) {
this.updateConditionInput();
}
};
Sprite_HUDObject.prototype.updateActivity = function () {
if (this._condition === '') {
this._isActive = true;
} else {
try {
this._isActive = !!eval(this._condition);
} catch (e) {
console.log(this._condition + " \n" + e);
alert("There is an error with \"" + this._condition + "\" Press F8 to see more!");
this._condition = 'false';
this._isActive = false;
}
}
};
Sprite_HUDObject.prototype.setProperty = function (property, value) {
this[property] = value;
this.refresh(true);
};
Sprite_HUDObject.prototype.setupSnaps = function () {
const width = this.width * this._baseXScale;
const height = this.height * this._baseYScale;
if (!HUDManager.snapMode) {
this.xSnaps = [width / 2, Graphics.boxWidth / 2, Graphics.boxWidth - (width / 2)];
this.ySnaps = [height / 2, Graphics.boxHeight / 2, Graphics.boxHeight - (height / 2)];
} else {
const sprites = HUDManager.getSprites();
this.xSnaps = [];
this.ySnaps = [];
sprites.forEach(function (sprite) {
if (this !== sprite) {
if (!this.xSnaps.contains(sprite.x)) {
this.xSnaps.push(sprite.x);
}
if (!this.ySnaps.contains(sprite.y)) {
this.ySnaps.push(sprite.y);
}
}
}, this);
}
};
Sprite_HUDObject.prototype.updateConditionInput = function () {
if (MakerManager.window) {
const element = MakerManager.document.getElementById('Condition Bla');
if (!element) return;
let result = true;
if (this._isActive) {
element.innerHTML = `
Condition:
`;
} else {
element.innerHTML = `
Condition:
`;
}
}
};
Sprite_HUDObject.prototype.postError = function (e) {
console.log(e);
alert('The "Image" input had an error. Check the console for more info.');
};
Sprite_HUDObject.prototype.resizeBitmap = function (bit, width, height) {
if (bit.width !== width || bit.height !== height) {
bit.resize(width, height);
this._frame.width = 0;
this._frame.height = 0;
if (_.isV150) {
this._refreshFrame = true;
this._onBitmapLoad(bit);
} else {
this._onBitmapLoad();
}
}
};
//-----------------------------------------------------------------------------
// Sprite_HUDText
//-----------------------------------------------------------------------------
function Sprite_HUDText() {
this.initialize.apply(this, arguments);
}
Sprite_HUDText.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDText.prototype.constructor = Sprite_HUDText;
Sprite_HUDText._label = "Text";
/*
* Get HTML for Sprite_HUDText manipulation
*/
Sprite_HUDText.getHtml = function (data) {
const value = data["Value"];
let condition = data["Condition"];
const layer = data["Layer"];
const font = data["Font"];
const width = data["Max Width"];
const align = data["Align"];
const size = data["Font Size"];
const color = data["Text Color"];
const alpha = data["Text Alpha"];
const outlineColor = data["Outline Color"];
const outlineAlpha = data["Outline Alpha"];
const sele = ['', '', ''];
if (align === 'left') sele[0] = 'selected';
else if (align === 'center') sele[1] = 'selected';
else if (align === 'right') sele[2] = 'selected';
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
return `${HUDManager.createTitle(data.id, Sprite_HUDText._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Value", value)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createInput("Font", font)}
${HUDManager.createInput("Max Width", width)}
${HUDManager.createSelect("Align", ["left", sele[0], "Left"], ["center", sele[1], "Center"], ["right", sele[2], "Right"])}
${HUDManager.createInput("Font Size", size)}
${HUDManager.createColor("Text Color", color, "Text Alpha", alpha)}
${HUDManager.createColor("Outline Color", outlineColor, "Outline Alpha", outlineAlpha)}
${HUDManager.createRefresh()}
`;
};
//_.active
/*
* Register Sprite_HUDText within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDText._label);
HUDManager.types[Sprite_HUDText._label] = {
class: Sprite_HUDText,
html: Sprite_HUDText.getHtml,
data: {
"type": Sprite_HUDText._label,
"Value": "Gold: ${$gameParty.gold()}",
"Condition": "",
"Layer": "0",
"Font": "GameFont",
"Max Width": "150",
"Align": "left",
"Font Size": "30",
"Text Color": "#ffffff",
"Text Alpha": "255",
"Outline Color": "#000000",
"Outline Alpha": "127"
},
format: function (data) {
let temp;
try {
temp = String(eval("`" + data["Value"] + "`"));
} catch (e) {
console.log('Error with Text\n' + e);
temp = "ERROR";
}
if (temp.length > 15) temp = temp.substring(0, 15) + "...";
return temp;
}
}
Sprite_HUDText.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Layer", "Condition", "Max Width", "Font", "Align", "Font Size", "Text Color", "Text Alpha",
"Outline Color", "Outline Alpha", "Value"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this._value = this.getNewValue();
this.refresh(true);
};
Sprite_HUDText.prototype.getNewValue = function () {
let result;
try {
result = eval("`" + this["Value"] + "`");
} catch (e) {
console.log('Error with Text\n' + e);
result = "ERROR";
}
return result;
};
Sprite_HUDText.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
const newValue = this.getNewValue();
if (this._value !== newValue) {
this._value = newValue;
this.refresh();
}
};
Sprite_HUDText.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
this.bitmap.addLoadListener(function () {
this.bitmap.clear();
this.bitmap.drawText(this._value, 0, 0, this.bitmap.width, this.bitmap.height, this["Align"]);
this.setupSnaps();
}.bind(this));
};
Sprite_HUDText.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const bit = this.bitmap;
const width = parseInt(this["Max Width"]);
const height = parseInt(this["Font Size"]) + 12;
this.resizeBitmap(bit, width, height);
this.z = parseInt(this["Layer"]);
this.bitmap.fontFace = this["Font"];
this.bitmap.fontSize = parseInt(this["Font Size"]);
this.bitmap.textColor = _.convertHex(this["Text Color"], parseInt(this["Text Alpha"]));
this.bitmap.outlineColor = _.convertHex(this["Outline Color"], parseInt(this["Outline Alpha"]));
};
//-----------------------------------------------------------------------------
// Sprite_HUDTextEx
//-----------------------------------------------------------------------------
function Sprite_HUDTextEx() {
this.initialize.apply(this, arguments);
}
Sprite_HUDTextEx.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDTextEx.prototype.constructor = Sprite_HUDTextEx;
Sprite_HUDTextEx._label = "TextEx";
/*
* Get HTML for Sprite_HUDTextEx manipulation
*/
Sprite_HUDTextEx.getHtml = function (data) {
const value = data["Value"];
let condition = data["Condition"];
const layer = data["Layer"];
const width = data["Width"];
const height = data["Height"];
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
return `${HUDManager.createTitle(data.id, Sprite_HUDTextEx._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Value", value)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createInput("Width", width)}
${HUDManager.createInput("Height", height)}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDTextEx within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDTextEx._label);
HUDManager.types[Sprite_HUDTextEx._label] = {
class: Sprite_HUDTextEx,
html: Sprite_HUDTextEx.getHtml,
data: {
"type": Sprite_HUDTextEx._label,
"Value": "\\i[313] Icon",
"Condition": "",
"Layer": "0",
"Width": "150",
"Height": "36"
},
format: function (data) {
let temp = String(data["Value"]);
if (temp.length > 15) temp = temp.substring(0, 15) + "...";
return temp;
}
}
Sprite_HUDTextEx.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Layer", "Condition", "Width", "Height", "Value"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this.contents = this.bitmap;
this._value = this.convertEscapeCharacters(this["Value"]);
this.refresh(true);
};
Sprite_HUDTextEx.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
const newValue = this.convertEscapeCharacters(this["Value"]);
if (this._value !== newValue) {
this._value = newValue;
this.refresh();
}
};
Sprite_HUDTextEx.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
this.bitmap.addLoadListener(function () {
this.bitmap.clear();
this.drawTextEx(this._value, 0, 0);
}.bind(this));
};
Sprite_HUDTextEx.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const bit = this.bitmap;
const width = parseInt(this["Width"]);
const height = parseInt(this["Height"]);
this.resizeBitmap(bit, width, height);
this.z = parseInt(this["Layer"]);
this.setupSnaps();
};
Sprite_HUDTextEx.prototype.resetFontSettings = function () {
this.contents.fontFace = "GameFont";
this.contents.fontSize = 28;
this.contents.textColor = "#FFFFFF"
};
Sprite_HUDTextEx.prototype.textColor = function (n) {
if (this._textColorWin === undefined) this._textColorWin = new Window_Base();
return this._textColorWin.textColor(n);
};
Sprite_HUDTextEx.prototype.drawTextEx = Window_Base.prototype.drawTextEx;
Sprite_HUDTextEx.prototype.convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters;
Sprite_HUDTextEx.prototype.actorName = Window_Base.prototype.actorName;
Sprite_HUDTextEx.prototype.textWidth = Window_Base.prototype.textWidth;
Sprite_HUDTextEx.prototype.partyMemberName = Window_Base.prototype.partyMemberName;
Sprite_HUDTextEx.prototype.processCharacter = Window_Base.prototype.processCharacter;
Sprite_HUDTextEx.prototype.processNormalCharacter = Window_Base.prototype.processNormalCharacter;
Sprite_HUDTextEx.prototype.processNewLine = Window_Base.prototype.processNewLine;
Sprite_HUDTextEx.prototype.processNewPage = Window_Base.prototype.processNewPage;
Sprite_HUDTextEx.prototype.obtainEscapeCode = Window_Base.prototype.obtainEscapeCode;
Sprite_HUDTextEx.prototype.obtainEscapeParam = Window_Base.prototype.obtainEscapeParam;
Sprite_HUDTextEx.prototype.processEscapeCharacter = Window_Base.prototype.processEscapeCharacter;
Sprite_HUDTextEx.prototype.processDrawIcon = Window_Base.prototype.processDrawIcon;
Sprite_HUDTextEx.prototype.makeFontBigger = Window_Base.prototype.makeFontBigger;
Sprite_HUDTextEx.prototype.makeFontSmaller = Window_Base.prototype.makeFontSmaller;
Sprite_HUDTextEx.prototype.calcTextHeight = Window_Base.prototype.calcTextHeight;
Sprite_HUDTextEx.prototype.drawIcon = Window_Base.prototype.drawIcon;
Sprite_HUDTextEx.prototype.changeTextColor = Window_Base.prototype.changeTextColor;
_.setupYEPMessageCore = function () {
Sprite_HUDTextEx.prototype.textWidthEx = Window_Base.prototype.textWidthEx;
Sprite_HUDTextEx.prototype.setWordWrap = Window_Base.prototype.setWordWrap;
Sprite_HUDTextEx.prototype.convertExtraEscapeCharacters = Window_Base.prototype.convertExtraEscapeCharacters;
Sprite_HUDTextEx.prototype.actorClassName = Window_Base.prototype.actorClassName;
Sprite_HUDTextEx.prototype.actorNickname = Window_Base.prototype.actorNickname;
Sprite_HUDTextEx.prototype.partyClassName = Window_Base.prototype.partyClassName;
Sprite_HUDTextEx.prototype.partyNickname = Window_Base.prototype.partyNickname;
Sprite_HUDTextEx.prototype.escapeIconItem = Window_Base.prototype.escapeIconItem;
Sprite_HUDTextEx.prototype.obtainEscapeString = Window_Base.prototype.obtainEscapeString;
Sprite_HUDTextEx.prototype.checkWordWrap = Window_Base.prototype.checkWordWrap;
Sprite_HUDTextEx.prototype.saveCurrentWindowSettings = Window_Base.prototype.saveCurrentWindowSettings;
Sprite_HUDTextEx.prototype.restoreCurrentWindowSettings = Window_Base.prototype.restoreCurrentWindowSettings;
Sprite_HUDTextEx.prototype.clearCurrentWindowSettings = Window_Base.prototype.clearCurrentWindowSettings;
Sprite_HUDTextEx.prototype.textWidthExCheck = Window_Base.prototype.textWidthExCheck;
};
SRD.NotetagGetters.push(_.setupYEPMessageCore);
//-----------------------------------------------------------------------------
// Sprite_HUDShape
//-----------------------------------------------------------------------------
function Sprite_HUDShape() {
this.initialize.apply(this, arguments);
}
Sprite_HUDShape.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDShape.prototype.constructor = Sprite_HUDShape;
Sprite_HUDShape._label = "Shape";
/*
* Get HTML for Sprite_HUDText manipulation
*/
Sprite_HUDShape.getHtml = function (data) {
let condition = data["Condition"];
const layer = data["Layer"];
const shape = data["Shape"];
const width = data["Width"];
const height = data["Height"];
const fill = data["Fill Style"];
const blend = data["Blend"];
const color1 = data["Color 1"];
const color1A = data["Color 1 Alpha"];
const color2 = data["Color 2"];
const color2A = data["Color 2 Alpha"];
const size = data["Outline Size"];
const color3 = data["Outline Color"];
const color3A = data["Color 3 Alpha"];
const sele = ['', ''];
if (shape === 'Rectangle') sele[0] = 'selected';
else if (shape === 'Circle') sele[1] = 'selected';
const sele2 = ['', '', '', '', ''];
if (fill === 'solid') sele2[0] = 'selected';
else if (fill === 'horizontal') sele2[1] = 'selected';
else if (fill === 'vertical') sele2[2] = 'selected';
else if (fill === 'radical') sele2[3] = 'selected';
else if (fill === 'max radical') sele2[4] = 'selected';
const blendArray = [];
for (let i = 0; i <= 16; i++) {
blendArray.push([String(i), parseInt(blend) === i ? 'selected' : '', _.blendNames[i]])
}
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
return `${HUDManager.createTitle(data.id, Sprite_HUDShape._label)}
${HUDManager.createHeader()}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createSelect("Shape", ["Rectangle", sele[0], "Rectangle"], ["Circle", sele[1], "Circle"])}
${HUDManager.createInput("Width", width)}
${HUDManager.createInput("Height", height)}
${HUDManager.createSelect("Fill Style", ["solid", sele2[0], "Solid"],
["horizontal", sele2[1], "Horizontal Gradient"],
["vertical", sele2[2], "Vertical Gradient"],
["radical", sele2[3], "Radial Gradient"],
["max radical", sele2[4], "Max Radial Gradient"])}
${HUDManager.createSelectArray("Blend", blendArray)}
${HUDManager.createColor("Color 1", color1, "Color 1 Alpha", color1A)}
${HUDManager.createColor("Color 2", color2, "Color 2 Alpha", color2A)}
${HUDManager.createInput("Outline Size", size)}
${HUDManager.createColor("Outline Color", color3, "Color 3 Alpha", color3A)}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDShape within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDShape._label);
HUDManager.types[Sprite_HUDShape._label] = {
class: Sprite_HUDShape,
html: Sprite_HUDShape.getHtml,
data: {
"type": Sprite_HUDShape._label,
"Layer": "0",
"Condition": "",
"Shape": "Circle",
"Width": "75",
"Height": "75",
"Fill Style": "solid",
"Blend": "0",
"Color 1": "#ffffff",
"Color 1 Alpha": "255",
"Color 2": "#000000",
"Color 2 Alpha": "255",
"Outline Size": "0",
"Outline Color": "#000000",
"Color 3 Alpha": "255"
},
format: function (data) {
let temp = String(data["Shape"] + " " + data["Fill Style"]);
if (temp.length > 15) temp = temp.substring(0, 15) + "...";
return temp;
}
}
Sprite_HUDShape.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Layer", "Condition", "Shape", "Width", "Height", "Fill Style", "Blend", "Color 1", "Color 1 Alpha",
"Color 2", "Color 2 Alpha", "Outline Size", "Outline Color", "Color 3 Alpha"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this.refresh(true);
};
Sprite_HUDShape.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
};
Sprite_HUDShape.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
this.bitmap.addLoadListener(function () {
const shape = this["Shape"];
const outline = parseInt(this["Outline Size"]);
const width = parseInt(this["Width"]);
const height = parseInt(this["Height"]);
const w2 = this.bitmap.width / 2;
const h2 = this.bitmap.height / 2;
const fill = this["Fill Style"];
const color1 = _.convertHex(this["Color 1"], parseInt(this["Color 1 Alpha"]));
const color2 = _.convertHex(this["Color 2"], parseInt(this["Color 2 Alpha"]));
const color3 = _.convertHex(this["Outline Color"], parseInt(this["Color 3 Alpha"]));
let color = color1;
if (fill === 'vertical') {
color = this.bitmap._context.createLinearGradient(0, 0, 0, height);
} else if (fill === 'horizontal') {
color = this.bitmap._context.createLinearGradient(0, 0, width, 0);
} else if (fill === 'radical') {
const biggest = (width > height) ? width : height;
color = this.bitmap._context.createRadialGradient(w2, h2, 0, w2, h2, biggest);
} else if (fill === 'max radical') {
const smallest = (width < height) ? width : height;
color = this.bitmap._context.createRadialGradient(w2, h2, 0, w2, h2, smallest);
}
if (fill !== 'solid') {
color.addColorStop(0, color1);
color.addColorStop(1, color2);
}
this.bitmap.clear();
if (shape === 'Rectangle') {
if (outline) {
this.bitmap.fillRect(0, 0, this.bitmap.width, this.bitmap.height, color3);
}
this.bitmap.fillRect(outline, outline, width, height, color);
} else if (shape === 'Circle') {
if (outline) {
this.bitmap.drawOval(w2, h2, this.bitmap.width / 2, this.bitmap.height / 2, color3);
}
this.bitmap.drawOval(w2, h2, width / 2, height / 2, color);
}
}.bind(this));
};
Sprite_HUDShape.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const bit = this.bitmap;
const outlineSize = parseInt(this["Outline Size"]);
const width = parseInt(this["Width"]) + (outlineSize * 2);
const height = parseInt(this["Height"]) + (outlineSize * 2);
this.resizeBitmap(bit, width, height);
this.z = parseInt(this["Layer"]);
this.blendMode = parseInt(this["Blend"]);
this.setupSnaps();
};
//-----------------------------------------------------------------------------
// Sprite_HUDImage
//-----------------------------------------------------------------------------
function Sprite_HUDImage() {
this.initialize.apply(this, arguments);
}
Sprite_HUDImage.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDImage.prototype.constructor = Sprite_HUDImage;
Sprite_HUDImage._label = "Picture";
/*
* Get HTML for Sprite_HUDText manipulation
*/
Sprite_HUDImage.getHtml = function (data) {
const image = data["Image"];
let condition = data["Condition"];
const layer = data["Layer"];
const scaleX = data["Scale X"];
const scaleY = data["Scale Y"];
const opacity = data["Opacity"];
const hue = data["Hue"];
const blend = data["Blend"];
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
const blendArray = [];
for (let i = 0; i <= 16; i++) {
blendArray.push([String(i), parseInt(blend) === i ? 'selected' : '', _.blendNames[i]])
}
return `${HUDManager.createTitle(data.id, Sprite_HUDImage._label)}
${HUDManager.createHeader()}
${HUDManager.createFilelist("Image", 'pictures', image)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createInput("Scale X", scaleX)}
${HUDManager.createInput("Scale Y", scaleY)}
${HUDManager.createInput("Opacity", opacity)}
${HUDManager.createInput("Hue", hue)}
${HUDManager.createSelectArray("Blend", blendArray)}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDImage within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDImage._label);
HUDManager.types[Sprite_HUDImage._label] = {
class: Sprite_HUDImage,
html: Sprite_HUDImage.getHtml,
data: {
"type": Sprite_HUDImage._label,
"Condition": "",
"Layer": "0",
"Image": _.getFirstFile('pictures'),
"Scale X": "1",
"Scale Y": "1",
"Opacity": "255",
"Hue": "0",
"Blend": "0"
},
format: function (data) {
let temp = String(data["Image"]);
if (temp.length > 15) temp = temp.substring(0, 15) + "...";
return temp;
}
}
Sprite_HUDImage.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(32, 32), info);
this.delayHilight = true;
this.properties = ["Layer", "Condition", "Image", "Scale X", "Scale Y", "Opacity", "Hue", "Blend"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this.refresh(true);
};
Sprite_HUDImage.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
};
Sprite_HUDImage.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
this.bitmap.addLoadListener(this.setupSnaps.bind(this));
};
Sprite_HUDImage.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const image = this["Image"];
if (image) {
try {
this.bitmap = _.getPicture(image, parseInt(this["Hue"]));
} catch (e) {
this.postError(e);
this["Image"] = '';
this._value = '';
this.bitmap = null;
return;
}
this.z = parseInt(this["Layer"]);
this._baseXScale = parseFloat(this["Scale X"]);
this._baseYScale = parseFloat(this["Scale Y"]);
this.updateRealScale();
this.opacity = parseInt(this["Opacity"]);
this.blendMode = parseInt(this["Blend"]);
}
};
//-----------------------------------------------------------------------------
// Sprite_HUDCodeImage
//-----------------------------------------------------------------------------
function Sprite_HUDCodeImage() {
this.initialize.apply(this, arguments);
}
Sprite_HUDCodeImage.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDCodeImage.prototype.constructor = Sprite_HUDCodeImage;
Sprite_HUDCodeImage._label = "Picture EX";
/*
* Get HTML for Sprite_HUDText manipulation
*/
Sprite_HUDCodeImage.getHtml = function (data) {
const image = data["Image"];
let condition = data["Condition"];
const layer = data["Layer"];
const scaleX = data["Scale X"];
const scaleY = data["Scale Y"];
const opacity = data["Opacity"];
const hue = data["Hue"];
const blend = data["Blend"];
try {
eval(image);
} catch (e) {
data["Image"] = '';
image = '';
}
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
const blendArray = [];
for (let i = 0; i <= 16; i++) {
blendArray.push([String(i), parseInt(blend) === i ? 'selected' : '', _.blendNames[i]])
}
return `${HUDManager.createTitle(data.id, Sprite_HUDCodeImage._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Image", image)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createInput("Scale X", scaleX)}
${HUDManager.createInput("Scale Y", scaleY)}
${HUDManager.createInput("Opacity", opacity)}
${HUDManager.createInput("Hue", hue)}
${HUDManager.createSelectArray("Blend", blendArray)}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDCodeImage within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDCodeImage._label);
HUDManager.types[Sprite_HUDCodeImage._label] = {
class: Sprite_HUDCodeImage,
html: Sprite_HUDCodeImage.getHtml,
data: {
"type": Sprite_HUDCodeImage._label,
"Condition": "",
"Layer": "0",
"Image": "'Gold'",
"Scale X": "1",
"Scale Y": "1",
"Opacity": "255",
"Hue": "0",
"Blend": "0"
},
format: function (data) {
let temp;
try {
temp = eval(data["Image"]);
} catch (e) {
temp = "ERROR";
}
if (temp.length > 12) temp = temp.substring(0, 12) + "...";
return temp;
}
}
Sprite_HUDCodeImage.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(32, 32), info);
this.delayHilight = true;
this.properties = ["Layer", "Condition", "Image", "Scale X", "Scale Y", "Opacity", "Hue", "Blend"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this._value = this.getNewImage();
this.refresh(true);
};
Sprite_HUDCodeImage.prototype.getNewImage = function () {
let result;
try {
result = eval(this["Image"]);
} catch (e) {
console.log('Error with Picture EX\n' + e);
result = '';
}
return result;
};
Sprite_HUDCodeImage.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
let newValue = this._value;
newValue = this.getNewImage();
if (this._value !== newValue) {
this._value = newValue;
this.refresh(true);
}
};
Sprite_HUDCodeImage.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
if (this.bitmap) {
this.bitmap.addLoadListener(this.setupSnaps.bind(this));
}
};
Sprite_HUDCodeImage.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const image = this._value;
if (image) {
try {
this.bitmap = _.getPicture(image, parseInt(this["Hue"]));
} catch (e) {
this.postError(e);
this["Image"] = '';
this._value = '';
this.bitmap = null;
return;
}
this.z = parseInt(this["Layer"]);
this._baseXScale = parseFloat(this["Scale X"]);
this._baseYScale = parseFloat(this["Scale Y"]);
this.updateRealScale();
this.opacity = parseInt(this["Opacity"]);
this.blendMode = parseInt(this["Blend"]);
} else {
this.bitmap = null;
}
};
//-----------------------------------------------------------------------------
// Sprite_HUDGauge
//-----------------------------------------------------------------------------
function Sprite_HUDGauge() {
this.initialize.apply(this, arguments);
}
Sprite_HUDGauge.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDGauge.prototype.constructor = Sprite_HUDGauge;
Sprite_HUDGauge._label = "Gauge";
/*
* Get HTML for Sprite_HUDGauge manipulation
*/
Sprite_HUDGauge.getHtml = function (data) {
const value = data["Cur. Value"];
const max = data["Max Value"];
let condition = data["Condition"];
const layer = data["Layer"];
const width = data["Width"];
const height = data["Height"];
const fill = data["Style"];
const color1 = data["Color 1"];
const color1A = data["Color 1 Alpha"];
const color2 = data["Color 2"];
const color2A = data["Color 2 Alpha"];
const size = data["Outline Size"];
const color3 = data["Outline Color"];
const color3A = data["Color 3 Alpha"];
const color4 = data["Back Color"];
const color4A = data["Color 4 Alpha"];
const sele2 = ['', '', '', ''];
if (fill === 'left') sele2[0] = 'selected';
else if (fill === 'right') sele2[1] = 'selected';
else if (fill === 'up') sele2[2] = 'selected';
else if (fill === 'down') sele2[3] = 'selected';
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
return `${HUDManager.createTitle(data.id, Sprite_HUDGauge._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Cur. Value", value)}
${HUDManager.createInput("Max Value", max)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createInput("Width", width)}
${HUDManager.createInput("Height", height)}
${HUDManager.createSelect("Style", ["left", sele2[0], "Left"],
["right", sele2[1], "Right"],
["up", sele2[2], "Up"],
["down", sele2[3], "Down"])}
${HUDManager.createColor("Color 1", color1, "Color 1 Alpha", color1A)}
${HUDManager.createColor("Color 2", color2, "Color 2 Alpha", color2A)}
${HUDManager.createColor("Back Color", color4, "Color 4 Alpha", color4A)}
${HUDManager.createInput("Outline Size", size)}
${HUDManager.createColor("Outline Color", color3, "Color 3 Alpha", color3A)}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDGauge within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDGauge._label);
HUDManager.types[Sprite_HUDGauge._label] = {
class: Sprite_HUDGauge,
html: Sprite_HUDGauge.getHtml,
data: {
"type": Sprite_HUDGauge._label,
"Cur. Value": "$gameParty.leader().hp",
"Max Value": "$gameParty.leader().mhp",
"Condition": "",
"Layer": "0",
"Width": "150",
"Height": "30",
"Style": "left",
"Color 1": "#ff8000",
"Color 1 Alpha": "255",
"Color 2": "#ff0000",
"Color 2 Alpha": "255",
"Back Color": "#666666",
"Color 4 Alpha": "255",
"Outline Size": "1",
"Outline Color": "#222222",
"Color 3 Alpha": "255"
},
format: function (data) {
let temp;
try {
temp = String(eval(data["Cur. Value"]));
temp += "/" + String(eval(data["Max Value"]));
} catch (e) {
temp = "ERROR";
}
if (temp.length > 15) temp = temp.substring(0, 15) + "...";
return temp;
}
}
Sprite_HUDGauge.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Cur. Value", "Max Value", "Condition", "Layer", "Width", "Height", "Style", "Color 1",
"Color 1 Alpha", "Color 2", "Color 2 Alpha", "Back Color", "Color 4 Alpha", "Outline Size", "Outline Color", "Color 3 Alpha"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this._value = this.getCurrentValue();
this._maxvalue = this.getMaxValue();
this.refresh(true);
};
Sprite_HUDGauge.prototype.getCurrentValue = function () {
let result;
try {
result = eval(this["Cur. Value"]);
} catch (e) {
console.log('Error with Gauge\n' + e);
result = 0;
}
return result;
};
Sprite_HUDGauge.prototype.getMaxValue = function () {
let result;
try {
result = eval(this["Max Value"]);
} catch (e) {
console.log('Error with Gauge\n' + e);
result = 0;
}
return result;
};
Sprite_HUDGauge.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
const newValue = this.getCurrentValue();
const newMax = this.getMaxValue();
if (this._value !== newValue || this._maxvalue !== newMax) {
this._value = newValue;
this._maxvalue = newMax;
this.refresh();
}
};
Sprite_HUDGauge.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
if ((this._value || this._value === 0) && (this._maxvalue || this._maxvalue == 0)) {
this.bitmap.clear();
const outline = parseInt(this["Outline Size"]);
const width = this["Width"];
const height = this["Height"];
const color1 = _.convertHex(this["Color 1"], parseInt(this["Color 1 Alpha"]));
const color2 = _.convertHex(this["Color 2"], parseInt(this["Color 2 Alpha"]));
const outlineCol = _.convertHex(this["Outline Color"], parseInt(this["Color 3 Alpha"]));
const backCol = _.convertHex(this["Back Color"], parseInt(this["Color 4 Alpha"]));
this.bitmap.fillRect(0, 0, width + (outline * 2), height + (outline * 2), outlineCol);
this.bitmap.fillRect(outline, outline, width, height, backCol);
const fillW = Math.floor(width * (this._value / this._maxvalue)) || 0;
const fillH = Math.floor(height * (this._value / this._maxvalue)) || 0;
const style = this["Style"];
if (style === 'up') {
this.bitmap.gradientFillRect(outline, (height - fillH) + outline, width, fillH, color2, color1, true);
} else if (style === 'down') {
this.bitmap.gradientFillRect(outline, outline, width, fillH, color1, color2, true);
} else if (style === 'left') {
this.bitmap.gradientFillRect(outline, outline, fillW, height, color2, color1);
} else if (style === 'right') {
this.bitmap.gradientFillRect((width - fillW) + outline, outline, fillW, height, color1, color2);
}
}
};
Sprite_HUDGauge.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const bit = this.bitmap;
const outline = parseInt(this["Outline Size"]);
const width = parseInt(this["Width"]) + (outline * 2);
const height = parseInt(this["Height"]) + (outline * 2);
this.resizeBitmap(bit, width, height);
this.z = parseInt(this["Layer"]);
this.setupSnaps();
};
//-----------------------------------------------------------------------------
// Sprite_HUDImageGauge
//-----------------------------------------------------------------------------
function Sprite_HUDImageGauge() {
this.initialize.apply(this, arguments);
}
Sprite_HUDImageGauge.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDImageGauge.prototype.constructor = Sprite_HUDImageGauge;
Sprite_HUDImageGauge._label = "Image Gauge";
/*
* Get HTML for Sprite_HUDImageGauge manipulation
*/
Sprite_HUDImageGauge.getHtml = function (data) {
const value = data["Cur. Value"];
const max = data["Max Value"];
let condition = data["Condition"];
const layer = data["Layer"];
const scaleX = data["Scale X"];
const scaleY = data["Scale Y"];
const fill = data["Style"];
const main = data["Main Image"];
const back = data["Back Image"];
const sele2 = ['', '', '', ''];
if (fill === 'left') sele2[0] = 'selected';
else if (fill === 'right') sele2[1] = 'selected';
else if (fill === 'up') sele2[2] = 'selected';
else if (fill === 'down') sele2[3] = 'selected';
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
return `${HUDManager.createTitle(data.id, Sprite_HUDImageGauge._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Cur. Value", value)}
${HUDManager.createInput("Max Value", max)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createFilelist("Main Image", 'gauge_images', main)}
${HUDManager.createFilelist("Back Image", 'gauge_backs', back, true)}
${HUDManager.createInput("Scale X", scaleX)}
${HUDManager.createInput("Scale Y", scaleY)}
${HUDManager.createSelect("Style", ["left", sele2[0], "Left"],
["right", sele2[1], "Right"],
["up", sele2[2], "Up"],
["down", sele2[3], "Down"])}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDImageGauge within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDImageGauge._label);
HUDManager.types[Sprite_HUDImageGauge._label] = {
class: Sprite_HUDImageGauge,
html: Sprite_HUDImageGauge.getHtml,
data: {
"type": Sprite_HUDImageGauge._label,
"Cur. Value": "$gameParty.leader().hp",
"Max Value": "$gameParty.leader().mhp",
"Condition": "",
"Layer": "0",
"Scale X": "1",
"Scale Y": "1",
"Style": "left",
"Main Image": _.getFirstFile('gauge_images'),
"Back Image": _.getFirstFile('gauge_backs')
},
format: function (data) {
let temp;
try {
temp = String(eval(data["Cur. Value"]));
temp += "/" + String(eval(data["Max Value"]));
} catch (e) {
temp = "ERROR";
}
if (temp.length > 12) temp = temp.substring(0, 12) + "...";
return temp;
}
}
Sprite_HUDImageGauge.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Cur. Value", "Max Value", "Condition", "Layer", "Scale X", "Scale Y", "Style",
"Main Image", "Back Image"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this._value = this.getCurrentValue();
this._maxvalue = this.getMaxValue();
this._gauge = new Sprite();
this._gauge.anchor.y = 0.5;
this.addChild(this._gauge);
this.refresh(true);
};
Sprite_HUDImageGauge.prototype.getCurrentValue = function () {
let result;
try {
result = eval(this["Cur. Value"]);
} catch (e) {
console.log('Error with Gauge\n' + e);
result = 0;
}
return result;
};
Sprite_HUDImageGauge.prototype.getMaxValue = function () {
let result;
try {
result = eval(this["Max Value"]);
} catch (e) {
console.log('Error with Gauge\n' + e);
result = 0;
}
return result;
};
Sprite_HUDImageGauge.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
const newValue = this.getCurrentValue();
const newMax = this.getMaxValue();
if (this._value !== newValue || this._maxvalue !== newMax) {
this._value = newValue;
this._maxvalue = newMax;
this.refresh();
}
};
Sprite_HUDImageGauge.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
const style = this["Style"];
const horizontal = Boolean(style === 'left' || style === 'right');
if (this.bitmap) {
this.bitmap.addLoadListener(function () {
if ($gameTemp.isManipulatingHud && this.highlight) this.highlight.setup(this);
if (horizontal) {
this._gauge.y = 0;
this._gauge.x = (this.bitmap.width / -2);
this._gauge.anchor.x = 0;
this._gauge.anchor.y = 0.5;
} else {
this._gauge.x = 0;
this._gauge.y = (this.bitmap.height / -2);
this._gauge.anchor.y = 0;
this._gauge.anchor.x = 0.5;
}
this.setupSnaps();
}.bind(this));
}
if ((this._value || this._value === 0) && (this._maxvalue || this._maxvalue == 0)) {
this._gauge.bitmap.addLoadListener(function () {
if (horizontal) {
this._gauge._frame.height = this._gauge.bitmap.height;
this._gauge._frame.y = 0;
this._gauge._frame.width = this._gauge.bitmap.width * (this._value / this._maxvalue);
if (style === 'right') {
this._gauge._frame.x = this._gauge.bitmap.width - this._gauge._frame.width;
if (this.bitmap) this._gauge.x = (this.bitmap.width / -2) + this._gauge._frame.x;
} else if (style === 'left') {
this._gauge._frame.x = 0;
if (this.bitmap) this._gauge.x = (this.bitmap.width / -2);
}
this._gauge._refresh();
if (!this.bitmap) {
this._gauge.x = (this._gauge.bitmap.width / -2);
this.setupSnaps2();
}
} else {
this._gauge._frame.width = this._gauge.bitmap.width;
this._gauge._frame.x = 0;
this._gauge._frame.height = this._gauge.bitmap.height * (this._value / this._maxvalue);
if (style === 'down') {
this._gauge._frame.y = this._gauge.bitmap.height - this._gauge._frame.height;
this._gauge.y = (this.bitmap.height / -2) + this._gauge._frame.y;
} else if (style === 'up') {
this._gauge._frame.y = 0;
this._gauge.y = (this.bitmap.height / -2);
}
this._gauge._refresh();
if (!this.bitmap) {
this._gauge.y = (this._gauge.bitmap.height / -2);
this.setupSnaps2();
}
}
}.bind(this));
}
};
Sprite_HUDImageGauge.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
this.z = parseInt(this["Layer"]);
const front = this["Main Image"];
const back = this["Back Image"];
if (front) {
this._gauge.bitmap = _.getGauge(front);
this._baseXScale = parseFloat(this["Scale X"]);
this._baseYScale = parseFloat(this["Scale Y"]);
this.updateRealScale();
}
if (back && back !== "N\n\nONE") {
this.bitmap = _.getGaugeBack(back);
} else {
this.bitmap = null;
}
};
Sprite_HUDImageGauge.prototype.setupSnaps2 = function () {
const width = this._gauge.width * this._baseXScale;
const height = this._gauge.height * this._baseYScale;
this.xSnaps = [width / 2, Graphics.boxWidth / 2, Graphics.boxWidth - (width / 2)];
this.ySnaps = [height / 2, Graphics.boxHeight / 2, Graphics.boxHeight - (height / 2)];
};
//-----------------------------------------------------------------------------
// Sprite_HUDImageText
//-----------------------------------------------------------------------------
function Sprite_HUDImageText() {
this.initialize.apply(this, arguments);
}
Sprite_HUDImageText.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDImageText.prototype.constructor = Sprite_HUDImageText;
Sprite_HUDImageText._label = "Image Numbers";
/*
* Get HTML for Sprite_HUDText manipulation
*/
Sprite_HUDImageText.getHtml = function (data) {
const value = data["Value"];
let condition = data["Condition"];
const layer = data["Layer"];
const image = data["Image"];
const scaleX = data["Scale X"];
const scaleY = data["Scale Y"];
const opacity = data["Opacity"];
const hue = data["Hue"];
const blend = data["Blend"];
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
const blendArray = [];
for (let i = 0; i <= 16; i++) {
blendArray.push([String(i), parseInt(blend) === i ? 'selected' : '', _.blendNames[i]])
}
return `${HUDManager.createTitle(data.id, Sprite_HUDImageText._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Value", value)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createFilelist("Image", 'numbers', image)}
${HUDManager.createInput("Scale X", scaleX)}
${HUDManager.createInput("Scale Y", scaleY)}
${HUDManager.createInput("Opacity", opacity)}
${HUDManager.createInput("Hue", hue)}
${HUDManager.createSelectArray("Blend", blendArray)}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDImageText within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDImageText._label);
HUDManager.types[Sprite_HUDImageText._label] = {
class: Sprite_HUDImageText,
html: Sprite_HUDImageText.getHtml,
data: {
"type": Sprite_HUDImageText._label,
"Value": "$gameParty.gold()",
"Condition": "",
"Layer": "0",
"Image": _.getFirstFile('numbers'),
"Scale X": "1",
"Scale Y": "1",
"Opacity": "255",
"Hue": "0",
"Blend": "0"
},
format: function (data) {
let temp;
try {
temp = String(eval(data["Value"]));
} catch (e) {
temp = "ERROR";
}
if (temp.length > 12) temp = temp.substring(0, 12) + "...";
return temp;
}
}
Sprite_HUDImageText.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Value", "Layer", "Condition", "Image", "Scale X", "Scale Y", "Opacity", "Hue", "Blend"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this._value = this.getValue();
this._textLength = String(this._value).length;
this._oBitmap = null;
this._numbers = [];
this.refresh(true);
};
Sprite_HUDImageText.prototype.getValue = function () {
let result;
try {
result = eval(this["Value"]);
} catch (e) {
console.log('Error with Image Text\n' + e);
result = 0;
}
return result;
};
Sprite_HUDImageText.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
const newValue = this.getValue();
if (this._value !== newValue) {
this._value = newValue;
this.refresh();
}
};
Sprite_HUDImageText.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
this._oBitmap.addLoadListener(function () {
const width = this._oBitmap.width / 10;
const height = this._oBitmap.height;
this._textLength = String(this._value).length;
this.bitmap = new Bitmap(width * this._textLength, height);
if (this._numbers.length !== this._textLength) {
this.clearNumbers();
this.createNumbers(width);
}
this.applyNumbers(width, height);
if ($gameTemp.isManipulatingHud && this.highlight) this.highlight.setup(this);
this.setupSnaps();
}.bind(this));
};
Sprite_HUDImageText.prototype.clearNumbers = function () {
this._numbers.forEach(function (number) {
this.removeChild(number);
}, this);
this._numbers = [];
};
Sprite_HUDImageText.prototype.createNumbers = function (width) {
for (let i = 0; i < this._textLength; i++) {
const sprite = new Sprite(this._oBitmap);
sprite.anchor.set(0.5);
sprite.blendMode = parseInt(this["Blend"]);
this.addChild(sprite);
this._numbers.push(sprite);
sprite.x = (i * width) - (this.bitmap.width / 2) + (width / 2);
}
};
Sprite_HUDImageText.prototype.applyNumbers = function (width, height) {
const strValue = String(this._value);
for (let i = 0; i < this._textLength; i++) {
const num = parseInt(strValue[i]);
this._numbers[i].setFrame(width * num, 0, width, height);
}
};
Sprite_HUDImageText.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
this.z = parseInt(this["Layer"]);
this.clearNumbers();
this._value = this.getValue();
this._oBitmap = _.getNumbers(this["Image"], parseInt(this["Hue"]));
this._baseXScale = parseFloat(this["Scale X"]);
this._baseYScale = parseFloat(this["Scale Y"]);
this.updateRealScale();
this.opacity = parseInt(this["Opacity"]);
this._numbers.forEach(function (sprite) {
sprite.blendMode = parseInt(this["Blend"]);
}, this);
};
//-----------------------------------------------------------------------------
// Sprite_HUDFace
//-----------------------------------------------------------------------------
function Sprite_HUDFace() {
this.initialize.apply(this, arguments);
}
Sprite_HUDFace.prototype = Object.create(Sprite_HUDObject.prototype);
Sprite_HUDFace.prototype.constructor = Sprite_HUDFace;
Sprite_HUDFace._label = "Actor Face";
/*
* Get HTML for Sprite_HUDText manipulation
*/
Sprite_HUDFace.getHtml = function (data) {
const value = data["Actor ID"];
let condition = data["Condition"];
const layer = data["Layer"];
const width = data["Width"];
const height = data["Height"];
const color = data["Background Color"];
const alpha = data["Background Alpha"];
const mask = data["Mask"];
const sele = ['', ''];
if (mask === '0') sele[0] = 'selected';
else if (mask === '1') sele[1] = 'selected';
try {
eval(condition);
} catch (e) {
data["Condition"] = '';
condition = '';
}
return `${HUDManager.createTitle(data.id, Sprite_HUDImageText._label)}
${HUDManager.createHeader()}
${HUDManager.createInput("Actor ID", value)}
${HUDManager.createConditionInput("Condition", condition)}
${HUDManager.createInput("Layer", layer)}
${HUDManager.createInput("Width", width)}
${HUDManager.createInput("Height", height)}
${HUDManager.createColor("Background Color", color, "Background Alpha", alpha)}
${HUDManager.createSelect("Mask", ["0", sele[0], "None"],
["1", sele[1], "Circle"])}
${HUDManager.createRefresh()}
`;
};
/*
* Register Sprite_HUDImageText within the HUDManager
*/
HUDManager.typeNames.push(Sprite_HUDFace._label);
HUDManager.types[Sprite_HUDFace._label] = {
class: Sprite_HUDFace,
html: Sprite_HUDFace.getHtml,
data: {
"type": Sprite_HUDFace._label,
"Actor ID": "$gameParty.leader().actorId()",
"Condition": "",
"Layer": "0",
"Width": "144",
"Height": "144",
"Background Color": '#FFFFFF',
"Background Alpha": "255",
"Mask": "1"
},
format: function (data) {
let temp;
try {
temp = "Actor: " + String(eval(data["Actor ID"]));
} catch (e) {
temp = "ERROR";
}
if (temp.length > 12) temp = temp.substring(0, 12) + "...";
return temp;
}
}
Sprite_HUDFace.prototype.initialize = function (info) {
Sprite_HUDObject.prototype.initialize.call(this, new Bitmap(1, 1), info);
this.properties = ["Actor ID", "Layer", "Condition", "Width", "Height", "Background Color", "Background Alpha", "Mask"];
for (let i = 0; i < this.properties.length; i++) {
const prop = this.properties[i];
this[prop] = info[prop];
}
this._value = this.getActorId();
this._actor = $gameActors.actor(this._value);
this._curFace = this._actor.faceName();
this.refresh(true);
};
Sprite_HUDFace.prototype.getActorId = function () {
let result;
try {
result = eval(this["Actor ID"]);
} catch (e) {
console.log('Error with Actor Face\n' + e);
result = 1;
}
return result;
};
Sprite_HUDFace.prototype.update = function () {
Sprite_HUDObject.prototype.update.call(this);
if (!this._isActive) return;
const newValue = this.getActorId();
if (this._value !== newValue || this._curFace !== this._actor.faceName()) {
this._value = newValue;
this.refresh(true);
}
};
Sprite_HUDFace.prototype.refresh = function (refreshProperties) {
Sprite_HUDObject.prototype.refresh.apply(this, arguments);
this._oBitmap.addLoadListener(this.refreshBitmap.bind(this));
};
Sprite_HUDFace.prototype.refreshBitmap = function () {
this.bitmap.clear();
const color = _.convertHex(this["Background Color"], parseInt(this["Background Alpha"]));
this.bitmap.fillRect(0, 0, this.bitmap.width, this.bitmap.height, color);
this.drawFace(this._actor.faceIndex(), parseInt(this["Width"]), parseInt(this["Height"]));
this.setupSnaps();
};
Sprite_HUDFace.prototype.drawFace = function (faceIndex, width, height) {
width = width || Window_Base._faceWidth;
height = height || Window_Base._faceHeight;
var pw = Window_Base._faceWidth;
var ph = Window_Base._faceHeight;
var sx = faceIndex % 4 * pw + (pw - pw) / 2;
var sy = Math.floor(faceIndex / 4) * ph + (ph - ph) / 2;
this.bitmap.blt(this._oBitmap, sx, sy, pw, ph, 0, 0, width, height);
};
Sprite_HUDFace.prototype.refreshProperties = function () {
Sprite_HUDObject.prototype.refreshProperties.apply(this, arguments);
const bit = this.bitmap;
const width = parseInt(this["Width"]);
const height = parseInt(this["Height"]);
this.resizeBitmap(bit, width, height);
this.z = parseInt(this["Layer"]);
this._value = this.getActorId();
this._actor = $gameActors.actor(this._value);
this._curFace = this._actor.faceName();
this._oBitmap = ImageManager.loadFace(this._actor.faceName());
this.refreshMask(width, height);
};
Sprite_HUDFace.prototype.refreshMask = function (width, height) {
if (this._maskSprite) this.removeChild(this._maskSprite);
this.createMask();
this.refreshMaskBitmap(width, height);
this.redrawMask();
};
Sprite_HUDFace.prototype.createMask = function () {
this._maskSprite = new Sprite(new Bitmap(1, 1));
this._maskSprite.anchor.set(0.5);
this.mask = this._maskSprite;
this.addChild(this._maskSprite);
};
Sprite_HUDFace.prototype.refreshMaskBitmap = function (width, height) {
const spr = this._maskSprite;
spr.bitmap.resize(width, height);
spr._frame.width = 0;
spr._frame.height = 0;
if (_.isV150) {
spr._refreshFrame = true;
spr._onBitmapLoad(spr.bitmap);
} else {
spr._onBitmapLoad();
}
};
Sprite_HUDFace.prototype.redrawMask = function () {
const bit = this._maskSprite.bitmap;
bit.clear();
if (this["Mask"] === "0") {
bit.fillRect(0, 0, bit.width, bit.height, "#ffffff");
} else {
bit.fillRect(0, 0, bit.width, bit.height, "#000000");
const w2 = bit.width / 2, h2 = bit.height / 2;
bit.drawOval(w2, h2, w2, h2, "#ffffff");
}
};
})(SRD.HUDMaker);