slave-princess-charlotte/data/Plugin/charillust.js
2025-10-24 15:26:37 -05:00

694 lines
No EOL
20 KiB
JavaScript

/**
* スイッチ
* 10 首
* 11 ほっぺ
* 12 涙
* 13 アクセ0
* 14 アクセ1
* 15 アクセ2
* 16 アクセ3
* 17 アクセ4
* 19 下脱ぎ
*
* 変数
* 0 通常
* 1 下着
* 2
* 3 下脱ぎ
*/
BaseMessageView._setupFaceHandle = function(messageViewParam) {
var handle = null;
if (this._messageLayout.getFaceVisualType() === FaceVisualType.INVISIBLE) {
return;
}
if (messageViewParam.unit !== null) {
handle = messageViewParam.unit.getFaceResourceHandle();
if (isEro()) {
var eroUnit = getActorEro(messageViewParam.unit);
if (eroUnit) {
u = eroUnit;
handle = eroUnit.getFaceResourceHandle();
}
}
}
else if (messageViewParam.npc !== null) {
handle = messageViewParam.npc.getFaceResourceHandle();
}
//root.log(root.getCurrentScene())
if ((root.getCurrentScene() === SceneType.EVENT || root.getCurrentScene() === SceneType.FREE)) {
if (isEro()) {
if (root.getCurrentSession().getCurrentMapInfo().custom.chokyo) {
u = getActorEro(messageViewParam.unit);
}
}
}
if (u) {
handle = u.getFaceResourceHandle();
}
else if (this.isNakad(messageViewParam.unit)) {
var u = getActor1(messageViewParam.unit);
if (u) {
handle = u.getFaceResourceHandle();
}
}
this._faceHandle = handle;
};
function getCharPosX(valId) {
switch (valId) {
case 3: return -10;
case 5: return -10;
case 8: return -30;
case 9: return -20;
case 11: return -20;
case 12: return -20;
case 14: return 10;
}
return 0;
}
BaseMessageView.drawCharIllust = function(isActive, alpha) {
var pos, xCharIllust, yCharIllust;
var image = this._illustImage;
if (image === null) {
return;
}
var isReverse = false;
if (root.getCurrentSession() != null && root.getMetaSession() != null && root.getMetaSession().getGlobalSwitchTable().isSwitchOn(3)) {
if (root.getMetaSession().getGlobalSwitchTable().isSwitchOn(ERO_EVENT_SW)) {
pos = this.getIllustPos(image);
} else {
pos = this.getIllustCenterPos(image);
}
isActive = true;
alpha = 1;
} else {
pos = this.getIllustPos(image);
}
var valId = this._getValId();
if (this._messageLayout) {
xCharIllust = pos.x + this._messageLayout.getCharIllustX();
yCharIllust = pos.y + this._messageLayout.getCharIllustY();
} else {
xCharIllust = pos.x;
yCharIllust = pos.y;
}
xCharIllust += getCharPosX(valId)
var hair = this._hair;
var bodyType = this.getBodyType();
var body = this.getBody(bodyType);
var outer = this.getOuter(bodyType);
var outerBack = this.getOuterBack(bodyType);
var outerFront = this.getOuterFront(bodyType);
var coller = this.getColler(bodyType);
var face = this._face;
var hoppe = this.getHoppe();
var namida = this.getNamida();
var acce0 = this.getAcce(0);
var acce1 = this.getAcce(1);
var acce2 = this.getAcce(2);
var acce3 = this.getAcce(3);
var acce4 = this.getAcce(4);
var acce5 = this.getAcce(5);
var acce6 = this.getAcce(6);
var acce7 = this.getAcce(7);
var acce8 = this.getAcce(8);
var acce9 = this.getAcce(9);
var acce10 = this.getAcce(10);
var acce11 = this.getAcce(11);
var acce12 = this.getAcce(12);
var acce13 = this.getAcce(13);
var acce14 = this.getAcce(14);
var acce15 = this.getAcce(15);
if ((this._getValId() != 1) && xCharIllust < 200) {
xCharIllust -= 80;
}
image.setReverse(isReverse)
if (hair) hair.setReverse(isReverse);
if (body) body.setReverse(isReverse);
if (face) face.setReverse(isReverse);
if (outer) outer.setReverse(isReverse);
if (outerBack) outerBack.setReverse(isReverse);
if (outerFront) outerFront.setReverse(isReverse);
if (coller) coller.setReverse(isReverse);
if (acce0) acce0.setReverse(isReverse);
if (acce1) acce1.setReverse(isReverse);
if (acce2) acce2.setReverse(isReverse);
if (acce3) acce3.setReverse(isReverse);
if (acce4) acce4.setReverse(isReverse);
if (hoppe) hoppe.setReverse(isReverse);
if (namida) namida.setReverse(isReverse);
this._updateDark(isActive, alpha);
this._drawImage(hair, xCharIllust, yCharIllust);
if (this._isAlpha) {
this._drawAlpha(outerBack, xCharIllust, yCharIllust);
} else {
this._drawImage(outerBack, xCharIllust, yCharIllust);
}
this._drawImage(body, xCharIllust, yCharIllust);
this._drawImage(acce0, xCharIllust, yCharIllust);
this._drawImage(acce15, xCharIllust, yCharIllust);
this._drawImage(acce1, xCharIllust, yCharIllust);
this._drawImage(acce2, xCharIllust, yCharIllust);
this._drawImage(acce6, xCharIllust, yCharIllust);
this._drawImage(acce7, xCharIllust, yCharIllust);
this._drawImage(acce8, xCharIllust, yCharIllust);
this._drawImage(acce9, xCharIllust, yCharIllust);
this._drawImage(acce10, xCharIllust, yCharIllust);
this._drawImage(acce11, xCharIllust, yCharIllust);
this._drawImage(acce12, xCharIllust, yCharIllust);
this._drawImage(acce13, xCharIllust, yCharIllust);
this._drawImage(acce4, xCharIllust, yCharIllust);
this._drawImage(acce3, xCharIllust, yCharIllust);
this._drawImage(acce14, xCharIllust, yCharIllust);
this._drawImage(coller, xCharIllust, yCharIllust);
if (this._isAlpha) {
this._drawAlpha(outer, xCharIllust, yCharIllust);
} else {
this._drawImage(outer, xCharIllust, yCharIllust);
}
//if (bodyType == 1 || isEro()) {
//}
this._drawImage(face, xCharIllust, yCharIllust);
this._drawImage(hoppe, xCharIllust, yCharIllust);
this._drawImage(acce5, xCharIllust, yCharIllust);
this._drawImage(image, xCharIllust, yCharIllust);
this._drawImage(namida, xCharIllust, yCharIllust);
this._drawAlpha(outerFront, xCharIllust, yCharIllust);
/* this._drawImage(acce3, xCharIllust, yCharIllust);
this._drawImage(acce4, xCharIllust, yCharIllust);
this._drawImage(acce5, xCharIllust, yCharIllust);
this._drawImage(acce6, xCharIllust, yCharIllust);*/
return this._alpha;
};
BaseMessageView._updateDark = function(isActive, alpha) {
if (isEro()) {
return;
}
if (this._alpha === undefined) {
this._alpha = alpha;
}
this._alpha = this._alpha || 0;
if (isActive) {
if (this._alpha > 0) {
this._alpha -= 15;
if (this._alpha < 0) {
this._alpha = 0;
}
}
} else {
if (this._alpha < 120) {
if (this._alpha <= -1) {
this._alpha += 1;
} else {
this._alpha += 15;
}
if (this._alpha > 120) {
this._alpha = 120;
}
}
}
};
BaseMessageView._drawImage = function(img, x, y) {
if (! img) {
return;
}
if (isEro()) {
x -= 220;
y -= 220;
}
if (this._alpha > 0) {
img.setColor(0x100000, this._alpha);
} else {
img.setColor(0x000000, 0);
}
img.draw(x, y);
};
var _imageAlpha = 3;
BaseMessageView._drawAlpha = function(img, x, y) {
if (! img) {
return;
}
if (isEro()) {
x -= 220;
y -= 220;
}
if (this._alpha > 0) {
img.setColor(0x100000, this._alpha);
} else {
img.setColor(0x000000, 0);
}
if (root.getCurrentSession() != null) {
var valId = this._getValId();
if (valId !== 6 && valId !== 4) {
var n = _imageAlpha;
var alpha = 255;
switch (n) {
case 0: alpha = 40; break;
case 1: alpha = 80; break;
case 2: alpha = 150; break;
case 3: alpha = 255; break;
}
if (valId == 7 && !root.getMetaSession().getGlobalSwitchTable().isSwitchOn(138)) {
alpha = 255;
}
img.setAlpha(alpha);
}
}
img.draw(x, y);
};
BaseMessageView._setupIllustImage = function(messageViewParam) {
var image = null;
var facialExpressionId = this._illustId;
if (this._messageLayout && this._messageLayout.getCharIllustVisualType() === CharIllustVisualType.NONE) {
return;
}
this._acce0 = null;
this._acce1 = null;
this._acce2 = null;
this._acce3 = null;
this._acce4 = null;
this._acce5 = null;
this._acce6 = null;
this._acce7 = null;
this._acce8 = null;
this._acce9 = null;
this._acce10 = null;
this._acce11 = null;
this._acce12 = null;
this._acce13 = null;
this._acce14 = null;
this._acce15 = null;
this._acce16 = null;
this._acce17 = null;
this._acce18 = null;
this._namida = null;
this._hoppe = null;
this._body0 = null;
this._body1 = null;
this._bodyBote0 = null;
this._bodyBote1 = null;
this._coller0 = null;
this._eroBody = null;
this._outerBack = null;
this._outerFront = null;
if (messageViewParam.unit !== null) {
var unit = messageViewParam.unit;
var unit3;
if (isEro()) {
var unit2 = getActorEro2(unit);
var eroUnit = getActorEro(unit);
if (eroUnit) {
unit = eroUnit;
}
unit3 = getActorEro3(unit);
} else {
unit2 = getActor2(unit);
unit3 = getActor1(unit);
}
this._isAlpha = true;
if (unit.getName() == 'Giacomo' || unit.getName() == 'ジャコモ' || unit.getName() == 'Giac' ||
unit.getName() == 'Karla' || unit.getName() == 'カーラ' || unit.getName() == 'Karl') {
this._isAlpha = false;
}
this._unit = unit;
this._unit2 = unit2;
this._unit3 = unit3;
//var t = new Date().getTime();
image = unit.getCharIllustImage(facialExpressionId);
this._face = unit.getCharIllustImage(18);
this._hair = unit.getCharIllustImage(19);
this._coller0 = unit.getCharIllustImage(16);
//root.log(new Date().getTime() - t)
}
else if (messageViewParam.npc !== null) {
this._unit = null;
this._unit2 = null;
image = messageViewParam.npc.getCharIllustImage(facialExpressionId);
}
this._illustImage = image;
};
BaseMessageView.getBody = function(bodyType) {
var bote = this.isBote();
if (bote) {
this._bodyBote1 = this._bodyBote1 || this._unit.getCharIllustImage(15);
return this._bodyBote1;
} else {
if (bodyType === 0) {
this._body1 = this._body1 || this._unit.getCharIllustImage(13);
return this._body1;
} else {
this._eroBody = this._eroBody || this._unit.getCharIllustImage(21);
return this._eroBody;
}
}
};
BaseMessageView.getOuter = function(bodyType) {
var bote = this.isBote();
switch (bodyType) {
case 0:
if (bote) {
this._bodyBote0 = this._bodyBote0 || this._unit.getCharIllustImage(14);
return this._bodyBote0;
} else {
this._body0 = this._body0 || this._unit.getCharIllustImage(12)
return this._body0;
}
case 1:
if (bote) {
return null;
} else {
return null;
}
}
return null;
};
BaseMessageView.getOuterBack = function(bodyType) {
switch (bodyType) {
case 0:
this._outerBack = this._outerBack || this._unit.getCharIllustImage(20);
return this._outerBack;
case 1:
return null;
}
return null;
};
BaseMessageView.getOuterFront = function(bodyType) {
switch (bodyType) {
case 0:
this._outerFront = this._outerFront || this._unit.getCharIllustImage(17);
return this._outerFront;
case 1:
return null;
}
return null;
};
BaseMessageView.getBodyType = function() {
if (this.isNakad()) {
return 1;
}
if (root.getCurrentSession() == null) {
return 0;
}
var v = this._getBodyType();
if (v == null) {
return 0;
}
return v;
};
BaseMessageView.isBote = function() {
if (root.getCurrentSession() == null) {
return _bote;
}
var valId = this._getValId() * 10 + 3;
var bote = root.getMetaSession().getGlobalSwitchTable().isSwitchOn(valId);
return bote;
};
BaseMessageView._getValId = function() {
if (root.getCurrentSession() == null) {
return -2;
}
if (this._messageLayout && this._messageLayout.getCharIllustVisualType() === CharIllustVisualType.NONE) {
return -1;
}
return getNameByVal(this._name);
};
function getNameByVal(name) {
if (name.indexOf('_') > 1) {
name = name.substr(0, name.indexOf('_'));
}
// Handle numbered variants (e.g., "Char1" -> "Char", "Lena2" -> "Lena")
if (name.length > 1 && name.match(/[0-9]$/)) {
name = name.substr(0, name.length - 1);
}
switch (name) {
case 'シャルロット': return 1;
case 'Charlotte': return 1;
case 'シャルロ': return 1;
case 'Char': return 1;
case 'コルネ': return 2;
case 'Corne': return 2;
case 'Corn': return 2;
case 'レナ': return 3;
case 'Lena': return 3;
case 'ルリエル': return 4;
case 'Luriel': return 4;
case 'Luri': return 4;
case 'カエデ': return 5;
case 'Kaede': return 5;
case 'Kaed': return 5;
case 'カーラ': return 6;
case 'Karla': return 6;
case 'Karl': return 6;
case 'アンジェラ': return 7;
case 'Angela': return 7;
case 'クリス': return 7;
case 'Chris': return 7;
case 'Chri': return 7;
case 'シェリー': return 8;
case 'Sherry': return 8;
case 'Sher': return 8;
case 'メル': return 9;
case 'Mel': return 9;
case 'ティナ': return 10;
case 'Tina': return 10;
case 'ルゥ': return 11;
case 'Lou': return 11;
case 'サリア': return 12;
case 'Saria': return 12;
case 'Sari': return 12;
case 'ジャコモ': return 13;
case 'Giacomo': return 13;
case 'Giac': return 13;
case 'タバサ': return 14;
case 'Tabatha': return 14;
case 'Taba': return 14;
case 'ダレス': return 15;
case 'Dalles': return 15;
case 'Dall': return 15;
default: return -1;
}
}
BaseMessageView._getBodyType = function() {
var valId = this._getValId();
if (valId < 0) {
return null;
}
if (root.getCurrentSession() == null) {
return null;
}
return root.getMetaSession().getVariableTable(0).getVariable(valId);
};
BaseMessageView.getColler = function(bodyType) {
var valId = this._getValId() * 10 + 0;
if (valId < 0) {
return null;
}
if (root.getCurrentSession() == null) {
return null;
}
if (! root.getMetaSession().getGlobalSwitchTable().isSwitchOn(valId)) {
return null;
}
return this._coller0;
};
BaseMessageView.getHoppe = function() {
if (root.getCurrentSession() == null) {
if (_hoppe) {
this._hoppe = this._hoppe || this._unit.getCharIllustImage(22);
return this._hoppe;
}
return null;
}
var valId = this._getValId();
if (valId < 0) {
return null;
}
valId = valId * 10 + 1;
if (! root.getMetaSession().getGlobalSwitchTable().isSwitchOn(valId)) {
return null;
}
this._hoppe = this._hoppe || this._unit.getCharIllustImage(22);
return this._hoppe;
};
BaseMessageView.getNamida = function() {
var valId = this._getValId();
if (valId < 0) {
return null;
}
if (root.getCurrentSession() == null) {
return null;
}
valId = valId * 10 + 2;
if (! root.getMetaSession().getGlobalSwitchTable().isSwitchOn(valId)) {
return null;
}
this._namida = this._namida || this._unit.getCharIllustImage(23);
return this._namida;
};
BaseMessageView.getAcce = function(index) {
if (! this._unit2) {
return null;
}
var valId = this._getValId();
if (valId < 0) {
return null;
}
var actorId = valId;
if (index < 18) {
if (root.getCurrentSession() == null) {
return null;
}
if (valId == 14) {
valId = 4;
}
if (valId == 12) {
valId = 6;
}
valId = valId * 20 + 200 + index;
if (! root.getMetaSession().getGlobalSwitchTable().isSwitchOn(valId)) {
return null;
}
} else {
if (! ERO_ACCES[index]) {
return null;
}
}
if (index == 11 || index == 12 || index == 13) {
if (this.isBote()) {
index += 5;
}
}
if (actorId == 8) {
if (this.isBote() && index == 3) {
// シェリーの腕輪
return null;
}
if (! this.isBote()) {
if (index == 7) {
return null;
}
if (index == 10) {
return null;
}
}
}
if (! this['_acce' + index]) {
if (actorId == 10 && index == 3 && isEro()) {
this['_acce' + index] = this._unit3.getCharIllustImage(0);
} else if (actorId == 9 && index == 3 && this.isBote()) {
this['_acce' + index] = this._unit3.getCharIllustImage(0);
} else {
this['_acce' + index] = this._unit2.getCharIllustImage(index)
}
}
return this['_acce' + index];
};
var ERO_ACCES = {};
function putAcce(index) {
ERO_ACCES[index] = true;
}
function clearAcce() {
ERO_ACCES = {};
}
BaseMessageView.isNakad = function() {
var valId = this._getValId();
var swId = valId * 10 + 5;
if (this._name == 'Luriel' || this._name == 'ルリエル' || this._name == 'Luri') {
return false;
}
if (root.getCurrentSession() == null) {
return _naked;
}
if (_naked) {
return true;
}
if (root.getMetaSession().getGlobalSwitchTable().isSwitchOn(swId)) {
return true;
}
if (root.getMetaSession().getGlobalSwitchTable().isSwitchOn(153)) {
if (this._name == 'Giacomo' || this._name == 'ジャコモ' || this._name == 'Giac') {
return false;
}
if (this._name == 'Karla' || this._name == 'カーラ' || this._name == 'Karl') {
return false;
}
return true;
}
if (isEro()) {
if (isClothing()) {
return false;
}
return true;
}
return false;
};
var ERO_EVENT_SW = 200;
function isEro() {
if (_tachieEro) {
return true;
}
return root.getCurrentSession() != null && root.getMetaSession().getGlobalSwitchTable().isSwitchOn(ERO_EVENT_SW)
}
var _clothing = false;
function setClothing(b) {
_clothing = b;
}
function isClothing() {
return _clothing;
}
var _tachieEro = false;
function tachieEro(b) {
_tachieEro = b;
}
var _naked = false;
function setNaked(b) {
_naked = b;
}
var _hoppe = false;
function setHoppe(b) {
_hoppe = b;
}
var _bote = false;
function setBote(b) {
_bote = b;
}