code:
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 make
 * @text 作成
 * @des 作成
 *
 * @command auto
 * @text 自動作成
 * @des 自動作成
 *
 * @command makeTest
 * @text 作成テスト
 * @des 作成テスト
 * @arg itemId
 * @type number
 * @desc AVアイテムID
 * @arg manId
 * @type number
 * @desc 男優ID
 */
var Nore;
(function (Nore) {
  var pluginName = "Nore_AvJacketMaker";
  PluginManager.registerCommand(pluginName, "make", function (args) {
    if (!$gameTemp.av) {
      $gameParty.setMenuActorId(9);
      $gameAvJacketList.pushScreenShot($gameAvJacketMaker.makeDebugJacket());
      $gameAvJacketList.pushScreenShot($gameAvJacketMaker.makeDebugJacket2());
    } else if ($gameAvJacketList.isEmpty()) {
      $gameParty.setMenuActorId($gameTemp.av.actorId());
      var lastAV = $slg.avInfo().findBeforeAv($gameTemp.av);
      if (lastAV && lastAV.screenShotList().length > 0) {
        $gameTemp.av.setScreenShotList(lastAV.screenShotList());
        for (var _i = 0, _a = lastAV.screenShotList(); _i < _a.length; _i++) {
          var ss = _a[_i];
          $gameAvJacketList.pushScreenShot(ss);
        }
      } else {
        $gameAvJacketList.pushScreenShot($gameTemp.av.defaultJacket());
        var jacket2 = $gameTemp.av.defaultJacket2();
        if (jacket2) {
          $gameAvJacketList.pushScreenShot(jacket2);
        }
      }
    } else {
      $gameTemp.av.setScreenShotList($gameAvJacketList.jacketList());
    }
    SceneManager.push(Scene_AvJacketMaker);
  });
  PluginManager.registerCommand(pluginName, "makeTest", function (args) {
    var itemId = parseInt(args.itemId);
    var manId = parseInt(args.manId);
    var item = $dataItems[itemId];
    var actorId = parseInt(item.meta["actorId"]);
    var av = new Av(actorId, itemId);
    if (manId) {
      av.setMainMan(manId);
    }
    $gameParty.setMenuActorId(actorId);
    $gameTemp.av = av;
    $gameAvJacketList.clear();
    $gameAvJacketList.pushScreenShot($gameTemp.av.defaultJacket());
    var jacket2 = $gameTemp.av.defaultJacket2();
    if (jacket2) {
      $gameAvJacketList.pushScreenShot(jacket2);
    }
    $gameTemp.av.setScreenShotList($gameAvJacketList.jacketList());
    SceneManager.push(Scene_AvJacketMaker);
  });
  PluginManager.registerCommand(pluginName, "auto", function (args) {
    if ($gameAvJacketList.isEmpty()) {
      var lastAV = $slg.avInfo().findBeforeAv($gameTemp.av);
      if (lastAV && lastAV.screenShotList().length > 0) {
        $gameTemp.av.setScreenShotList(lastAV.screenShotList());
        for (var _i = 0, _a = lastAV.screenShotList(); _i < _a.length; _i++) {
          var ss = _a[_i];
          $gameAvJacketList.pushScreenShot(ss);
        }
      } else {
        $gameAvJacketList.pushScreenShot($gameTemp.av.defaultJacket());
      }
    } else {
      $gameTemp.av.setScreenShotList($gameAvJacketList.jacketList());
    }
    var av = $gameTemp.av;
    var a = $gameParty.menuActor();
    var actor = JsonEx.makeDeepCopy(a);
    var avJacket = new AvJacket(
      actor,
      $gameTemp.av.itemId(),
      $gameTemp.av.mainManId()
    );
    avJacket.setScreenShot($gameAvJacketList.lastScreenShot());
    avJacket.avText().setTextItem1(autoSelectText1(actor, av));
    avJacket.avText().setTextItem2(autoSelectText2(actor, av));
    $gameTemp.av.setAvJacket(avJacket);
  });
  function isShotaMan55() {
    var manId = $gameVariables.value(55);
    switch (manId) {
      case 3:
      case 5:
        return true;
    }
    return false;
  }
  Nore.isShotaMan55 = isShotaMan55;
  var AutoSelectText1 = /** @class */ (function () {
    function AutoSelectText1(actor, av) {
      this._actor = actor;
      this._av = av;
      this._itemList = [];
      this.makeCandidates();
    }
    AutoSelectText1.prototype.makeCandidates = function () {
      for (var i = 500; i <= 699; i++) {
        var armor = $dataWeapons[i];
        if (this.isInclude(armor)) {
          this._itemList.push(armor);
        }
      }
    };
    AutoSelectText1.prototype.isInclude = function (armor) {
      if (armor.name.length == 0) {
        return false;
      }
      var actor = this._actor;
      var av = this._av;
      if (armor.meta["actor"]) {
        var actorId = parseInt(armor.meta["actor"]);
        if (actorId != actor.actorId()) {
          return false;
        }
      }
      if (armor.meta["loli"]) {
        if (!actor.isLoli()) {
          return false;
        }
      }
      if (armor.meta["first"]) {
        if ($slg.avInfo().actorAvList(actor.actorId()).length > 0) {
          return false;
        }
      }
      if (armor.meta["shojo"]) {
        if ($slg.avInfo().actorAvList(actor.actorId()).length > 0) {
          return false;
        }
        if ($gameTemp.av && $gameTemp.av.nakadashi() == 0) {
          return false;
        }
      }
      if (armor.meta["bote"]) {
        if (actor.boteId == 0) {
          return false;
        }
      }
      if (armor.meta["syusan"]) {
        if (!$gameTemp.av.isSyusan()) {
          return false;
        }
      }
      if (armor.meta["notBote"]) {
        if (actor.boteId > 0) {
          return false;
        }
      }
      if (armor.meta["student"]) {
        if (!actor.isStudent()) {
          return false;
        }
      }
      if (armor.meta["nakadashi"]) {
        if (av.nakadashi() == 0) {
          return false;
        }
      }
      if (armor.meta["kinshin"]) {
        if (av.actorId() != 4) {
          return false;
        }
        if (av.mainManId() != 5) {
          return false;
        }
      }
      if (armor.meta["fela"]) {
        if (!av.isFela()) {
          return false;
        }
      }
      return true;
    };
    AutoSelectText1.prototype.randomText = function () {
      var dice = Math.randomInt(this._itemList.length);
      return this._itemList[dice].id;
    };
    return AutoSelectText1;
  })();
  function autoSelectText1(actor, av) {
    var selector = new AutoSelectText1(actor, av);
    return selector.randomText();
  }
  function autoSelectText2(actor, av) {
    var selector = new AutoSelectText2(actor, av);
    return selector.randomText();
  }
  function autoSelectBack() {
    var num = 0;
    for (var i = 200; i < 250; i++) {
      var armor = $dataArmors[i];
      if (armor.name.length > 0) {
        if (armor.meta["back"]) {
          num++;
        }
      }
    }
    var pre = this._itemList.length - num;
    this.select(Math.randomInt(num) + pre);
  }
  var AutoSelectText2 = /** @class */ (function (_super) {
    __extends(AutoSelectText2, _super);
    function AutoSelectText2() {
      return (_super !== null && _super.apply(this, arguments)) || this;
    }
    AutoSelectText2.prototype.makeCandidates = function () {
      for (var i = 1001; i <= 1500; i++) {
        var armor = $dataWeapons[i];
        if (this.isInclude(armor)) {
          this._itemList.push(armor);
        }
      }
    };
    return AutoSelectText2;
  })(AutoSelectText1);
})(Nore || (Nore = {}));
var JACKET_SLOT_WIDTH = 420;
var Scene_AvJacketMaker = /** @class */ (function (_super) {
  __extends(Scene_AvJacketMaker, _super);
  function Scene_AvJacketMaker() {
    return (_super !== null && _super.apply(this, arguments)) || this;
  }
  Scene_AvJacketMaker.prototype.create = function () {
    this.createActorCopy();
    this.createAvJacket();
    this.saveLastFace();
    _super.prototype.create.call(this);
    this.createPreviewWindow();
    this.createBigJacketSprite();
    this.createCancelButton();
    this.initialAuto();
    this.update();
  };
  Scene_AvJacketMaker.prototype.createKigaeOmankoWindow = function () {
    // 何もしない
  };
  Scene_AvJacketMaker.prototype.createCancelButton = function () {
    this._okButton = new Sprite_Button2("ok", true);
    this._okButton.x = 566;
    this._okButton.y = 5;
    this._okButton.visible = false;
    this.addChild(this._okButton);
    this._okButton.setClickHandler(this.onOkButton.bind(this));
    this._cancelButton = new Sprite_Button2("cancel", true);
    this._cancelButton.x = 560 + 74;
    this._cancelButton.y = 5;
    this._cancelButton.visible = false;
    this.addChild(this._cancelButton);
    this._cancelButton.setClickHandler(this.onCancelButton.bind(this));
  };
  Scene_AvJacketMaker.prototype.startInitialScenario = function () {
    if ($gameSwitches.value(335)) {
      return;
    }
    $gameTemp.confirmWindowActive = true;
    this._kigaeSlotWindow.deactivate();
    this._kigaeCommandWindow.deactivate();
    $gameSwitches.setValue(335, true);
    this.playScenario("AVジャケットチュートリアル_01");
  };
  Scene_AvJacketMaker.prototype.createBigJacketSprite = function () {
    this._bigJacketSprite = new Nore.Sprite_AvJacketBig(
      this._avJacket,
      JacketScale.scale3
    );
    this.addChild(this._bigJacketSprite);
    this._bigJacketSprite.x = 718;
    this._bigJacketSprite.y = 60;
  };
  Scene_AvJacketMaker.prototype.onTouchSelect = function () {
    if (this.isInterpreterRunning()) {
      return;
    }
    if ($gameTemp.confirmWindowActive) {
      return;
    }
    if (this._finished) {
      return;
    }
    if (!this._kigaeCommandWindow.isCurrentItemEnabled()) {
      return;
    }
    this.onCancelSlot();
    this._kigaeCommandWindow.deactivate();
    for (var _i = 0, _a = this._slotWindowList; _i < _a.length; _i++) {
      var w = _a[_i];
      if (w.visible) {
        w.activate();
        return;
      }
    }
    _super.prototype.onTouchSelect.call(this);
  };
  Scene_AvJacketMaker.prototype.onCancelSlot = function () {
    for (var _i = 0, _a = this._slotWindowList; _i < _a.length; _i++) {
      var w = _a[_i];
      if (w.visible) {
        w.deactivate();
      }
    }
    _super.prototype.onCancelSlot.call(this);
  };
  Scene_AvJacketMaker.prototype.getActor = function () {
    return this._actor;
  };
  Scene_AvJacketMaker.prototype.isSyusanAv = function () {
    if (!$gameTemp.av) {
      return false;
    }
    return $gameTemp.av.isSyusan();
  };
  Scene_AvJacketMaker.prototype.createActorCopy = function () {
    var a = $gameParty.menuActor();
    this._actor = JsonEx.makeDeepCopy(a);
    if (this.isSyusanAv()) {
      this._actor.setBote(1);
    }
  };
  Scene_AvJacketMaker.prototype.saveLastFace = function () {
    this._lastHoppeId = this._actor.getAcceHoppeId();
    this._lastFaceId = this._actor.getDefaultFaceId();
    var faceId = this._avJacket.avActor().avFaceId(this._actor);
    var hoppeId = this._avJacket.avActor().avHoppeId(this._actor);
    this._actor.setFaceId(faceId);
    this._actor.setDefaultFaceId(faceId);
    this._actor.setHoppeId(0);
    this._actor.setAcceHoppeId(hoppeId);
  };
  Scene_AvJacketMaker.prototype.restoreLastFace = function () {
    var actor = $gameParty.menuActor();
    actor.setAcceHoppeId(this._lastHoppeId);
    actor.setDefaultFaceId(this._lastFaceId);
  };
  Scene_AvJacketMaker.prototype.initialAuto = function () {
    this.autoBack();
    this.autoFont();
    this.autoText();
    this.autoMan();
    this.initialMan();
    this._avJacket.setDirty();
  };
  Scene_AvJacketMaker.prototype.initialMan = function () {
    if ($gameTemp.av.isShowMan()) {
      this._avJacket.setManLayout(ManLayout.left);
    }
  };
  Scene_AvJacketMaker.prototype.createKigaeActorWindow = function () {
    _super.prototype.createKigaeActorWindow.call(this);
    this._kigaeActorWindow.x += 630;
  };
  Scene_AvJacketMaker.prototype.actorId = function () {
    return this._actor.actorId();
  };
  Scene_AvJacketMaker.prototype.createAvJacket = function () {
    var actor = this._actor;
    this._avJacket = new AvJacket(
      actor,
      $gameTemp.av.itemId(),
      $gameTemp.av.mainManId()
    );
    this._avJacket.setScreenShot($gameAvJacketList.lastScreenShot());
  };
  Scene_AvJacketMaker.prototype.createKigaeCommandWindow = function () {
    var h = 44 * 16 + 70;
    var rect = new Rectangle(6, -2, 200, 800);
    this._kigaeCommandWindow = new Window_JacketCommand(rect, this._avJacket);
    this._kigaeCommandWindow.setHandler(
      "change",
      this.onCommandChange.bind(this)
    );
    this._kigaeCommandWindow.setHandler("ok", this.onCancel.bind(this));
    this._kigaeCommandWindow.setHandler(
      "textInput",
      this.onTextInput.bind(this)
    );
    this._kigaeCommandWindow.setHandler("cancel", this.onCancel.bind(this));
    this._kigaeCommandWindow.setHandler("cos", this.onCos.bind(this));
    this._kigaeCommandWindow.setHandler("acce", this.onAcce.bind(this));
    this._kigaeCommandWindow.setHandler("face", this.onFace.bind(this));
    this._kigaeCommandWindow.setHandler("inner", this.onInner.bind(this));
    this._kigaeCommandWindow.setHandler("rakugaki", this.onRakugaki.bind(this));
    this._kigaeCommandWindow.setHandler("curse", this.onCurse.bind(this));
    this._kigaeCommandWindow.setHandler("jacket", this.onJacket.bind(this));
    this._kigaeCommandWindow.setHandler("text1", this.onText1.bind(this));
    this._kigaeCommandWindow.setHandler("text2", this.onText2.bind(this));
    this._kigaeCommandWindow.setHandler("auto", this.onAuto.bind(this));
    this._kigaeCommandWindow.setHandler("font1", this.onFont1.bind(this));
    this._kigaeCommandWindow.setHandler("font2", this.onFont2.bind(this));
    this._kigaeCommandWindow.setHandler("layout", this.onLayout.bind(this));
    this._kigaeCommandWindow.setHandler("back", this.onBack.bind(this));
    this._kigaeCommandWindow.setHandler("parts", this.onParts.bind(this));
    this._kigaeCommandWindow.setHandler("man", this.onMan.bind(this));
    this._kigaeCommandWindow.setHandler("pagedown", this.nextActor.bind(this));
    this._kigaeCommandWindow.setHandler(
      "pageup",
      this.previousActor.bind(this)
    );
    this.addWindow(this._kigaeCommandWindow);
  };
  Scene_AvJacketMaker.prototype.onTextInput = function () {
    this._kigaeSlotWindow18.activate();
  };
  Scene_AvJacketMaker.prototype.createKigaeSlotWindow = function () {
    this._kigaeSlotWindow = new Window_BaseJacketSlot("cos");
    this.addWindow(this._kigaeSlotWindow);
    this._kigaeSlotWindow2 = new Window_BaseJacketSlot("acce");
    this.addWindow(this._kigaeSlotWindow2);
    this._kigaeSlotWindow3 = new Window_BaseJacketSlot("face");
    this.addWindow(this._kigaeSlotWindow3);
    this._kigaeSlotWindow4 = new Window_BaseJacketSlot("inner");
    this.addWindow(this._kigaeSlotWindow4);
    this._kigaeSlotWindow5 = new Window_BaseJacketSlot("rakugaki");
    this.addWindow(this._kigaeSlotWindow5);
    this._kigaeSlotWindow6 = new Window_BaseJacketSlot("curse");
    this.addWindow(this._kigaeSlotWindow6);
  };
  Scene_AvJacketMaker.prototype.createButtons = function () {
    this._slotWindowList = [];
    this._kigaeSlotWindow10 = new Window_JacketSlot("jacket", this._avJacket);
    this._kigaeSlotWindow10.setHandler("ok", this.onOk10.bind(this));
    this._kigaeSlotWindow10.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow10.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow10.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow10.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow10.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow10);
    this._kigaeSlotWindow10.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow10);
    var av = $gameTemp.av;
    this._kigaeSlotWindow11 = new Window_TextSlot(
      "text1",
      this._avJacket.avText(),
      this._actor,
      av
    );
    this._kigaeSlotWindow11.setHandler("ok", this.onOk11.bind(this));
    this._kigaeSlotWindow11.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow11.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow11.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow11.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow11.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow11);
    this._kigaeSlotWindow11.setActor(this._actor);
    this._avJacket
      .avText()
      .setTextItem1(this._kigaeSlotWindow11.selectedItem().id);
    this._slotWindowList.push(this._kigaeSlotWindow11);
    this._kigaeSlotWindow13 = new Window_TextSlot2(
      "text2",
      this._avJacket.avText(),
      this._actor,
      av
    );
    this._kigaeSlotWindow13.setHandler("ok", this.onOk13.bind(this));
    this._kigaeSlotWindow13.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow13.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow13.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow13.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow13.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow13);
    this._kigaeSlotWindow13.setActor(this._actor);
    this._avJacket
      .avText()
      .setTextItem2(this._kigaeSlotWindow13.selectedItem().id);
    this._avJacket.avText().setDirty();
    this._slotWindowList.push(this._kigaeSlotWindow13);
    this._kigaeSlotWindow11.refresh();
    this._kigaeSlotWindow13.refresh();
    this._kigaeSlotWindow12 = new Window_JacketFont(
      "font1",
      this._avJacket.avText(),
      1
    );
    this._kigaeSlotWindow12.setHandler("ok", this.onOk12.bind(this));
    this._kigaeSlotWindow12.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow12.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow12.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow12.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow12.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow12);
    this._kigaeSlotWindow12.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow12);
    this._kigaeSlotWindow14 = new Window_JacketBack("back", this._avJacket);
    this._kigaeSlotWindow14.setHandler("ok", this.onOk14.bind(this));
    this._kigaeSlotWindow14.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow14.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow14.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow14.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow14.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow14);
    this._kigaeSlotWindow14.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow14);
    this._kigaeSlotWindow15 = new Window_JacketLayout("layout", this._avJacket);
    this._kigaeSlotWindow15.setHandler("ok", this.onOk15.bind(this));
    this._kigaeSlotWindow15.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow15.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow15.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow15.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow15.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow15);
    this._kigaeSlotWindow15.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow15);
    this._kigaeSlotWindow16 = new Window_JacketAuto("auto", this._avJacket);
    this._kigaeSlotWindow16.setHandler("ok", this.onOk16.bind(this));
    this._kigaeSlotWindow16.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow16.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow16.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow16.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow16.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow16);
    this._kigaeSlotWindow16.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow16);
    this._kigaeSlotWindow17 = new Window_JacketParts("parts", this._avJacket);
    this._kigaeSlotWindow17.setHandler("ok", this.onOk17.bind(this));
    this._kigaeSlotWindow17.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow17.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow17.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow17.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow17.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow17);
    this._kigaeSlotWindow17.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow17);
    this._kigaeSlotWindow18 = new Window_JacketTextInput(
      "textInput",
      this._avJacket
    );
    this._kigaeSlotWindow18.setHandler("ok", this.onOk18.bind(this));
    this._kigaeSlotWindow18.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow18.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow18.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow18.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow18.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow18);
    this._kigaeSlotWindow18.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow18);
    this._kigaeSlotWindow19 = new Window_JacketMan("man", this._avJacket);
    this._kigaeSlotWindow19.setHandler("ok", this.onOk19.bind(this));
    this._kigaeSlotWindow19.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow19.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow19.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow19.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow19.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow19);
    this._kigaeSlotWindow19.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow19);
    this._kigaeSlotWindow20 = new Window_JacketFont(
      "font2",
      this._avJacket.avText(),
      2
    );
    this._kigaeSlotWindow20.setHandler("ok", this.onOk20.bind(this));
    this._kigaeSlotWindow20.setHandler("change", this.onChange.bind(this));
    this._kigaeSlotWindow20.setHandler("cancel", this.onCancelSlot.bind(this));
    this._kigaeSlotWindow20.setHandler(
      "touchSelect",
      this.onTouchSelect.bind(this)
    );
    this._kigaeSlotWindow20.setHandler("pageup", this.onPageup.bind(this));
    this._kigaeSlotWindow20.setHandler("pagedown", this.onPagedown.bind(this));
    this.addWindow(this._kigaeSlotWindow20);
    this._kigaeSlotWindow20.setActor(this._actor);
    this._slotWindowList.push(this._kigaeSlotWindow20);
  };
  Scene_AvJacketMaker.prototype.onCosChange = function () {
    _super.prototype.onCosChange.call(this);
    this._avJacket._avActor
      .cos()
      .saveCostumeActor(this._actor, this._actor.getDefaultFaceId());
    this._avJacket._avActor.setDirty();
  };
  Scene_AvJacketMaker.prototype.onOk10 = function () {
    this._kigaeSlotWindow10.activate();
    var ss = this._kigaeSlotWindow10.selectedScreenShot();
    this._avJacket.setScreenShot(ss);
    this._kigaeSlotWindow10.refresh();
  };
  Scene_AvJacketMaker.prototype.onOk11 = function () {
    this._kigaeSlotWindow11.activate();
    var armor = this._kigaeSlotWindow11.selectedItem();
    this._avJacket.avText().setTextItem1(armor.id);
    this._avJacket.avText().setDirty();
    this._kigaeSlotWindow11.refresh();
  };
  Scene_AvJacketMaker.prototype.onOk13 = function () {
    this._kigaeSlotWindow13.activate();
    var armor = this._kigaeSlotWindow13.selectedItem();
    this._avJacket.avText().setTextItem2(armor.id);
    this._avJacket.avText().setDirty();
    this._kigaeSlotWindow13.refresh();
  };
  Scene_AvJacketMaker.prototype.onOk14 = function () {
    this._kigaeSlotWindow14.activate();
    var armor = this._kigaeSlotWindow14.selectedItem();
    this._avJacket.setBackItemId(armor.id);
    this._kigaeSlotWindow14.refresh();
  };
  Scene_AvJacketMaker.prototype.onOk15 = function () {
    this._kigaeSlotWindow15.activate();
    var armor = this._kigaeSlotWindow15.selectedItem();
    if (armor.meta["layout"]) {
      this._avJacket.setLayout(parseInt(armor.meta["layout"]));
    } else if (armor.meta["thumbnail"]) {
      var b = this._avJacket.isThumbnail();
      this._avJacket.setThumbnailEnabled(!b);
    } else if (armor.meta["thumbnailRight"]) {
      var value = parseInt(armor.meta["thumbnailRight"]);
      this._avJacket.thumbnail().right(value);
    } else if (armor.meta["thumbnailLeft"]) {
      var value = parseInt(armor.meta["thumbnailLeft"]);
      this._avJacket.thumbnail().left(value);
    } else if (armor.meta["thumbnailUp"]) {
      var value = parseInt(armor.meta["thumbnailUp"]);
      this._avJacket.thumbnail().up(value);
    } else if (armor.meta["thumbnailDown"]) {
      var value = parseInt(armor.meta["thumbnailDown"]);
      this._avJacket.thumbnail().down(value);
    } else if (armor.meta["thumbnailScale"]) {
      var value = parseInt(armor.meta["thumbnailScale"]);
      this._avJacket.thumbnail().scaleUp(value);
    } else if (armor.meta["thumbnailRotation"]) {
      var value = parseInt(armor.meta["thumbnailRotation"]);
      this._avJacket.thumbnail().angleUp(value);
      p(this._avJacket.thumbnail());
    }
    this._avJacket.setDirty();
    this._kigaeSlotWindow15.refresh();
  };
  Scene_AvJacketMaker.prototype.randomThumbnail = function () {
    if (this._avJacket.layout() == 2) {
      var dice = Math.randomInt(3);
      switch (dice) {
        case 0:
          return this.autoThumbnail1();
        case 1:
          return this.autoThumbnail2();
        case 2:
          return this.autoThumbnail3();
      }
      return this.autoThumbnail1();
    } else {
      var dice = Math.randomInt(3);
      switch (dice) {
        case 0:
          return this.autoThumbnail11();
        case 1:
          return this.autoThumbnail12();
        case 2:
          return this.autoThumbnail13();
      }
      return this.autoThumbnail11();
    }
  };
  Scene_AvJacketMaker.prototype.autoThumbnail1 = function () {
    var t = new Thumbnail();
    t._angle = 0;
    t._leftMargin = 0;
    t._rightMargin = 0;
    t._scale = 46;
    t._x = 115;
    t._y = 480;
    return t;
  };
  Scene_AvJacketMaker.prototype.autoThumbnail2 = function () {
    var t = new Thumbnail();
    t._angle = 0;
    t._leftMargin = 0;
    t._rightMargin = 0;
    t._scale = 46;
    t._x = 380;
    t._y = 480;
    return t;
  };
  Scene_AvJacketMaker.prototype.autoThumbnail3 = function () {
    var t = new Thumbnail();
    t._angle = 0;
    t._leftMargin = 0;
    t._rightMargin = 0;
    t._scale = 46;
    t._x = 250;
    t._y = 480;
    return t;
  };
  Scene_AvJacketMaker.prototype.autoThumbnail11 = function () {
    var t = new Thumbnail();
    t._angle = 0;
    t._leftMargin = 0;
    t._rightMargin = 0;
    t._scale = 56;
    t._x = 150;
    t._y = 580;
    return t;
  };
  Scene_AvJacketMaker.prototype.autoThumbnail12 = function () {
    var t = new Thumbnail();
    t._angle = 0;
    t._leftMargin = 0;
    t._rightMargin = 0;
    t._scale = 56;
    t._x = 350;
    t._y = 580;
    return t;
  };
  Scene_AvJacketMaker.prototype.autoThumbnail13 = function () {
    var t = new Thumbnail();
    t._angle = Math.randomInt(9) * (Math.randomInt(2) == 0 ? -1 : 0);
    t._leftMargin = 0;
    t._rightMargin = 0;
    t._scale = 38 + 2 * Math.randomInt(15);
    t._x = 300 + 10 * Math.randomInt(15);
    t._y = 480 + 10 * Math.randomInt(13);
    return t;
  };
  Scene_AvJacketMaker.prototype.onOk17 = function () {
    this._kigaeSlotWindow17.activate();
    var armor = this._kigaeSlotWindow17.selectedItem();
    this._avJacket.changeParts(armor.id);
    this._avJacket.setDirty();
    this._kigaeSlotWindow17.refresh();
  };
  Scene_AvJacketMaker.prototype.onOk16 = function () {
    var armor = this._kigaeSlotWindow16.selectedItem();
    if (armor.meta["fixType"]) {
      this.changeFixType(parseInt(armor.meta["fixType"]));
    } else {
      var auto = parseInt(armor.meta["auto"]);
      this.changeAuto(auto);
    }
  };
  Scene_AvJacketMaker.prototype.onOk18 = function () {
    var armor = this._kigaeSlotWindow18.selectedItem();
    var currentText;
    if (armor.id == 431) {
      currentText = this._avJacket.avText().originalText1().text();
    } else if (armor.id == 434) {
      currentText = this._avJacket.avText().originalText2().text();
    } else if (armor.id == 432) {
      if (this._avJacket.avText().originalText1().isEmpty()) {
        SoundManager.playBuzzer();
        this._kigaeSlotWindow18.activate();
        return;
      } else {
        this._avJacket.avText().originalText1().setEnabled(true);
        this._avJacket.setDirty();
        this._kigaeSlotWindow18.refresh();
      }
    } else if (armor.id == 433) {
      this._avJacket.avText().originalText1().setEnabled(false);
      this._avJacket.setDirty();
      this._kigaeSlotWindow18.refresh();
    } else if (armor.id == 435) {
      if (this._avJacket.avText().originalText2().isEmpty()) {
        SoundManager.playBuzzer();
        this._kigaeSlotWindow18.activate();
        return;
      } else {
        this._avJacket.avText().originalText2().setEnabled(true);
        this._avJacket.setDirty();
        this._kigaeSlotWindow18.refresh();
      }
    } else if (armor.id == 436) {
      this._avJacket.avText().originalText2().setEnabled(false);
      this._avJacket.setDirty();
      this._kigaeSlotWindow18.refresh();
    }
    if (currentText != null) {
      Nore.showTextInput(currentText);
      this._inInput = true;
      this._okButton.visible = true;
      this._cancelButton.visible = true;
      $gameTemp.confirmWindowActive = true;
      this._inputWait = 20;
    } else {
      this._kigaeSlotWindow18.activate();
    }
  };
  Scene_AvJacketMaker.prototype.onOk19 = function () {
    var armor = this._kigaeSlotWindow19.selectedItem();
    if (armor.meta["manLayout"]) {
      var manLayout = parseInt(armor.meta["manLayout"]);
      this._avJacket.setManLayout(manLayout);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["manZIndex"]) {
      var manZIndex = armor.meta["manZIndex"];
      this._avJacket.setManZIndex(manZIndex);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["outer"]) {
      var outer = armor.meta["outer"];
      this._avJacket.manCos().setOuterId(outer);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["face"]) {
      var face = parseInt(armor.meta["face"]);
      this._avJacket.manCos().setFaceId(face);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["hoppe"]) {
      var hoppe = parseInt(armor.meta["hoppe"]);
      this._avJacket.manCos().setHoppeId(hoppe);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["pose"]) {
      var pose = parseInt(armor.meta["pose"]);
      this._avJacket.manCos().setPoseId(pose);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["innerBottom"]) {
      var innerBottom = armor.meta["innerBottom"];
      this._avJacket.manCos().setInnerBottomId(innerBottom);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    } else if (armor.meta["acce"]) {
      if (this._avJacket.manCos().hasAcce(armor.id)) {
        this._kigaeSlotWindow19.activate();
        return;
      }
      this._avJacket.manCos().setAcceId(armor.id);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    }
    this._kigaeSlotWindow19.activate();
  };
  Scene_AvJacketMaker.prototype.changeFixType = function (fixType) {
    this._avJacket.changeFix(fixType);
    this._kigaeSlotWindow16.refresh();
    this._kigaeSlotWindow16.activate();
  };
  Scene_AvJacketMaker.prototype.changeAuto = function (auto) {
    switch (auto) {
      case 1:
        this.autoScreenShot();
        this.autoBack();
        this.autoFont();
        this.autoText();
        this.autoLayout();
        this.autoActor();
        this.autoParts();
        this.autoMan();
        break;
      case 2:
        this.autoText();
        break;
      case 3:
        this.autoLayout();
        break;
      case 4:
        this.autoFont();
        break;
      case 5:
        this.autoActor();
        break;
      case 6:
        this.auto2Panel();
        break;
      case 7:
        this.autoMan();
        break;
    }
    this._avJacket.setDirty();
    this._kigaeSlotWindow16.activate();
  };
  Scene_AvJacketMaker.prototype.onOk12 = function () {
    var avText = this._avJacket.avText();
    this._kigaeSlotWindow12.activate();
    var item = this._kigaeSlotWindow12.selectedItem();
    if (item.meta["gothic"]) {
      avText.setGothic1(true);
    }
    if (item.meta["mincho"]) {
      avText.setGothic1(false);
    }
    if (item.meta["color"]) {
      avText.setTextColorId1(item.id);
    }
    if (item.meta["outline"]) {
      var outline = parseInt(item.meta["outline"]);
      avText.setOutlineThickness1(outline);
    }
    this._kigaeSlotWindow20.selectConbination();
    this._kigaeSlotWindow12.refresh();
  };
  Scene_AvJacketMaker.prototype.onOk20 = function () {
    var avText = this._avJacket.avText();
    this._kigaeSlotWindow20.activate();
    var item = this._kigaeSlotWindow20.selectedItem();
    if (item.meta["gothic"]) {
      avText.setGothic2(true);
    }
    if (item.meta["mincho"]) {
      avText.setGothic2(false);
    }
    if (item.meta["color"]) {
      avText.setTextColorId2(item.id);
    }
    if (item.meta["outline"]) {
      var outline = parseInt(item.meta["outline"]);
      avText.setOutlineThickness2(outline);
    }
    if (item.meta["conbination"]) {
      avText.setConbination(!avText.isConbination());
      this._kigaeSlotWindow20.selectConbination();
    }
    this._kigaeSlotWindow20.refresh();
  };
  Scene_AvJacketMaker.prototype.onAuto = function () {
    this._kigaeSlotWindow16.activate();
  };
  Scene_AvJacketMaker.prototype.autoScreenShot = function () {
    if (this._avJacket.isFixed(FixType.image)) {
      return;
    }
    this._kigaeSlotWindow10.autoSelect();
    var ss = this._kigaeSlotWindow10.selectedScreenShot();
    this._avJacket.setScreenShot(ss);
    this._kigaeSlotWindow10.refresh();
  };
  Scene_AvJacketMaker.prototype.autoBack = function () {
    if (this._avJacket.isFixed(FixType.back)) {
      return;
    }
    this._kigaeSlotWindow14.autoSelect();
    var back = this._kigaeSlotWindow14.selectedItem();
    this._avJacket.setBackItemId(back.id);
    this._kigaeSlotWindow14.refresh();
  };
  Scene_AvJacketMaker.prototype.autoText = function () {
    if (!this._avJacket.isFixed(FixType.text1)) {
      this._kigaeSlotWindow11.autoSelect();
      var armor1 = this._kigaeSlotWindow11.selectedItem();
      this._avJacket.avText().setTextItem1(armor1.id);
      this._kigaeSlotWindow11.refresh();
    }
    if (!this._avJacket.isFixed(FixType.text2)) {
      this._kigaeSlotWindow13.autoSelect();
      var armor2 = this._kigaeSlotWindow13.selectedItem();
      this._avJacket.avText().setTextItem2(armor2.id);
      this._kigaeSlotWindow13.refresh();
    }
  };
  Scene_AvJacketMaker.prototype.autoMan = function () {
    if (this._avJacket.isFixed(FixType.man)) {
      return;
    }
    if (!this._avJacket.isManTachieEnabled()) {
      return;
    }
    this._kigaeSlotWindow19.autoSelect();
    var armor = this._kigaeSlotWindow19.selectedItem();
    if (armor.meta["manLayout"]) {
      var manLayout = parseInt(armor.meta["manLayout"]);
      this._avJacket.setManLayout(manLayout);
      this._avJacket.setDirty();
      this._kigaeSlotWindow19.refresh();
    }
  };
  Scene_AvJacketMaker.prototype.auto2Panel = function () {
    this.autoScreenShot();
    this.autoBack();
    this.autoFont();
    this.autoText();
    this.auto2PanelLayout();
    this.autoActor();
    this.autoArrowParts();
    this.autoMan();
  };
  Scene_AvJacketMaker.prototype.autoArrowParts = function () {
    if (this._avJacket.isFixed(FixType.parts)) {
      return;
    }
    this._avJacket.clearParts(1);
    var arrow = this._kigaeSlotWindow17.randomArrow();
    this._avJacket.setParts(arrow, true);
    if (!this._avJacket.isActorLayout()) {
      this._avJacket.clearParts(11);
    } else {
      this._avJacket.clearParts(11);
      if (Math.randomInt(2) == 0) {
        var icon = this._kigaeSlotWindow17.randomIcon();
        this._avJacket.setParts(icon, true);
      }
    }
    this._kigaeSlotWindow17.refresh();
  };
  Scene_AvJacketMaker.prototype.auto2PanelLayout = function () {
    if (this._avJacket.isFixed(FixType.layout)) {
      return;
    }
    this._kigaeSlotWindow15.autoSelect2Panel();
    var armor = this._kigaeSlotWindow15.selectedItem();
    this._avJacket.setLayout(parseInt(armor.meta["layout"]));
    this._kigaeSlotWindow15.refresh();
  };
  Scene_AvJacketMaker.prototype.autoFont = function () {
    if (this._avJacket.isFixed(FixType.font)) {
      return;
    }
    {
      this._kigaeSlotWindow12.autoSelect();
      var item = this._kigaeSlotWindow12.selectedItem();
      if (item.meta["color"]) {
        this._avJacket.avText().setTextColorId1(item.id);
      }
    }
    {
      this._kigaeSlotWindow20.autoSelect();
      var item = this._kigaeSlotWindow20.selectedItem();
      if (item.meta["color"]) {
        this._avJacket.avText().setTextColorId2(item.id);
      }
    }
    this._avJacket.auto();
    this._kigaeSlotWindow12.refresh();
  };
  Scene_AvJacketMaker.prototype.autoLayout = function () {
    if (this._avJacket.isFixed(FixType.layout)) {
      return;
    }
    this._kigaeSlotWindow15.autoSelect();
    var armor = this._kigaeSlotWindow15.selectedItem();
    this._avJacket.setLayout(parseInt(armor.meta["layout"]));
    if (this._avJacket.isActorOnlyLayout()) {
      this._avJacket.setThumbnail(this.randomThumbnail());
    }
    this._kigaeSlotWindow15.refresh();
  };
  Scene_AvJacketMaker.prototype.autoActor = function () {
    if (this._avJacket.isFixed(FixType.actor)) {
      return;
    }
    this._kigaeSlotWindow.selectAuto();
    this._kigaeSlotWindow4.selectAuto(); //インナー
    this._kigaeSlotWindow3.selectAuto(); //表情
    this._kigaeSlotWindow.refresh();
    this.onCosChange();
    this._kigaeActorWindow.refresh();
  };
  Scene_AvJacketMaker.prototype.autoParts = function () {
    if (this._avJacket.isFixed(FixType.parts)) {
      return;
    }
    if (!this._avJacket.isDividedLayout()) {
      this._avJacket.clearParts(1);
    } else {
      this._avJacket.clearParts(1);
      if (Math.randomInt(2) == 0) {
        var arrow = this._kigaeSlotWindow17.randomArrow();
        this._avJacket.setParts(arrow, true);
      }
    }
    if (!this._avJacket.isActorLayout()) {
      this._avJacket.clearParts(11);
    } else {
      this._avJacket.clearParts(11);
      if (Math.randomInt(2) == 0) {
        var icon = this._kigaeSlotWindow17.randomIcon();
        this._avJacket.setParts(icon, true);
      }
    }
    this._kigaeSlotWindow17.refresh();
  };
  Scene_AvJacketMaker.prototype.onJacket = function () {
    this._kigaeSlotWindow10.activate();
  };
  Scene_AvJacketMaker.prototype.onText1 = function () {
    this._kigaeSlotWindow11.activate();
  };
  Scene_AvJacketMaker.prototype.onText2 = function () {
    this._kigaeSlotWindow13.activate();
  };
  Scene_AvJacketMaker.prototype.onFont1 = function () {
    this._kigaeSlotWindow12.activate();
  };
  Scene_AvJacketMaker.prototype.onFont2 = function () {
    this._kigaeSlotWindow20.activate();
  };
  Scene_AvJacketMaker.prototype.onBack = function () {
    this._kigaeSlotWindow14.activate();
  };
  Scene_AvJacketMaker.prototype.onLayout = function () {
    this._kigaeSlotWindow15.activate();
  };
  Scene_AvJacketMaker.prototype.onParts = function () {
    this._kigaeSlotWindow17.activate();
  };
  Scene_AvJacketMaker.prototype.onMan = function () {
    this._kigaeSlotWindow19.activate();
  };
  Scene_AvJacketMaker.prototype.createPreviewWindow = function () {
    this._previewWindow = new Window_JacketPreview(this._avJacket);
    this._previewWindow.x -= 50;
    //this.addChild(this._previewWindow);
  };
  Scene_AvJacketMaker.prototype.hideAllSlotWindow = function () {
    _super.prototype.hideAllSlotWindow.call(this);
    for (var _i = 0, _a = this._slotWindowList; _i < _a.length; _i++) {
      var w = _a[_i];
      if (w.visible) {
        w.hide();
      }
    }
  };
  Scene_AvJacketMaker.prototype.onCommandChange = function () {
    _super.prototype.onCommandChange.call(this);
    if (this._kigaeCommandWindow.currentSymbol() == "jacket") {
      this._kigaeSlotWindow10.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "text1") {
      this._kigaeSlotWindow11.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "text2") {
      this._kigaeSlotWindow13.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "font1") {
      this._kigaeSlotWindow12.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "back") {
      this._kigaeSlotWindow14.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "layout") {
      this._kigaeSlotWindow15.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "auto") {
      this._kigaeSlotWindow16.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "parts") {
      this._kigaeSlotWindow17.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "textInput") {
      this._kigaeSlotWindow18.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "man") {
      this._kigaeSlotWindow19.show();
    }
    if (this._kigaeCommandWindow.currentSymbol() == "font2") {
      this._kigaeSlotWindow20.show();
    }
  };
  Scene_AvJacketMaker.prototype.onCancel = function () {
    this.addChild(this._confirmWindow);
    this._confirmWindow.setText(TextManager.confirmMakeJacket);
    this._confirmWindow.show();
    this._confirmWindow.activate();
  };
  Scene_AvJacketMaker.prototype.onConfirmOk = function () {
    if ($gameTemp.av) {
      $gameTemp.av.setAvJacket(this._avJacket);
    }
    this._finished = true;
    this.restoreLastFace();
    this.popScene();
  };
  Scene_AvJacketMaker.prototype.update = function () {
    this.updateTextInput();
    _super.prototype.update.call(this);
    this._avJacket.clearDirty();
  };
  Scene_AvJacketMaker.prototype.updateTextInput = function () {
    if (!this._inInput) {
      return;
    }
    if (this._inputWait > 0) {
      this._inputWait--;
      return;
    }
    if (Input.isPressed("enter")) {
      this.onOkButton();
    }
    if (Input.isPressed("escapeText")) {
      this.onCancelButton();
    }
  };
  Scene_AvJacketMaker.prototype.onCancelButton = function () {
    if (!this._inInput) {
      return;
    }
    this._inInput = false;
    SoundManager.playCancel();
    $gameTemp.confirmWindowActive = false;
    Nore.hideTextInput();
    this._kigaeSlotWindow18.activate();
    Input.clear();
    this._cancelButton.visible = false;
    this._okButton.visible = false;
  };
  Scene_AvJacketMaker.prototype.onOkButton = function () {
    if (!this._inInput) {
      return;
    }
    this._inInput = false;
    this._okButton.visible = false;
    this._cancelButton.visible = false;
    SoundManager.playOk();
    $gameTemp.confirmWindowActive = false;
    var inputText = Nore.hideTextInput();
    var armor = this._kigaeSlotWindow18.selectedItem();
    if (armor.id == 431) {
      this._avJacket.avText().setOriginalText1(inputText);
      this._avJacket.avText().originalText1().setEnabled(true);
    } else if (armor.id == 434) {
      this._avJacket.avText().setOriginalText2(inputText);
      this._avJacket.avText().originalText2().setEnabled(true);
    }
    this._kigaeSlotWindow18.refresh();
    this._kigaeSlotWindow18.activate();
    this._avJacket.setDirty();
    Input.clear();
  };
  return Scene_AvJacketMaker;
})(Nore.Scene_Kigae);
var Window_JacketPreview = /** @class */ (function (_super) {
  __extends(Window_JacketPreview, _super);
  function Window_JacketPreview(avJacket) {
    var _this = this;
    var r = new Rectangle(620, 30, 182, 234);
    _this = _super.call(this, r) || this;
    _this._avJacket = avJacket;
    _this._avJacketSprite = new Sprite_AvJacket(_this._avJacket);
    _this._avJacketSprite.x = 16;
    _this._avJacketSprite.y = 16;
    _this.addChild(_this._avJacketSprite);
    _this.refresh();
    _this.backOpacity = 0;
    _this.frameVisible = false;
    return _this;
  }
  Window_JacketPreview.prototype.refresh = function () {
    this._avJacketSprite.refresh();
    //this._windowContentsSprite.removeChildren();
  };
  return Window_JacketPreview;
})(Window_Base);
var Window_JacketCommand = /** @class */ (function (_super) {
  __extends(Window_JacketCommand, _super);
  function Window_JacketCommand(r, avJacket) {
    var _this = _super.call(this, r) || this;
    _this._canOk = true;
    _this._avJacket = avJacket;
    _this.makeCommandList();
    _this.refresh();
    return _this;
  }
  Window_JacketCommand.prototype.setCanOk = function (b) {
    if (this._canOk == b) {
      return;
    }
    this._canOk = b;
    this.refresh();
  };
  Window_JacketCommand.prototype.makeCommandList = function () {
    if (!this._avJacket) {
      return;
    }
    this.addCommand(TextManager.jacketAuto, "auto", true, null);
    if (Nore.isTextInputEnabled()) {
      this.addCommand(TextManager.jacketTextInput, "textInput", true, null);
    }
    this.addCommand(TextManager.jacketLabel, "jacket", true, null);
    this.addCommand(TextManager.jacketTextLabel1, "text1", true, null);
    this.addCommand(TextManager.jacketTextLabel2, "text2", true, null);
    this.addCommand(TextManager.jacketFont1, "font1", true, null);
    this.addCommand(TextManager.jacketFont2, "font2", true, null);
    this.addCommand(TextManager.jacketLayout, "layout", true, null);
    this.addCommand(TextManager.jacketBack, "back", true, null);
    this.addCommand(TextManager.jacketParts, "parts", true, null);
    this.addCommand(TextManager.cosLabel, "cos", true, null);
    this.addCommand(TextManager.innerLabel, "inner", true, null);
    this.addCommand(TextManager.acceLabel, "acce", true, null);
    this.addCommand(TextManager.rakugakiLabel, "rakugaki", true, null);
    //this.addCommand(TextManager.curseLabel, 'curse',  true, null);
    this.addCommand(TextManager.faceLabel, "face", true, null);
    this.addCommand(
      TextManager.jacketMan,
      "man",
      this._avJacket.isManTachieEnabled(),
      null
    );
    this.addCommand("OK", "ok", this._canOk, null);
    //super.makeCommandList();
  };
  Window_JacketCommand.prototype.itemRect = function (index) {
    var r = _super.prototype.itemRect.call(this, index);
    if (index >= 1) {
      r.y += 14;
    }
    if (Nore.isTextInputEnabled()) {
      index--;
    }
    if (index >= 9) {
      r.y += 14;
    }
    if (index >= 15) {
      r.y += 15;
    }
    return r;
  };
  Window_JacketCommand.prototype.itemHeight = function () {
    return 43;
  };
  return Window_JacketCommand;
})(Nore.Window_KigaeCommand);
var Window_BaseJacketSlot = /** @class */ (function (_super) {
  __extends(Window_BaseJacketSlot, _super);
  function Window_BaseJacketSlot(type) {
    return (
      _super.call(this, type, JACKET_SLOT_WIDTH, Nore.WINDOW_TOP_MARGIN - 44) ||
      this
    );
  }
  Window_BaseJacketSlot.prototype.inAv = function () {
    return true;
  };
  return Window_BaseJacketSlot;
})(Nore.Window_KigaeSlot);
var Window_JacketSlot = /** @class */ (function (_super) {
  __extends(Window_JacketSlot, _super);
  function Window_JacketSlot(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketSlot.prototype.makeItemList = function (actor) {
    this._itemList = [];
    //this._itemList.push(new AvScreenShot([]));
    for (
      var _i = 0, _a = $gameAvJacketList.jacketList();
      _i < _a.length;
      _i++
    ) {
      var item = _a[_i];
      this._itemList.push(item);
    }
  };
  Window_JacketSlot.prototype.initMask = function () {};
  Window_JacketSlot.prototype.itemHeight = function () {
    return 100;
  };
  Window_JacketSlot.prototype.refresh = function () {
    this._windowContentsSprite.removeChildren();
    _super.prototype.refresh.call(this);
  };
  Window_JacketSlot.prototype.drawItem = function (index) {
    var av = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(true);
    rect.x += 40 + 30;
    if (av.isEmpty()) {
      this.drawText("なし", rect.x, rect.y, rect.width);
      if (this._avJacket.screenShot().isEmpty()) {
        this.drawEquip(rect.y);
      }
      return;
    }
    //this.drawTextEx('\\C[0]' + av.name() + '\\C[0]', rect.x, rect.y, 200);
    var sprite = new Sprite_AvScreenShot(av);
    sprite.x = rect.x + 60;
    sprite.y = rect.y + 14 + 46;
    this._windowContentsSprite.addChild(sprite);
    if (this._avJacket.screenShot() == av) {
      this.drawEquip(rect.y);
    }
  };
  Window_JacketSlot.prototype.isEnabled = function (item) {
    return true;
  };
  Window_JacketSlot.prototype.selectedScreenShot = function () {
    return this._itemList[this.index()];
  };
  Window_JacketSlot.prototype.autoSelect = function () {
    this.select(Math.randomInt(this._itemList.length));
  };
  return Window_JacketSlot;
})(Window_BaseJacketSlot);
var Window_TextSlot = /** @class */ (function (_super) {
  __extends(Window_TextSlot, _super);
  function Window_TextSlot(type, avText, actor, av) {
    var _this = _super.call(this, type) || this;
    _this._avText = avText;
    _this._actor = actor;
    _this._av = av;
    return _this;
  }
  Window_TextSlot.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 500; i <= 599; i++) {
      var armor = $dataWeapons[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
  };
  Window_TextSlot.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    if (this.isSelectedItem(armor.id)) {
      this.drawEquip(rect.y);
    }
    this.drawTextEx("\\C[0]" + armor.name + "\\C[0]", rect.x, rect.y, 200);
  };
  Window_TextSlot.prototype.isInclude = function (armor) {
    if (armor.name.length == 0) {
      return false;
    }
    var actor = this._actor;
    var av = this._av;
    if (armor.meta["actor"]) {
      var actorId = parseInt(armor.meta["actor"]);
      if (actorId != actor.actorId()) {
        return false;
      }
    }
    if (armor.meta["loli"]) {
      if (!actor.isLoli()) {
        return false;
      }
    }
    if (armor.meta["first"]) {
      if ($slg.avInfo().actorAvList(actor.actorId()).length > 0) {
        return false;
      }
    }
    if (armor.meta["shojo"]) {
      if ($slg.avInfo().actorAvList(actor.actorId()).length > 0) {
        return false;
      }
      if ($gameTemp.av && $gameTemp.av.nakadashi() == 0) {
        return false;
      }
    }
    if (armor.meta["bote"]) {
      if (actor.boteId == 0) {
        return false;
      }
    }
    if (armor.meta["syusan"]) {
      if (!$gameTemp.av.isSyusan()) {
        return false;
      }
    }
    if (armor.meta["notBote"]) {
      if (actor.boteId > 0) {
        return false;
      }
    }
    if (armor.meta["student"]) {
      if (!actor.isStudent()) {
        return false;
      }
    }
    if (armor.meta["nakadashi"]) {
      if (av.nakadashi() == 0) {
        return false;
      }
    }
    if (armor.meta["anal"]) {
      if ($gameTemp.av && $gameTemp.av.anal() == 0) {
        return false;
      }
    }
    if (armor.meta["kinshin"]) {
      if (av.actorId() != 4) {
        return false;
      }
      if (av.mainManId() != 5) {
        return false;
      }
    }
    return true;
  };
  Window_TextSlot.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_TextSlot.prototype.isSelectedItem = function (id) {
    return this._avText.textItem1() == id;
  };
  Window_TextSlot.prototype.autoSelect = function () {
    this.select(Math.randomInt(this._itemList.length));
  };
  Window_TextSlot.prototype.initMask = function () {};
  return Window_TextSlot;
})(Window_BaseJacketSlot);
var Window_TextSlot2 = /** @class */ (function (_super) {
  __extends(Window_TextSlot2, _super);
  function Window_TextSlot2(type, avText, actor, av) {
    return _super.call(this, type, avText, actor, av) || this;
  }
  Window_TextSlot2.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 1001; i <= 1500; i++) {
      var armor = $dataWeapons[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
  };
  Window_TextSlot2.prototype.isSelectedItem = function (id) {
    return this._avText.textItem2() == id;
  };
  return Window_TextSlot2;
})(Window_TextSlot);
var Window_JacketFont = /** @class */ (function (_super) {
  __extends(Window_JacketFont, _super);
  function Window_JacketFont(type, avText, index) {
    var _this = _super.call(this, type) || this;
    _this._avText = avText;
    _this._typeIndex = index;
    _this.makeItemList();
    return _this;
  }
  Window_JacketFont.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 300; i <= 312; i++) {
      var armor = $dataArmors[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
    for (var i = 1; i < 100; i++) {
      var weapon = $dataWeapons[i];
      if (weapon.name.length > 0) {
        this._itemList.push(weapon);
      }
    }
  };
  Window_JacketFont.prototype.isInclude = function (armor) {
    if (armor.name.length > 0) {
      if (armor.meta["conbination"]) {
        return this._typeIndex == 2;
      } else {
        return true;
      }
    }
    return false;
  };
  Window_JacketFont.prototype.initMask = function () {};
  Window_JacketFont.prototype.isEnabled = function (item) {
    if (this._typeIndex == 1) {
      return true;
    }
    if (!this._avText.isConbination()) {
      return true;
    }
    if (item.meta["color"]) {
      return false;
    }
    return true;
  };
  Window_JacketFont.prototype.isCurrentItemEnabled = function () {
    return this.isEnabled(this.selectedItem());
  };
  Window_JacketFont.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    var name = this.armorName(armor);
    if (armor.meta["conbination"]) {
      if (this._avText.isConbination()) {
        this.drawEquip(rect.y);
      }
      this.drawTextEx("\\C[2]" + name + "\\C[0]", rect.x, rect.y, 200);
    } else if (armor.meta["gothic"] || armor.meta["mincho"]) {
      if (this._avText.isGothic(this._typeIndex)) {
        if (armor.meta["gothic"]) {
          this.drawEquip(rect.y);
        }
      } else {
        if (armor.meta["mincho"]) {
          this.drawEquip(rect.y);
        }
      }
      this.drawTextEx("\\C[5]" + name + "\\C[0]", rect.x, rect.y, 200);
    } else if (armor.meta["color"]) {
      if (this._avText.textColorId(this._typeIndex) == armor.id) {
        this.drawEquip(rect.y);
      }
      if (this.isEnabled(armor)) {
        this.changeTextColor("#" + armor.meta["color"]);
        if (armor.meta["outline1_color"]) {
          this.changeOutlineColor("#" + armor.meta["outline1_color"]);
        } else if (armor.meta["glow1_color"]) {
          this.changeOutlineColor("#" + armor.meta["glow1_color"]);
        }
      }
      this.drawText(name, rect.x, rect.y, 200);
      this.resetFontSettings();
    } else if (armor.meta["outline"]) {
      var t = parseInt(armor.meta["outline"]);
      if (this._avText.outlineThickness(this._typeIndex) == t) {
        this.drawEquip(rect.y);
      }
      this.drawText(name, rect.x, rect.y, 200);
    }
  };
  Window_JacketFont.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketFont.prototype.autoSelect = function () {
    if (this._typeIndex == 2 && this._avText.isConbination()) {
      this.selectConbination();
      return;
    }
    this.autoSelectColor();
  };
  Window_JacketFont.prototype.autoSelectColor = function () {
    var pre = 0;
    for (var i = 300; i <= 312; i++) {
      var armor = $dataArmors[i];
      if (armor.name.length > 0) {
        pre++;
      }
    }
    var num = this._itemList.length - pre;
    this.select(Math.randomInt(num) + pre);
  };
  Window_JacketFont.prototype.selectConbination = function () {
    if (this._typeIndex != 2) {
      return;
    }
    if (!this._avText.isConbination()) {
      return;
    }
    var id = this._avText.textColorId1();
    if (id <= 24) {
      this._avText.setTextColorId2(id + 24);
    } else {
      this._avText.setTextColorId2(id - 24);
    }
    this.refresh();
  };
  return Window_JacketFont;
})(Window_BaseJacketSlot);
var Window_JacketBack = /** @class */ (function (_super) {
  __extends(Window_JacketBack, _super);
  function Window_JacketBack(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketBack.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 200; i < 250; i++) {
      var armor = $dataArmors[i];
      if (armor.name.length > 0) {
        this._itemList.push(armor);
      }
    }
  };
  Window_JacketBack.prototype.initMask = function () {};
  Window_JacketBack.prototype.itemHeight = function () {
    return 50;
  };
  Window_JacketBack.prototype.refresh = function () {
    this._windowContentsSprite.removeChildren();
    _super.prototype.refresh.call(this);
  };
  Window_JacketBack.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(true);
    rect.x += 40;
    this.drwaBackground(rect, armor);
    this.drawText(this.armorName(armor), rect.x, rect.y, 160);
    if (this._avJacket.backItemId() == armor.id) {
      this.drawEquip(rect.y);
    }
  };
  Window_JacketBack.prototype.drwaBackground = function (rect, armor) {
    var backId = parseInt(armor.meta["back"]);
    var t = PIXI.utils.TextureCache["back_" + backId.padZero(3) + ".png"];
    if (!t) {
      return;
    }
    var f = new Rectangle(t.frame.x, t.frame.y + 260, t.frame.width, 48 * 2);
    var t2 = new PIXI.Texture(t.baseTexture, f);
    var s = new PIXI.Sprite(t2);
    s.scale.x = 0.5;
    s.scale.y = 0.5;
    s.x = rect.x + 174;
    if (ConfigManager.language == "en") {
      s.x += 56;
    }
    s.y = rect.y + 10;
    this._windowContentsSprite.addChild(s);
  };
  Window_JacketBack.prototype.isEnabled = function (item) {
    return true;
  };
  Window_JacketBack.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketBack.prototype.autoSelect = function () {
    var num = 0;
    for (var i = 200; i < 250; i++) {
      var armor = $dataArmors[i];
      if (armor.name.length > 0) {
        if (armor.meta["back"]) {
          num++;
        }
      }
    }
    var pre = this._itemList.length - num;
    this.select(Math.randomInt(num) + pre);
  };
  return Window_JacketBack;
})(Window_BaseJacketSlot);
var Window_JacketLayout = /** @class */ (function (_super) {
  __extends(Window_JacketLayout, _super);
  function Window_JacketLayout(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketLayout.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 350; i < 380; i++) {
      var armor = $dataArmors[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
  };
  Window_JacketLayout.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    if (this.isSelectedItem(armor.id)) {
      this.drawEquip(rect.y);
    }
    this.drawText(this.armorName(armor), rect.x, rect.y, 300);
  };
  Window_JacketLayout.prototype.isInclude = function (armor) {
    if (armor.name.length == 0) {
      return false;
    }
    return true;
  };
  Window_JacketLayout.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketLayout.prototype.isSelectedItem = function (id) {
    var armor = $dataArmors[id];
    if (armor.meta["layout"]) {
      var layout = parseInt(armor.meta["layout"]);
      return this._avJacket.layout() == layout;
    }
    if (armor.meta["thumbnail"]) {
      return this._avJacket.isThumbnail();
    }
    return false;
  };
  Window_JacketLayout.prototype.autoSelect = function () {
    var candidates = [];
    for (var _i = 0, _a = this._itemList; _i < _a.length; _i++) {
      var armor_1 = _a[_i];
      if (armor_1.meta["layout"]) {
        var layout = parseInt(armor_1.meta["layout"]);
        if (layout == 21 || layout == 22) {
          // 画像のみは出現率低め
          candidates.push(armor_1);
        } else {
          candidates.push(armor_1);
          candidates.push(armor_1);
        }
      }
    }
    var armor = candidates[Math.randomInt(candidates.length)];
    for (var i = 0; i < this._itemList.length; i++) {
      var item = this._itemList[i];
      if (item == armor) {
        this.select(i);
        return;
      }
    }
  };
  Window_JacketLayout.prototype.autoSelect2Panel = function () {
    var candidates = [];
    for (var i = 300; i < 400; i++) {
      var armor = $dataArmors[i];
      if (this.is2PanelLayout(armor)) {
        if (armor.meta["layout"]) {
          candidates.push(armor);
        }
      }
    }
    if (candidates.length == 0) {
      return;
    }
    var dice = Math.randomInt(candidates.length);
    var layout = candidates[dice];
    var index = this._itemList.indexOf(layout);
    this.select(index);
  };
  Window_JacketLayout.prototype.is2PanelLayout = function (armor) {
    var layout = parseInt(armor.meta["layout"]);
    switch (layout) {
      case 11:
      case 13:
        return true;
    }
    return false;
  };
  Window_JacketLayout.prototype.itemRect = function (index) {
    var r = _super.prototype.itemRect.call(this, index);
    if (index >= 11) {
      r.y += 20;
    }
    return r;
  };
  Window_JacketLayout.prototype.isEnabled = function (armor) {
    if (armor.meta["layout"]) {
      return true;
    }
    if (!this._avJacket.isActorOnlyLayout()) {
      return false;
    }
    return true;
  };
  return Window_JacketLayout;
})(Window_BaseJacketSlot);
var Window_JacketAuto = /** @class */ (function (_super) {
  __extends(Window_JacketAuto, _super);
  function Window_JacketAuto(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketAuto.prototype.initMask = function () {};
  Window_JacketAuto.prototype.itemRect = function (index) {
    var r = _super.prototype.itemRect.call(this, index);
    if (index >= 7) {
      r.y += 15;
    }
    if (index >= 14) {
      r.y += 15;
    }
    return r;
  };
  Window_JacketAuto.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 330; i < 350; i++) {
      var armor = $dataArmors[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
  };
  Window_JacketAuto.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    if (this.isSelectedItem(armor)) {
      this.drawEquip(rect.y);
    }
    this.drawTextEx(
      "\\C[0]" + this.armorName(armor) + "\\C[0]",
      rect.x,
      rect.y,
      200
    );
  };
  Window_JacketAuto.prototype.isInclude = function (armor) {
    if (armor.name.length == 0) {
      return false;
    }
    return true;
  };
  Window_JacketAuto.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketAuto.prototype.isSelectedItem = function (armor) {
    if (!armor.meta["fixType"]) {
      return false;
    }
    var fixedType = parseInt(armor.meta["fixType"]);
    return this._avJacket.isFixed(fixedType);
  };
  Window_JacketAuto.prototype.autoSelect = function () {
    this.select(Math.randomInt(this._itemList.length));
  };
  return Window_JacketAuto;
})(Window_BaseJacketSlot);
var Window_JacketParts = /** @class */ (function (_super) {
  __extends(Window_JacketParts, _super);
  function Window_JacketParts(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketParts.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 400; i < 430; i++) {
      var armor = $dataArmors[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
  };
  Window_JacketParts.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    if (this.isSelectedItem(armor.id)) {
      this.drawEquip(rect.y);
    }
    this.drawTextEx(
      "\\C[0]" + this.armorName(armor) + "\\C[0]",
      rect.x,
      rect.y,
      200
    );
  };
  Window_JacketParts.prototype.isInclude = function (armor) {
    if (armor.name.length == 0) {
      return false;
    }
    return true;
  };
  Window_JacketParts.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketParts.prototype.isSelectedItem = function (id) {
    return this._avJacket.hasParts(id);
  };
  Window_JacketParts.prototype.autoSelect = function () {
    this.select(Math.randomInt(this._itemList.length));
  };
  Window_JacketParts.prototype.randomArrow = function () {
    var candidates = [];
    for (var _i = 0, _a = this._itemList; _i < _a.length; _i++) {
      var armor = _a[_i];
      if (parseInt(armor.meta["group"]) == 1) {
        candidates.push(armor.id);
      }
    }
    var dice = Math.randomInt(candidates.length);
    return candidates[dice];
  };
  Window_JacketParts.prototype.randomIcon = function () {
    var candidates = [];
    for (var _i = 0, _a = this._itemList; _i < _a.length; _i++) {
      var armor = _a[_i];
      if (parseInt(armor.meta["group"]) == 11) {
        candidates.push(armor.id);
      }
    }
    var dice = Math.randomInt(candidates.length);
    return candidates[dice];
  };
  return Window_JacketParts;
})(Window_BaseJacketSlot);
var Window_JacketTextInput = /** @class */ (function (_super) {
  __extends(Window_JacketTextInput, _super);
  function Window_JacketTextInput(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketTextInput.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 430; i < 440; i++) {
      var armor = $dataArmors[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
  };
  Window_JacketTextInput.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    if (this.isChecked(armor.id)) {
      this.drawEquip(rect.y);
    }
    if (armor.id == 431 || armor.id == 434) {
      this.contents.textColor = ColorManager.crisisColor();
    } else {
      this.contents.textColor = ColorManager.normalColor();
    }
    this.drawText("" + this.armorName(armor) + "", rect.x, rect.y, 334);
  };
  Window_JacketTextInput.prototype.armorName = function (armor) {
    if (armor.id == 431) {
      var text = this._avJacket.avText().originalText1().text();
      if (text && text.length > 0) {
        return text;
      }
    }
    if (armor.id == 434) {
      var text = this._avJacket.avText().originalText2().text();
      if (text && text.length > 0) {
        return text;
      }
    }
    return _super.prototype.armorName.call(this, armor);
  };
  Window_JacketTextInput.prototype.isInclude = function (armor) {
    if (armor.name.length == 0) {
      return false;
    }
    return true;
  };
  Window_JacketTextInput.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketTextInput.prototype.autoSelect = function () {
    this.select(Math.randomInt(this._itemList.length));
  };
  Window_JacketTextInput.prototype.isChecked = function (armorId) {
    switch (armorId) {
      case 431:
        return false;
      case 432:
        return this._avJacket.avText().originalText1().isEnabled();
      case 433:
        return !this._avJacket.avText().originalText1().isEnabled();
      case 434:
        return false;
      case 435:
        return this._avJacket.avText().originalText2().isEnabled();
      case 436:
        return !this._avJacket.avText().originalText2().isEnabled();
    }
    return false;
  };
  Window_JacketTextInput.prototype.isEnabled = function (armor) {
    switch (armor.id) {
      case 432:
        return !this._avJacket.avText().originalText1().isEmpty();
      case 435:
        return !this._avJacket.avText().originalText2().isEmpty();
    }
    return true;
  };
  return Window_JacketTextInput;
})(Window_BaseJacketSlot);
var Window_JacketMan = /** @class */ (function (_super) {
  __extends(Window_JacketMan, _super);
  function Window_JacketMan(type, avJacket) {
    var _this = _super.call(this, type) || this;
    _this._avJacket = avJacket;
    return _this;
  }
  Window_JacketMan.prototype.makeItemList = function () {
    this._itemList = [];
    for (var i = 440; i < 450; i++) {
      var armor = $dataArmors[i];
      if (this.isInclude(armor)) {
        this._itemList.push(armor);
      }
    }
    var actorId = this._avJacket.manActor().actorId();
    if (actorId == 18 || actorId == 21) {
      // ヨシオとオリバー
      var ids_3 = [960, 961, 1011, 1015, 1016];
      for (var _i = 0, ids_1 = ids_3; _i < ids_1.length; _i++) {
        var id = ids_1[_i];
        var armor = $dataArmors[id];
        this._itemList.push(armor);
      }
      return;
    }
    var ids = [980, 981, 982, 1011, 1015, 1016];
    for (var _a = 0, ids_2 = ids; _a < ids_2.length; _a++) {
      var id = ids_2[_a];
      var armor = $dataArmors[id];
      if (this._avJacket.manActor().canEquip(armor)) {
        this._itemList.push(armor);
      }
    }
    if (this._avJacket.isManCosEnabled()) {
      this._itemList.push($dataArmors[960]);
      this._itemList.push($dataArmors[961]);
      for (var i = 987; i < 990; i++) {
        var armor = $dataArmors[i];
        if (this._avJacket.manActor().canEquip(armor)) {
          this._itemList.push(armor);
        }
      }
      for (var i = 800; i < 815; i++) {
        var armor = $dataArmors[i];
        this._itemList.push(armor);
      }
      for (var i = 836; i < 839; i++) {
        var armor = $dataArmors[i];
        this._itemList.push(armor);
      }
    } else if (
      this._avJacket.manActor().actorId() == 22 ||
      this._avJacket.manActor().actorId() == 2
    ) {
      this._itemList.push($dataArmors[960]);
      this._itemList.push($dataArmors[961]);
    }
  };
  Window_JacketMan.prototype.drawItem = function (index) {
    var armor = this._itemList[index];
    var rect = this.itemRect(index);
    this.changePaintOpacity(this.isEnabled(armor));
    rect.x += 40;
    if (this.isChecked(armor.id)) {
      this.drawEquip(rect.y);
    }
    if (armor.meta["manLayout"]) {
      this.contents.textColor = ColorManager.normalColor();
    } else if (armor.meta["manZIndex"]) {
      this.contents.textColor = ColorManager.systemColor();
    } else if (armor.meta["face"]) {
      this.contents.textColor = ColorManager.textColor(6);
    } else if (armor.meta["outer"]) {
      this.contents.textColor = ColorManager.textColor(23);
    } else if (armor.meta["hoppe"]) {
      this.contents.textColor = ColorManager.textColor(12);
    } else if (armor.meta["pose"]) {
      this.contents.textColor = ColorManager.textColor(12);
    } else {
      this.contents.textColor = ColorManager.normalColor();
    }
    this.drawText("" + this.armorName(armor) + "", rect.x, rect.y, 334);
  };
  Window_JacketMan.prototype.armorName = function (armor) {
    return _super.prototype.armorName.call(this, armor);
  };
  Window_JacketMan.prototype.isInclude = function (armor) {
    if (armor.name.length == 0) {
      return false;
    }
    return true;
  };
  Window_JacketMan.prototype.selectedItem = function () {
    return this._itemList[this.index()];
  };
  Window_JacketMan.prototype.autoSelect = function () {
    this.select(Math.randomInt(3));
    var cos = this._avJacket.manCos();
    if (!cos) {
      return;
    }
    var outerId = Math.randomInt(2) == 0 ? "a" : "b";
    cos.setOuterId(outerId);
    var ids = [1011, 1015, 1016];
    var acceId = ids[Math.randomInt(3)];
    if (!cos.hasAcce(acceId)) {
      cos.setAcceId(acceId);
    }
    if (this._avJacket.isManCosEnabled()) {
      cos.setFaceId(Math.randomInt(15) + 1);
      cos.setHoppeId(Math.randomInt(3) + 1);
    }
  };
  Window_JacketMan.prototype.isChecked = function (armorId) {
    return (
      this.isCheckedManLayout(armorId) ||
      this.isCheckedManOuter(armorId) ||
      this.isCheckedManZIndex(armorId) ||
      this.isCheckedManFace(armorId) ||
      this.isCheckedManHoppe(armorId) ||
      this.isCheckedManAcce(armorId) ||
      this.isCheckedManPose(armorId) ||
      this.isCheckedManInner(armorId)
    );
  };
  Window_JacketMan.prototype.isCheckedManLayout = function (armorId) {
    var manLayout = $dataArmors[armorId].meta["manLayout"];
    if (!manLayout) {
      return;
    }
    var manLayoutNum = parseInt(manLayout);
    return this._avJacket.manLayout() == manLayoutNum;
  };
  Window_JacketMan.prototype.isCheckedManZIndex = function (armorId) {
    var manZIndex = $dataArmors[armorId].meta["manZIndex"];
    if (!manZIndex) {
      return;
    }
    var manZIndexNum = parseInt(manZIndex);
    return this._avJacket.manZIndex() == manZIndexNum;
  };
  Window_JacketMan.prototype.isCheckedManOuter = function (armorId) {
    var outer = $dataArmors[armorId].meta["outer"];
    if (!outer) {
      return;
    }
    var cos = this._avJacket.manCos();
    return cos.outerId() == outer;
  };
  Window_JacketMan.prototype.isCheckedManFace = function (armorId) {
    var face = $dataArmors[armorId].meta["face"];
    if (!face) {
      return;
    }
    var cos = this._avJacket.manCos();
    return cos.faceId() == parseInt(face);
  };
  Window_JacketMan.prototype.isCheckedManHoppe = function (armorId) {
    var hoppe = $dataArmors[armorId].meta["hoppe"];
    if (!hoppe) {
      return;
    }
    var cos = this._avJacket.manCos();
    return cos.hoppeId() == parseInt(hoppe);
  };
  Window_JacketMan.prototype.isCheckedManPose = function (armorId) {
    var pose = $dataArmors[armorId].meta["pose"];
    if (!pose) {
      return;
    }
    var cos = this._avJacket.manCos();
    return cos.poseId() == parseInt(pose);
  };
  Window_JacketMan.prototype.isCheckedManInner = function (armorId) {
    var innerBottom = $dataArmors[armorId].meta["innerBottom"];
    if (!innerBottom) {
      return;
    }
    var cos = this._avJacket.manCos();
    return cos.innerBottomId() == innerBottom;
  };
  Window_JacketMan.prototype.isCheckedManAcce = function (armorId) {
    var acce = $dataArmors[armorId].meta["acce"];
    if (!acce) {
      return;
    }
    var cos = this._avJacket.manCos();
    return cos.hasAcce(armorId);
  };
  return Window_JacketMan;
})(Window_BaseJacketSlot);

repo_name: onms/dead

license: unknown


code:
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 Window_MakeAvJacket = /** @class */ (function (_super) {
  __extends(Window_MakeAvJacket, _super);
  function Window_MakeAvJacket(screenShot) {
    var _this = this;
    var r = new Rectangle(830, 0, 380, 120);
    _this = _super.call(this, r) || this;
    _this._avSprite = new Sprite_AvScreenShotPreview(screenShot);
    _this._avSprite.x = 14;
    _this._avSprite.y = 14;
    _this.addChild(_this._avSprite);
    _this.contents.fontSize = 22;
    _this.drawText(TextManager.shootJacket1, 160, 10, 180);
    _this.drawText(TextManager.shootJacket2, 160, 40, 180);
    _this._waitTime = 60;
    return _this;
  }
  Window_MakeAvJacket.prototype.update = function () {
    _super.prototype.update.call(this);
    this.updateFade();
    this.updateWait();
  };
  Window_MakeAvJacket.prototype.updateWait = function () {
    if (this._waitTime > 0) {
      this._waitTime--;
      if (this._waitTime == 0) {
        this._fadeTime = this.maxFadeTime();
      }
    }
  };
  Window_MakeAvJacket.prototype.maxFadeTime = function () {
    return 40;
  };
  Window_MakeAvJacket.prototype.updateFade = function () {
    if (this._fadeTime > 0) {
      this._fadeTime--;
      this.opacity = (this._fadeTime / this.maxFadeTime()) * 255;
      this._avSprite.opacity = this.opacity;
      this.contentsOpacity = this.opacity;
      if (this._fadeTime == 0) {
        if (this.parent) {
          this.parent.removeChild(this);
          this.destroy();
        }
      }
    }
  };
  return Window_MakeAvJacket;
})(Window_Base);
Window_Message.prototype.isTriggered = function () {
  if (isSkipKey()) {
    return true;
  }
  if ($gameSystem.isEroEvent()) {
    if (TouchInput.isRepeated()) {
      if (TouchInput.x > 1200) {
        if (TouchInput.y < 50) {
          // 撮影ボタンでメッセージ送りにしない処理
          return false;
        }
      }
    }
  }
  return (
    Input.isRepeated("ok") ||
    Input.isRepeated("cancel") ||
    TouchInput.isRepeated()
  );
};
var Sprite_AvScreenShotPreview = /** @class */ (function (_super) {
  __extends(Sprite_AvScreenShotPreview, _super);
  function Sprite_AvScreenShotPreview(ss) {
    var _this = _super.call(this) || this;
    _this._ss = ss;
    if (!ss) {
      console.error("ss is null");
    }
    _this.makeJacket();
    return _this;
  }
  Sprite_AvScreenShotPreview.prototype.makeJacket = function () {
    var renderTexture = $gameTemp.getActorBitmapBodyCache(1);
    var ss = new PIXI.Sprite();
    //this._sprite = new PIXI.Sprite();
    //this.addChild(this._sprite);
    var list = this._ss.eroImageList();
    if (list.length == 0) {
      console.error("撮影するものがありません");
      return;
    }
    for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
      var file = list_1[_i];
      var f = "av_" + file;
      var t = PIXI.utils.TextureCache[f];
      if (!t) {
        console.error(f + "のAV Jacketファイルが見つかりません");
        continue;
      }
      var s = new PIXI.Sprite(t);
      ss.addChild(s);
      if ($gameVariables.value(49) > 0) {
        if (t.textureCacheIds.length > 0) {
          if (t.textureCacheIds[0].includes("man")) {
            var s2 = new PIXI.Sprite(t);
            ss.addChild(s2);
            setManColorFilter($gameVariables.value(49), s2);
          }
        }
      }
    }
    try {
      var renderer = Graphics.app.renderer;
      renderer.render(ss, renderTexture);
      var sprite = new PIXI.Sprite(renderTexture);
      this._sprite = sprite;
      this.addChild(this._sprite);
    } catch (e) {
      console.error(e);
    }
  };
  Sprite_AvScreenShotPreview.prototype.spriteHight = function () {
    return 92;
  };
  Sprite_AvScreenShotPreview.prototype.destroy = function () {
    this.removeChild(this._sprite);
    _super.prototype.destroy.call(this);
  };
  return Sprite_AvScreenShotPreview;
})(Sprite);