dead-bunny/js/plugins/Nore_Recollection.js
2025-01-12 01:21:39 -06:00

570 lines
17 KiB
JavaScript
Raw 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 __());
};
})();
/*:ja
* @target MZ
* @author ル
*
* @command reco
* @text 回想登録
* @des 回想登録
* @arg id
* @type number
* @text id
* @desc id
*
* @command openRecollection
* @text 回想全解放
*
* @command closeRecollection
* @text 回想全解放を元に戻す
*/
var Nore;
(function (Nore) {
var pluginName = "Nore_Recollection";
PluginManager.registerCommand(pluginName, "reco", function (args) {
var switch_id = parseInt(args.id);
p("回想登録:" + switch_id);
var info = DataManager._globalInfo;
if (!info) {
p("失敗");
return;
}
info[99] = info[99] || {};
if (info[99][switch_id]) {
return;
}
info[99][switch_id] = true;
});
PluginManager.registerCommand(
pluginName,
"openRecollection",
function (args) {
ConfigManager.openRecollection = true;
ConfigManager.save();
}
);
PluginManager.registerCommand(
pluginName,
"closeRecollection",
function (args) {
ConfigManager.openRecollection = false;
ConfigManager.save();
}
);
})(Nore || (Nore = {}));
var noreRecoActorId = -2;
var OTHER = 98;
var EVENT_OFF = 99;
var EVENT_ON = 100;
var Scene_Recollection2 = /** @class */ (function (_super) {
__extends(Scene_Recollection2, _super);
function Scene_Recollection2() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Scene_Recollection2.prototype.createCommandWindow = function () {
this._rec_list = new Window_RecList2(
-4,
58,
Graphics.width,
Graphics.height - 62
);
// リロードの場合回想リストを表示にする。通常はここがfalse
if (Scene_Recollection.reload_rec_list) {
//this._rec_window.deactivate();
//this._rec_window.visible = false;
this._rec_list.visible = true;
this._rec_list.activate();
} else {
//this._rec_window.activate();
//this._rec_window.visible = true;
this._rec_list.visible = false;
this._rec_list.deactivate();
}
this._rec_list.setHandler("ok", this.commandDoRecMode.bind(this));
this._rec_list.setHandler("cancel", this.onCancelList.bind(this));
this._mode = "recollection";
this._rec_list.select(Scene_Recollection.rec_list_index);
this.addWindow(this._rec_list);
// CG参照用ダミーコマンド
this._dummy_window = new Window_Command(new Rectangle(0, 0, 0, 0));
this._dummy_window.isCurrentItemEnabled = function () {
return true;
};
this._dummy_window.deactivate();
this._dummy_window.visible = false;
this._dummy_window.setHandler("ok", this.commandDummyOk.bind(this));
this._dummy_window.setHandler("cancel", this.commandDummyCancel.bind(this));
this._dummy_window.addCommand("next", "ok");
this.addWindow(this._dummy_window);
Scene_Recollection.reload_rec_list = false;
this._dummy_window.isTouchedInsideFrame = function () {
return true;
};
this._dummy_window.onTouch = function (triggered) {
if (triggered) {
this.processOk();
}
};
this.commandShowRecollection();
this._recoActorWindow = new Window_RecoActor();
this._recoActorWindow.refresh();
this.addWindow(this._recoActorWindow);
this._rec_list.deactivate();
this._recoActorWindow.activate();
this._recoActorWindow.setHandler("change", this.onChange.bind(this));
this._recoActorWindow.setHandler(
"cancel",
this.commandBackSelectMode.bind(this)
);
this._recoActorWindow.setHandler("ok", this.onOk.bind(this));
this.selectInitialActor();
};
Scene_Recollection2.prototype.selectInitialActor = function () {
if (noreRecoActorId > 0) {
this._recoActorWindow.selectActor(noreRecoActorId);
this._recoActorWindow.deactivate();
this.onOk();
}
};
Scene_Recollection2.prototype.onChange = function () {
var actorId = this._recoActorWindow.selectedActorId();
if (actorId >= EVENT_OFF) {
return;
}
this._rec_list.setActorId(actorId);
noreRecoActorId = actorId;
};
Scene_Recollection2.prototype.onOk = function () {
var actorId = this._recoActorWindow.selectedActorId();
if (actorId == EVENT_OFF) {
$gameTemp.recoEventOn = false;
this._rec_list.refresh();
this._recoActorWindow.refresh();
this._recoActorWindow.activate();
return;
}
if (actorId == EVENT_ON) {
$gameTemp.recoEventOn = true;
this._rec_list.refresh();
this._recoActorWindow.refresh();
this._recoActorWindow.activate();
return;
}
this._rec_list.activate();
};
Scene_Recollection2.prototype.onCancelList = function () {
this._recoActorWindow.activate();
};
Scene_Recollection2.prototype.commandDoRecMode = function () {
var info = this._rec_list.selectedInfo();
Scene_Recollection.rec_list_index = this._rec_list.index();
$gameTemp.ignoreFiles = {};
$gameTemp.eroBack = null;
if (this._rec_list.isVisible(info)) {
// 回想モードの場合
Scene_Recollection._rngd_recollection_doing = true;
DataManager.setupNewGame();
$gamePlayer.setTransparent(255);
this.fadeOutAll();
//$dataSystem.optTransparent = false;
var commonEventId = info.common_event_id;
p("回想実行:" + commonEventId);
$gameTemp.reserveCommonEvent(commonEventId);
$gamePlayer.reserveTransfer(
rngd_recollection_mode_settings.sandbox_map_id,
0,
0,
0
);
$gameSwitches.setValue(999, true);
sessionStorage.setItem("noreCommonEventId", commonEventId);
sessionStorage.setItem(
"norePlayerMap",
rngd_recollection_mode_settings.sandbox_map_id
);
SceneManager.push(Scene_Map2);
} else {
SoundManager.playBuzzer();
this._rec_list.activate();
}
this._rec_list.refresh();
};
return Scene_Recollection2;
})(Scene_Recollection);
Window_RecList.prototype.itemHeight = function () {
return 228;
};
var Window_RecoActor = /** @class */ (function (_super) {
__extends(Window_RecoActor, _super);
function Window_RecoActor() {
var _this = this;
var r = new Rectangle(-4, -4, 1084, 68);
_this = _super.call(this, r) || this;
_this.select(0);
return _this;
}
Window_RecoActor.prototype.maxItems = function () {
return this.actorIdList().length;
};
Window_RecoActor.prototype.maxCols = function () {
return this.maxItems();
};
Window_RecoActor.prototype.drawItem = function (index) {
this.contents.fontSize = 22;
var rect = this.itemRect(index);
var yOffset = 7;
var actorId = this.actorIdList()[index];
if (actorId < 0) {
this.drawText("ALL", rect.x, rect.y + yOffset, rect.width, "center");
} else if (actorId == OTHER) {
this.drawText("OTHER", rect.x, rect.y + yOffset, rect.width, "center");
} else if (actorId == EVENT_OFF) {
if (!this.isEventOn()) {
this.contents.fillRect(
rect.x + 1,
rect.y + 1,
rect.width - 2,
rect.height - 2,
"#BB3333"
);
}
this.drawText(
"EVENT OFF",
rect.x,
rect.y + yOffset,
rect.width,
"center"
);
} else if (actorId == EVENT_ON) {
if (this.isEventOn()) {
this.contents.fillRect(
rect.x + 1,
rect.y + 1,
rect.width - 2,
rect.height - 2,
"#BB3333"
);
}
this.drawText("EVENT ON", rect.x, rect.y + yOffset, rect.width, "center");
} else {
var actor = $gameActors.actor(actorId);
var iconIndex = actor.iconIndex();
this.drawIcon(iconIndex, rect.x, rect.y + 2);
this.drawText(
actor.name(),
rect.x + 32,
rect.y + yOffset,
rect.width,
"left"
);
}
};
Window_RecoActor.prototype.actorIdList = function () {
return [-1, 8, 9, 4, 13, 17, 10, 11, OTHER]; //, EVENT_OFF, EVENT_ON];
};
Window_RecoActor.prototype.selectedActorId = function () {
return this.actorIdList()[this.index()];
};
Window_RecoActor.prototype.selectActor = function (actorId) {
var index = this.actorIdList().indexOf(actorId);
this.select(index);
};
Window_RecoActor.prototype.isEventOn = function () {
return $gameTemp.recoEventOn;
};
return Window_RecoActor;
})(Window_Selectable);
var RecoInfo = /** @class */ (function () {
function RecoInfo() {}
return RecoInfo;
})();
var Window_RecList2 = /** @class */ (function (_super) {
__extends(Window_RecList2, _super);
function Window_RecList2(x, y, width, height) {
var _this = _super.call(this, new Rectangle(x, y, width, height)) || this;
_this.windowWidth = width;
_this.windowHeight = height;
_this.select(0);
_this.get_global_variables();
var infos = rngd_recollection_mode_settings.rec_cg_set;
for (var i = 0; i < infos.length; i++) {
var info = infos[i];
if (_this.isVisible(info)) {
var bmpName = info.thumbnail;
var bmp = ImageManager.loadEro(bmpName);
}
}
ImageManager.loadEro("never_watch_picture");
_this._actorId = -1;
_this.refresh();
return _this;
}
Window_RecList2.prototype.isVisible = function (info) {
if (this.isShowAll()) {
return true;
}
if (this._global_variables["switches"][info.switch_id]) {
return true;
}
if (Nore.isOmakeRecollection(info.switch_id)) {
return true;
}
return false;
};
Window_RecList2.prototype.standardPadding = function () {
return 4;
};
Window_RecList2.prototype.makeData = function () {
this._data = [];
for (
var _i = 0, _a = rngd_recollection_mode_settings.rec_cg_set;
_i < _a.length;
_i++
) {
var info = _a[_i];
if (this.isInclude(info)) {
this._data.push(info);
}
}
};
Window_RecList2.prototype.isInclude = function (data) {
if (this._actorId < 0) {
return true;
} else if (!$gameTemp.recoEventOn) {
if (data.event) {
return false;
}
}
if (this._actorId == data.actorId) {
return true;
}
return false;
};
Window_RecList2.prototype.refresh = function () {
this._windowContentsSprite.removeChildren();
this.makeData();
_super.prototype.refresh.call(this);
};
Window_RecList2.prototype.maxItems = function () {
return this._data.length;
};
Window_RecList2.prototype.itemHeight = function () {
return 238;
};
Window_RecList2.prototype.maxCols = function () {
return 4;
};
Window_RecList2.prototype.setActorId = function (actorId) {
this._actorId = actorId;
this.refresh();
if (this.index() >= this.maxItems()) {
this.select(0);
}
};
Window_RecList2.prototype.colSpacing = function () {
return 0;
};
Window_RecList2.prototype.maxPageRows = function () {
var pageHeight = this.height; // - this.padding * 2;
return Math.floor(pageHeight / this.itemHeight());
};
Window_RecList2.prototype.itemRect = function (index) {
var maxCols = this.maxCols();
var itemWidth = this.itemWidth();
var itemHeight = this.itemHeight();
var colSpacing = this.colSpacing();
var rowSpacing = this.rowSpacing();
var col = index % maxCols;
var row = Math.floor(index / maxCols);
var x = col * itemWidth + colSpacing / 2 - this.scrollBaseX();
var y = row * itemHeight + rowSpacing / 2 - this.scrollBaseY();
var width = itemWidth - colSpacing + 2;
var height = itemHeight - rowSpacing;
return new Rectangle(x, y, width, height);
};
Window_RecList2.prototype.drawItem = function (index) {
var rec_cg = this._data[index];
//rngd_recollection_mode_settings.rec_cg_set[index];
var rect = this.itemRect(index);
var text_height = 0;
if (rngd_recollection_mode_settings.rec_list_window.show_title_text) {
this.contents.fontSize = 20;
if (this.isVisible(rec_cg)) {
this.changeTextColor(ColorManager.normalColor());
var title = rec_cg.title;
if (ConfigManager.language == "en" && rec_cg.titleEn) {
title = rec_cg.titleEn;
}
if (false) {
var hint = rec_cg.hint;
var hints = hint.split("\n");
if (hints.length > 1) {
this.contents.drawText(
hints[0],
rect.x + 4,
rect.y + this.itemHeight() - 62,
this.itemWidth(),
32,
"center"
);
this.contents.drawText(
hints[1],
rect.x + 4,
rect.y + this.itemHeight() - 38,
this.itemWidth(),
32,
"center"
);
} else {
this.contents.drawText(
rec_cg.hint,
rect.x + 4,
rect.y + this.itemHeight() - 52,
this.itemWidth(),
32,
"center"
);
}
} else {
this.contents.drawText(
title,
rect.x + 4,
rect.y + this.itemHeight() - 36,
this.itemWidth(),
32,
rngd_recollection_mode_settings.rec_list_window.title_text_align
);
}
} else {
this.contents.drawText(
rngd_recollection_mode_settings.rec_list_window
.never_watch_title_text,
rect.x + 4,
rect.y + 4,
this.itemWidth(),
32,
rngd_recollection_mode_settings.rec_list_window.title_text_align
);
this.changeTextColor(ColorManager.textColor(7));
if (rec_cg.hint) {
var hint = rec_cg.hint;
var hints = hint.split("\n");
if (hints.length > 1) {
this.contents.drawText(
hints[0],
rect.x + 4,
rect.y + this.itemHeight() - 62,
this.itemWidth(),
32,
"center"
);
this.contents.drawText(
hints[1],
rect.x + 4,
rect.y + this.itemHeight() - 38,
this.itemWidth(),
32,
"center"
);
} else {
this.contents.drawText(
rec_cg.hint,
rect.x + 4,
rect.y + this.itemHeight() - 36,
this.itemWidth(),
32,
"center"
);
}
}
}
text_height = 32;
}
// CGセットのスイッチ番号が、全てのセーブデータを走査した後にTrueであればピクチャ表示
if (this.isVisible(rec_cg)) {
var thumbnail_file_name = rec_cg.pictures[0];
if (rec_cg.thumbnail !== undefined && rec_cg.thumbnail !== null) {
thumbnail_file_name = rec_cg.thumbnail;
}
this.drawRecollection(
thumbnail_file_name,
0,
0,
300,
188,
rect.x - 10,
rect.y - 5 + text_height,
rec_cg.paso
);
} else {
this.drawRecollection(
rngd_recollection_mode_settings.rec_list_window
.never_watch_picture_name,
0,
0,
300,
188,
rect.x - 10,
rect.y - 5 + text_height,
rec_cg.paso
);
}
};
Window_RecList2.prototype.get_global_variables = function () {
this._global_variables = {
switches: {},
};
var info = DataManager._globalInfo;
//p(info)
info[99] = info[99] || {};
var rec_cg_max = rngd_recollection_mode_settings.rec_cg_set.length;
for (var j = 0; j < rec_cg_max; j++) {
var cg = rngd_recollection_mode_settings.rec_cg_set[j];
if (info[99][cg.switch_id]) {
this._global_variables["switches"][cg.switch_id] = true;
}
}
};
Window_RecList2.prototype.isShowAll = function () {
if (Nore.isTaikenban()) {
return false;
}
return ConfigManager.openRecollection;
};
Window_RecList2.prototype.selectedInfo = function () {
return this._data[this.index()];
};
return Window_RecList2;
})(Window_Selectable);
Scene_Title.prototype.commandRecollection = function () {
SceneManager.push(Scene_Recollection2);
};