dead-bunny/js/plugins/Nore_ManUi.js
2025-01-14 11:16:28 -06:00

439 lines
13 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError(
"Class extends value " + String(b) + " is not a constructor or null"
);
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype =
b === null
? Object.create(b)
: ((__.prototype = b.prototype), new __());
};
})();
var ManCommand;
(function (ManCommand) {
ManCommand["soupKichen"] = "soupKichen";
ManCommand["manage"] = "manage";
})(ManCommand || (ManCommand = {}));
var Window_ManCommand = /** @class */ (function (_super) {
__extends(Window_ManCommand, _super);
function Window_ManCommand() {
var _this = this;
var r = new Rectangle(Nore.MAIN_MENU_W, Nore.TOP_Y, 220, 146);
_this = _super.call(this, r) || this;
_this.makeCommandList();
_this.refresh();
_this.hide();
return _this;
}
Window_ManCommand.prototype.itemHeight = function () {
return 60;
};
Window_ManCommand.prototype.makeCommandList = function () {
var enable =
!$slg.manInfo().soupKichen().isEmpty() &&
$slg.manInfo().soupKichen().isEnabled();
this.addCommand(TextManager.manageMan, ManCommand.manage, true);
this.addCommand(TextManager.soupKichen, ManCommand.soupKichen, enable);
};
Window_ManCommand.prototype.resetFontSettings = function () {
this.contents.fontFace = $gameSystem.mainFontFace();
this.contents.fontSize = 22;
this.resetTextColor();
};
return Window_ManCommand;
})(Window_Command);
var Window_ManList = /** @class */ (function (_super) {
__extends(Window_ManList, _super);
function Window_ManList() {
var _this = this;
var r = new Rectangle(
Nore.MAIN_MENU_W + 222,
Nore.TOP_Y,
260,
800 - Nore.TOP_Y
);
_this = _super.call(this, r) || this;
_this.makeData();
_this.refresh();
_this.hide();
return _this;
}
Window_ManList.prototype.setManInfoWindow = function (infoWindow) {
this._infoWindow = infoWindow;
this.select(0);
};
Window_ManList.prototype.setManParamWindow = function (manParamWindow) {
this._manParamWindow = manParamWindow;
};
Window_ManList.prototype.makeData = function () {
this._manList = $slg.manInfo().manList();
};
Window_ManList.prototype.maxItems = function () {
if (!this._manList || this._manList.length == 0) {
return 1;
}
return this._manList.length;
};
Window_ManList.prototype.drawItem = function (index) {
this.contents.fontSize = 20;
var man = this._manList[index];
var rect = this.itemRect(index);
this.resetTextColor();
this.drawIcon(man.iconIndex(), rect.x + 2, rect.y + 2);
this.drawText(man.name(), rect.x + 40, rect.y, rect.width);
};
Window_ManList.prototype.selectedMan = function () {
if (!this._manList) {
return null;
}
return this._manList[this.index()];
};
Window_ManList.prototype.select = function (index) {
var lastIndex = this.index();
_super.prototype.select.call(this, index);
if (lastIndex == index) {
return;
}
var actor = this.selectedMan();
if (this._infoWindow && actor) {
this._infoWindow.setMan(actor);
}
if (this._manParamWindow && actor) {
this._manParamWindow.setMan(actor);
}
};
Window_ManList.prototype.show = function () {
_super.prototype.show.call(this);
var actor = this.selectedMan();
if (this._infoWindow && actor) {
this._infoWindow.setMan(actor);
}
if (this._manParamWindow && actor) {
this._manParamWindow.setMan(actor);
}
};
return Window_ManList;
})(Window_Selectable);
var ManSyusan = /** @class */ (function () {
function ManSyusan(manId, actorId) {
this._manId = manId;
this._actorId = actorId;
this.calcManSysan();
this.countNakadashi();
this.calcFriendship();
}
ManSyusan.prototype.calcManSysan = function () {
this._babyList = [];
var actor = $gameActors.actor(this._actorId);
for (var _i = 0, _a = actor.babyList(); _i < _a.length; _i++) {
var baby = _a[_i];
if (baby.taneoyaId() == this._manId) {
this._babyList.push(baby);
}
}
};
ManSyusan.prototype.calcFriendship = function () {
var actor = $gameActors.actor(this._actorId);
this._friendshipLevel = actor.friendshipLevel(this._manId);
};
ManSyusan.prototype.babyList = function () {
return this._babyList;
};
ManSyusan.prototype.actorName = function () {
var actor = $gameActors.actor(this._actorId);
return actor.name();
};
ManSyusan.prototype.actorIconIndex = function () {
var actor = $gameActors.actor(this._actorId);
return actor.iconIndex();
};
ManSyusan.prototype.countNakadashi = function () {
this._nakadashi = 0;
var actor = $gameActors.actor(this._actorId);
var history = actor.dousei().history(this._manId);
if (history) {
this._nakadashi += history.count(DouseiPlayId.sex);
}
var avList = $slg.avInfo().actorAvList(this._actorId);
for (var _i = 0, avList_1 = avList; _i < avList_1.length; _i++) {
var av = avList_1[_i];
if (av.mainManId() == this._manId) {
this._nakadashi += av.nakadashi();
}
}
};
ManSyusan.prototype.nakadashi = function () {
return this._nakadashi;
};
ManSyusan.prototype.friendshipLevel = function () {
return this._friendshipLevel;
};
return ManSyusan;
})();
var Window_ManInfo = /** @class */ (function (_super) {
__extends(Window_ManInfo, _super);
function Window_ManInfo() {
var r = new Rectangle(Nore.MAIN_MENU_W + 486, Nore.TOP_Y + 372, 460, 384);
return _super.call(this, r) || this;
}
Window_ManInfo.prototype.setMan = function (actor) {
this._actor = actor;
this.refresh();
};
Window_ManInfo.prototype.refresh = function () {
this.contents.clear();
this.drawName(20, 6);
this.drawJob(230, 6);
this.drawLabel(20, 6);
this.drawSyusanList(20, 70);
};
Window_ManInfo.prototype.drawName = function (x, y) {
this.contents.fontSize = 26;
this.drawIcon(this._actor.iconIndex(), x, y);
this.drawText(this._actor.name(), x + 40, y, 130);
};
Window_ManInfo.prototype.drawJob = function (x, y) {
this.contents.fontSize = 20;
this.drawText(this._actor.job(), x, y, 185);
};
Window_ManInfo.prototype.valueInterval = function () {
return 95;
};
Window_ManInfo.prototype.drawLabel = function (x, y) {
this.contents.fontSize = 20;
//this.drawText(TextManager.manExperience, x, y, 200);
this.contents.fontSize = 18;
var ww = 85;
this.drawText(TextManager.douseiFriendship, x + 110, y + 36, ww, "right");
this.drawText(
getEroParamTitle(EroType.nakadashi).label(),
x + this.valueInterval() * 2 + 20,
y + 36,
ww,
"right"
);
var xx = x + this.valueInterval() * 3 + 20;
if (ConfigManager.language == "en") {
xx += 10;
}
this.drawText(
getEroParamTitle(EroType.syusan).label(),
xx,
y + 36,
ww,
"right"
);
};
Window_ManInfo.prototype.drawSyusanList = function (x, y) {
this.contents.fontSize = 20;
var yy = y;
var list = this.calcManSysanList();
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var syusan = list_1[_i];
this.drawSyusan(x, yy, syusan);
yy += 40;
}
};
Window_ManInfo.prototype.drawSyusan = function (x, y, syusan) {
this.drawIcon(syusan.actorIconIndex(), x, y);
this.drawText(syusan.actorName(), x + 40, y, 200);
var icon = this.friendshipIcon(syusan.friendshipLevel());
this.drawIcon(icon, x + 154, y + 5);
var xx = 74 + x;
//this.drawText(syusan.friendshipLevel(), x + 50, y, 120, 'right');
this.drawText(
this.numberText(syusan.nakadashi()),
xx + this.valueInterval(),
y,
120,
"right"
);
this.drawText(
this.numberText(syusan.babyList().length),
xx + this.valueInterval() * 2,
y,
120,
"right"
);
};
Window_ManInfo.prototype.numberText = function (n) {
if (n == 0) {
return "-";
}
return n;
};
Window_ManInfo.prototype.calcManSysanList = function () {
var result = [];
for (var _i = 0, _a = $gameParty.getActorIdList(); _i < _a.length; _i++) {
var actorId = _a[_i];
result.push(new ManSyusan(this._actor.actorId(), actorId));
}
return result;
};
return Window_ManInfo;
})(Window_Base);
var Window_SoupKichenList = /** @class */ (function (_super) {
__extends(Window_SoupKichenList, _super);
function Window_SoupKichenList() {
var _this = this;
var r = new Rectangle(Nore.MAIN_MENU_W + 222, Nore.TOP_Y, 260, 490);
_this = _super.call(this, r) || this;
_this.makeData();
_this.refresh();
_this.hide();
return _this;
}
Window_SoupKichenList.prototype.setManParamWindow = function (
manParamWindow
) {
this._manParamWindow = manParamWindow;
};
Window_SoupKichenList.prototype.makeData = function () {
this._manList = $slg.manInfo().soupKichen().manList();
};
Window_SoupKichenList.prototype.maxItems = function () {
if (!this._manList || this._manList.length == 0) {
return 1;
}
return this._manList.length;
};
Window_SoupKichenList.prototype.refresh = function () {
_super.prototype.refresh.call(this);
if (this.index() >= this._manList.length) {
this.select(this._manList.length - 1);
}
};
Window_SoupKichenList.prototype.itemHeight = function () {
return 60;
};
Window_SoupKichenList.prototype.resetFontSettings = function () {
this.contents.fontFace = $gameSystem.mainFontFace();
this.contents.fontSize = 22;
this.resetTextColor();
};
Window_SoupKichenList.prototype.drawItem = function (index) {
var man = this._manList[index];
var rect = this.itemRect(index);
this.resetTextColor();
if (man) {
this.drawIcon(man.iconIndex(), rect.x + 2, rect.y + 8);
this.drawText(man.name(), rect.x + 40, rect.y - 4, rect.width);
this.contents.fontSize = 16;
this.drawText(man.job(), rect.x + 40, rect.y + 20, 90);
this.contents.fontSize = 16;
this.drawIcon(Icon.gold, rect.x + 134, rect.y + 22);
this.drawText(
man.price() + "",
rect.x - 10,
rect.y + 20,
rect.width,
"right"
);
if (man.isOsusume()) {
this.changeTextColor(ColorManager.crisisColor());
this.drawText("Recommended", rect.x - 10, rect.y - 8, rect.width, "right");
}
} else {
this.contents.fontSize = 18;
if ($slg.manInfo().soupKichen().isEnabled()) {
this.drawText(TextManager.noSoupKichenMan, rect.x, rect.y, rect.width);
} else {
this.drawText(
TextManager.noSoupKichenFacility,
rect.x,
rect.y,
rect.width
);
}
}
};
Window_SoupKichenList.prototype.selectedMan = function () {
return this._manList[this.index()];
};
Window_SoupKichenList.prototype.isCurrentItemEnabled = function () {
return this.selectedMan() != null;
};
Window_SoupKichenList.prototype.show = function () {
_super.prototype.show.call(this);
var man = this.selectedMan();
if (!man) {
return;
}
var actor = man.actor();
if (this._manParamWindow && actor) {
this._manParamWindow.setMan(actor);
}
};
return Window_SoupKichenList;
})(Window_Selectable);
var SoupKichenCommand;
(function (SoupKichenCommand) {
SoupKichenCommand["hire"] = "hire";
SoupKichenCommand["cancel"] = "cancel";
})(SoupKichenCommand || (SoupKichenCommand = {}));
var Window_SoupKichenCommand = /** @class */ (function (_super) {
__extends(Window_SoupKichenCommand, _super);
function Window_SoupKichenCommand() {
var _this = this;
var r = new Rectangle(Nore.MAIN_MENU_W + 486 - 26, Nore.TOP_Y, 260, 190);
_this = _super.call(this, r) || this;
_this.refresh();
_this.hide();
return _this;
}
Window_SoupKichenCommand.prototype.itemHeight = function () {
return 60;
};
Window_SoupKichenCommand.prototype.makeCommandList = function () {
if (!this._man) {
return;
}
var enable = this._man.price() <= $gameParty.gold();
this.addCommand(
TextManager.hireMan.format(this._man.price()),
SoupKichenCommand.hire,
enable
);
this.addCommand(TextManager.cancel, SoupKichenCommand.cancel, true);
};
Window_SoupKichenCommand.prototype.resetFontSettings = function () {
this.contents.fontFace = $gameSystem.mainFontFace();
this.contents.fontSize = 22;
this.resetTextColor();
};
Window_SoupKichenCommand.prototype.setMan = function (man) {
this._man = man;
this.refresh();
};
Window_SoupKichenCommand.prototype.playOkSound = function () {
if (this.index() == 1) {
SoundManager.playCancel();
}
};
Window_SoupKichenCommand.prototype.hire = function () {
SoundManager.playShop();
$gameParty.loseGold(this._man.price());
$slg.manInfo().hire(this._man);
};
return Window_SoupKichenCommand;
})(Window_Command);