const PN_ShopWin = PN_Layer1 + 5;
const PN_IBtn = PN_ShopWin + 1;
const PN_INameTxt = PN_IBtn + 8;
const PN_IValTxt = PN_INameTxt + 8;
const PN_IIco = PN_IValTxt + 8;
const PN_ISelWin = PN_IIco + 8;
const PN_ISelIco = PN_ISelWin + 1;
const PN_ISelName = PN_ISelIco + 2;
const PN_ISetuTxt = PN_ISelName + 3;
const PN_ICkWin = PN_Layer2 + 1;
const PN_ICkTxt = PN_ICkWin + 1;
const PN_ICkKosu = PN_ICkTxt + 1;
const PN_ICkRight = PN_ICkKosu + 1;
const PN_ICkLeft = PN_ICkRight + 1;
const PN_ICkGoldTxt = PN_ICkLeft + 1;
const PN_IGoldWin = 110;
const PN_IGoldTxt = PN_IGoldWin + 1;
const PN_IFuki = 157;
const PN_IFukiTxt = PN_IFuki + 1;
let _ShopType = null;
let ShopType = {
    アイテム: 1,
    ガン: 2
};
const ShopMaxDrawCount = 8;
//配列 [Type , アイテムNo , 個数(99で無限)]
let Shop保存 = Game_System.prototype.initialize;
Game_System.prototype.initialize = function () { 
    Shop保存.call(this);
    this.ItemShop = []; 
    this.ItemFZure = new Pos2D(0, 0); 
    this.ItemFuki = []; 
    this.GunShop = []; 
    this.GunFZure = new Pos2D(0, 0); 
    this.GunFuki = []; 
};
class SItm { 
    constructor(_Type, _No, _Cnt) {
        this._Type = _Type; //Typeは 0:アイテム , 1:武器 , 2:防具(装飾) となる
        this._No = _No; 
        this._Cnt = _Cnt; 
    }
}
let IType = {
    アイテム: 0,
    武器: 1,
    装飾: 2
};
class SFuki { 
    constructor(_Type, _Self1, _Self2, _Katati) {
        this._Type = _Type;
        this._Self1 = _Self1;
        this._Self2 = _Self2;
        this._Katati = _Katati;
    }
}
let Ftype = {
    初期: 1,
    確認: 2,
    購入: 3,
    不足: 4, 
    売切: 5, 
    定期: 6, 
    最大: 7　
};
let ItemShop_Reset = function () { 
    $gameSystem.ItemShop = [];
}
let ItemShop_Set = function (_Type, _No, _Cnt) { 
    _Cnt = typeof _Cnt !== 'undefined' ? _Cnt : 99; 
    let _SetItm = new SItm(_Type, _No, _Cnt);
    $gameSystem.ItemShop.push(_SetItm);
}
let ItemShop_Add = function (_Type, _No, _Cnt) {
    _newFlg = true;
    for (let i = 0; i <= $gameSystem.ItemShop.length - 1; i++) {
        if ($gameSystem.ItemShop[i]._Type == _Type) {
            if ($gameSystem.ItemShop[i]._No == _No) {
                $gameSystem.ItemShop[i]._Cnt += _Cnt;
                _newFlg = false;
            }
        }
    }
    if (_newFlg) {
        let _SetItm = new SItm(_Type, _No, _Cnt);
        $gameSystem.ItemShop.push(_SetItm);
    }
}
let ItemFuki_ReSet = function () { 
    $gameSystem.ItemFuki = [];
}
let ItemFuki_Zure = function (_SetX, _SetY) {
    _SetX = typeof _SetX !== 'undefined' ? _SetX : 0;
    _SetY = typeof _SetY !== 'undefined' ? _SetY : 0;
    $gameSystem.ItemFZure = new Pos2D(_SetX, _SetY);
}
let ItemFuki_Set = function (_Type, _Self1, _Self2, _吹形) { 
    _Self1 = typeof _Self1 !== 'undefined' ? _Self1 : "";
    _Self2 = typeof _Self2 !== 'undefined' ? _Self2 : "";
    _吹形 = typeof _吹形 !== 'undefined' ? _吹形 : 0;
    $gameSystem.ItemFuki.push(new SFuki(_Type, _Self1, _Self2, _吹形));
}
let GunShop_Reset = function () {
    $gameSystem.GunShop = [];
}
let GunShop_Set = function (_Type, _No, _Cnt) {
    _Cnt = typeof _Cnt !== 'undefined' ? _Cnt : 99;
    let _SetItm = new SItm(_Type, _No, _Cnt);
    $gameSystem.GunShop.push(_SetItm);
}
let GunShop_Add = function (_Type, _No, _Cnt) {
    let _newFlg = true;
    for (let i = 0; i <= $gameSystem.GunShop.length - 1; i++) {
        if ($gameSystem.GunShop[i]._Type == _Type) {
            if ($gameSystem.GunShop[i]._No == _No) {
                $gameSystem.GunShop[i]._Cnt += _Cnt;
                _newFlg = false;
            }
        }
    }
    if (_newFlg) {
        let _SetItm = new SItm(_Type, _No, _Cnt);
        $gameSystem.GunShop.push(_SetItm);
    }
}
let GunFuki_ReSet = function () { 
    $gameSystem.GunFuki = [];
}
let GunFuki_Zure = function (_SetX, _SetY) {
    _SetX = typeof _SetX !== 'undefined' ? _SetX : 0;
    _SetY = typeof _SetY !== 'undefined' ? _SetY : 0;
    $gameSystem.GunFZure = new Pos2D(_SetX, _SetY);
}
let GunFuki_Set = function (_Type, _Self1, _Self2, _吹形) { 
    _Self1 = typeof _Self1 !== 'undefined' ? _Self1 : "";
    _Self2 = typeof _Self2 !== 'undefined' ? _Self2 : "";
    _吹形 = typeof _吹形 !== 'undefined' ? _吹形 : 0;
    $gameSystem.GunFuki.push(new SFuki(_Type, _Self1, _Self2, _吹形));
}
let GetShopItemViewCount = function () {
    let rtnCnt = 0;
    for (let i = 0; i < $gameSystem.ItemShop.length; i++) {
        if ($gameSystem.ItemShop[i]._Cnt > 0) rtnCnt++;
    }
    return rtnCnt;
}
let ShopCBMap = [];
let _SType = 0; 
let ShopPic = "pictures/Adv/L1_Item/";
let shop_flame = 0;
let IPos = new Pos2D(694, 165);
let _ShopArr = []; 
let _ShopFuki = []; 
let _ShopFZure = new Pos2D(0, 0);
let _shopSelNo = 0; 
let _shopLayer = 0; 
let _shop_CN = 0; 
let _shopTcPic = []; 
let _GunShopFlg = false;
Game_Interpreter.prototype.Adv_L1ShopView = function (_SetSType, _No) {
    _No = typeof _No !== 'undefined' ? _No : 0; 
    _SType = _SetSType;
    shop_flame = 0;
    _shopSelNo = _No;
    _shopLayer = 0;
    _shopFタイミング = Ftype.初期;
    _shopFukiflame = 0;
    _shopFukiVNo = 0;
    switch (_SType) {
        case ShopType.アイテム:
            ShopPic = "pictures/Adv/L1_Item/";
            _shop_CN = 20;
            _GunShopFlg = false;
            _ShopArr = $gameSystem.ItemShop.slice();
            _ShopFuki = $gameSystem.ItemFuki.slice();
            _ShopFZure = $gameSystem.ItemFZure;
            break;
        case ShopType.ガン:
            ShopPic = "pictures/Adv/L1_GunShop/";
            _shop_CN = 21;
            _GunShopFlg = true;
            _ShopArr = $gameSystem.GunShop.slice();
            _ShopFZure = $gameSystem.GunFZure;
            _ShopFuki = $gameSystem.GunFuki.slice();
            break;
    }
    ShopCBMap = [];
    this.DelPictSpan(PN_INameTxt , PN_ISelWin - 1);
    for (let i = 0; i <= _ShopArr.length - 1; i++) {
        if (_ShopArr[i]._Cnt == 0) {
            _ShopArr.splice(i , 1);
            i--;
        }
    }
    _ShopArr.sort((a, b) => a._No - b._No);
    _ShopArr.sort((a, b) => a._Type - b._Type);
    for (let i = 0; i <= _ShopArr.length - 1; i++) {
        let _SetX = IPos._x;
        let _SetY = IPos._y + (45 * i);
        if (i == 0) {
            this.MovePict(PN_AdvSell, _SetX - 27, _SetY + 17 + (45 * _shopSelNo), 5); 
            this.Adv_L1Shop_SelDraw();
        }
        _ShopGetSel(_ShopArr[i]._Type, _ShopArr[i]._No);
        D_Text_Cng_font = "Makinas"; 
        let _OW = "\\oc[rgba(0,0,0,1)]";
        let _SetStr = _OW + "\\I[" + _SelIco + "] " + _SetName + "";
        if (_ShopArr[i]._Cnt != -1 && !_GunShopFlg) {
            _SetStr += "（Stock:" + _ShopArr[i]._Cnt + "）";
        }
        let _MoneyLowFlg = _SetPrice > $gameParty._gold;
        let _vOpi = 255;
        if (_MoneyLowFlg) _vOpi = 190;
        if (_ShopArr[i]._Cnt == 0) _vOpi = 150;
        if (_SetStr.indexOf(".Lv") != -1) {
            _SetStr = _SetStr.replace(".Lv", "Modify(Lv") + ")";
            this.SetPicStr(PN_INameTxt + i, _SetStr, 25, _SetX, _SetY, _vOpi);
        } else {
            this.SetPicStr(PN_INameTxt + i, _SetStr, 25, _SetX, _SetY, _vOpi);
        }
        this.SetPicStr(PN_IValTxt + i, _OW + "Price: " + _SetPrice + "B ", 25, _SetX + 400, _SetY, _vOpi);
        ShopCBMap.push([683, 162 + (45 * i), 636, 35]);
        D_Text_Cng_font = ""; 
        if (i == ShopMaxDrawCount - 1) break; 
    }
    this.Adv_SpGold();
}
Game_Interpreter.prototype.Adv_SpGold = function () {
    D_Text_Cng_font = "Makinas"; 
    this.SetPict(PN_IGoldWin, AdvPic + "PN_IGoldWin", 0, 0, 0);
    this.MovePict(PN_IGoldWin, true, true, 10);
    let _Gold = $gameParty._gold;
    this.SetPicStrR(PN_IGoldTxt, _Gold + "B", 30, 658, 26, 0);
    this.MovePict(PN_IGoldTxt, true, true, 10);
    D_Text_Cng_font = ""; 
}
let _ShopEnd_flame = 0;
let _ShopStopFlg = false;
Game_Interpreter.prototype.Adv_L1ShopUpdate = function (_ReFlg) {
    _ReFlg = typeof _ReFlg !== 'undefined' ? _ReFlg : false; 
    if (this.PicObjGet(PN_IGoldWin) == null) {
        this.Adv_SpGold();
    }
    if (_ShopStopFlg) {
        this.Shop_FukiDel();
        return;
    }
    if (_ShopEnd_flame > 0) {
        _ShopEnd_flame--;
        if (_ShopEnd_flame == 0) {
            this.Adv_L0_Back();
            this.Adv_SpGold();
        }
        return;
    }
    //this.SetCmnEventSc(_shop_CN); //Script :: コモンイベントの発生
    switch (_shopLayer) {
        case 0: 
            let _mvFlg = false;
            if (shop_flame > 5) { 
                if (Input.isTriggered('up')) {
                    _shopSelNo--;
                    _mvFlg = true;
                }
                if (Input.isTriggered('down')) {
                    _shopSelNo++;
                    _mvFlg = true;
                }
                let _CNo = overPicClickable(PN_l1Back, ShopCBMap); 
                if (_CNo != -1 && _shopSelNo != _CNo) {
                    _mvFlg = true;
                    _shopSelNo = _CNo;
                }
                if (Input.isTriggered('ok') || (TouchInput.isTriggered() && _CNo != -1)) {
                    this.Adv_L1Shop_YNView();
                }
                if (Input.isTriggered('escape') || TouchInput.isCancelled()) { 
                    this.DelPictSpan(PN_IFuki, PN_IFukiTxt + 1);
                    _ShopEnd_flame = 5; 
                    _ShopStopFlg = true;
                    switch (_SType) {
                        case ShopType.アイテム: 
                            this.JN_EventLoad("アイテム_退店", true);
                            break;
                        case ShopType.ガン: 
                            this.JN_EventLoad("ガン_退店", true);
                            break;
                    }
                }
            }
            if (_ReFlg) _mvFlg = true;
            if (_mvFlg) { 
                SoundManager.playCursor();
                this.ShopCursolMove();
            }
            break;
        case 1: 
            this.Adv_L1Shop_YNUpdate();
            break;
    }
    this.Shop_FukiUpdate(); 
    shop_flame++;
}
Game_Interpreter.prototype.ShopCursolMove = function () {
    let maxSelNo = _ShopArr.length - 1;
    if (maxSelNo >= ShopMaxDrawCount) maxSelNo = ShopMaxDrawCount - 1;
    if (_shopSelNo < 0) _shopSelNo = 0;
    if (_shopSelNo >= maxSelNo) _shopSelNo = maxSelNo;
    let _SetX = IPos._x;
    let _SetY = IPos._y + (45 * _shopSelNo);
    this.MovePict(PN_AdvSell, _SetX - 27, _SetY + 17, 5); 
    this.Adv_L1Shop_SelDraw();
}
let _shopFukiflame = 0;
let _shopFukiVNo = 0; 
let _shopSelfArr = []; 
let _shopFタイミング = Ftype.初期;
let _shopFBPos = new Pos2D(245, 324);
const shopFukiPic = "pictures/Adv/Fuki_Shop/"
const _shopCngFlame = 180; 
Game_Interpreter.prototype.Shop_FukiUpdate = function () {
    if (_ShopStopFlg) {
        this.Shop_FukiDel();
        return;
    }
    if (_shopFukiflame == 0) { 
        _shopSelfArr = []; 
        for (let i = 0; i <= _ShopFuki.length - 1; i++) {
            if (_shopFタイミング == _ShopFuki[i]._Type) {
                _shopSelfArr.push(_ShopFuki[i]);
            }
        }
        if (_shopFukiVNo <= _shopSelfArr.length - 1) {
            let _FukiImg = "PN_IFuki_" + _shopSelfArr[_shopFukiVNo]._Katati;
            let _SPos = new Pos2D(_shopFBPos._x + _ShopFZure._x, _shopFBPos._y + _ShopFZure._y);
            this.SetPictFIn(PN_IFuki, shopFukiPic + _FukiImg, _SPos._x, _SPos._y, 0, 0, 10);
            let _setMoji = [];
            _setMoji.push([SCol.Blk0 + _shopSelfArr[_shopFukiVNo]._Self1, 22]);
            _setMoji.push([SCol.Blk0 + _shopSelfArr[_shopFukiVNo]._Self2, 22]);
            D_Text_Cng_font = "Makinas"; 
            this.SetPicStrArr(PN_IFukiTxt, _setMoji, _SPos._x + 54, _SPos._y + 56, 0);
            this.MovePict(PN_IFukiTxt, true, true, 5, 255);
            D_Text_Cng_font = ""; 
            _shopFukiVNo++;
        }
    }
    if (_shopFukiflame == _shopCngFlame) {
        if (_shopFタイミング == Ftype.定期) {
            this.MovePict(PN_IFuki, true, true, 5, 0);
            this.MovePict(PN_IFukiTxt + 0, true, true, 5, 0);
            this.MovePict(PN_IFukiTxt + 1, true, true, 5, 0);
        } else {
            this.Shop_TypeSet(Ftype.定期);
        }
        _shopFukiflame = -1; 
    }
    _shopFukiflame++;
}
Game_Interpreter.prototype.Shop_FukiDel = function () {
    this.DelPictSpan(PN_IFuki, PN_IFukiTxt + 1);
}
Game_Interpreter.prototype.Shop_TypeSet = function (_Type) {
    _shopFukiflame = 0;
    if (_shopFタイミング == _Type) {
    } else {
        _shopFタイミング = _Type;
        _shopFukiVNo = 0;
    }
}
let _sYNSel = 0;
let _ItmGetCnt = 0;
Game_Interpreter.prototype.Adv_L1Shop_YNView = function () {
    _ItmGetCnt = 1;
    if (_ShopArr.length == 0) { 
        return;
    }
    _ShopGetSel(_ShopArr[_shopSelNo]._Type, _ShopArr[_shopSelNo]._No);
    if ($gameParty._gold < _SetPrice) {
        this.Shop_TypeSet(Ftype.不足);
        return;
    }
    if (_ShopArr[_shopSelNo]._Cnt == 0) {
        this.Shop_TypeSet(Ftype.売切);
        return;
    }
    this.Shop_TypeSet(Ftype.確認);
    _shopLayer = 1;
    _sYNSel = 0;
    D_Text_Cng_font = "Makinas"; 
    this.SetPictFIn(PN_ICkWin, ShopPic + "PN_ICkWin", 0, 0, 0, 0, 10);
    let _oc = "\\oc[rgb(0,0,0)]\\ow[5]";
    let _在庫Str = "　";
    if (!_GunShopFlg) {
        _在庫Str = "（Stock:" + _ShopArr[_shopSelNo]._Cnt + "） ";
        this.SetPictFIn(PN_ICkRight, ShopPic + "PN_ICkRight", 0, 0, 0, 0, 10);
        this.SetPictFIn(PN_ICkLeft, ShopPic + "PN_ICkLeft", 0, 0, 0, 0, 10);
        this.SetPicStrC(PN_ICkKosu, " " + _oc + _ItmGetCnt + " ", 42, 993, 398, 0);
        this.SetPicStrC(PN_ICkGoldTxt, " " + (_ItmGetCnt * _SetPrice) + "G ", 22, 993, 433, 0);
        this.MovePict(PN_ICkKosu, true, true, 10);
    } else {
        this.SetPicStrC(PN_ICkGoldTxt, " " + _oc + (_ItmGetCnt * _SetPrice) + "G ", 22, 993, 395, 0);
        this.MovePict(PN_ICkGoldTxt, true, true, 10);
    }
    this.SetPicStrC(PN_ICkTxt, "\\I[" + _SelIco + "] " + _SetName + _在庫Str, 25,
        909 + 80, 345, 0);
    this.MovePict(PN_ICkTxt, true, true, 10);
    D_Text_Cng_font = ""; 
    this.MovePict(PN_AdvSell, 756, 401 + 28, 5, 0); 
}
let _ShopYNCMap = [
    [829, 394, 123, 46],
    [829 + 162, 394, 123, 46]
];
let _ItmR_Prsflame = 0;
let _ItmL_Prsflame = 0;
Game_Interpreter.prototype.Adv_L1Shop_YNUpdate = function () {
    let _cngTxtFlg = false;
    this.PicCngColor(PN_ICkRight);
    if (overPointerCkTm(PN_ICkRight)) this.PicCngColor(PN_ICkRight, [100, 100, 100, 0]);
    let _RClickFlg = overPointerCkTm(PN_ICkRight) && TouchInput.isTriggered();
    if ((overPointerCkTm(PN_ICkRight) && TouchInput.isPressed()) || Input.isPressed('right')) {
        _ItmR_Prsflame++;
        if (_ItmR_Prsflame > 15) {
            if (_ItmR_Prsflame % 6 == 0) _RClickFlg = true;
        }
    } else {
        _ItmR_Prsflame = 0;
    }
    if ((_RClickFlg || Input.isTriggered('right')) && !_GunShopFlg) {
        if ((_ItmGetCnt + 1) * _SetPrice <= $gameParty._gold) {
            if (_ShopArr[_shopSelNo]._Cnt > _ItmGetCnt) {
                _ItmGetCnt++;
                _cngTxtFlg = true;
            }
        }
    }
    this.PicCngColor(PN_ICkLeft);
    if (overPointerCkTm(PN_ICkLeft)) this.PicCngColor(PN_ICkLeft, [100, 100, 100, 0]);
    let _LClickFlg = overPointerCkTm(PN_ICkLeft) && TouchInput.isTriggered();
    if ((overPointerCkTm(PN_ICkLeft) && TouchInput.isPressed()) || Input.isPressed('left')) {
        _ItmL_Prsflame++;
        if (_ItmL_Prsflame > 15) {
            if (_ItmL_Prsflame % 6 == 0) _LClickFlg = true;
        }
    } else {
        _ItmL_Prsflame = 0;
    }
    if ((_LClickFlg || Input.isTriggered('left')) && !_GunShopFlg) {
        if (_ItmGetCnt > 1) {
            _ItmGetCnt--;
            _cngTxtFlg = true;
        }
    }
    if (_cngTxtFlg) {
        let _oc = "\\oc[rgb(0,0,0)]\\ow[5]";
        this.SetPicStrC(PN_ICkKosu, " " + _oc + _ItmGetCnt + " ", 42, 993, 398, 255);
        this.SetPicStrC(PN_ICkGoldTxt, (_ItmGetCnt * _SetPrice) + "B", 22, 993, 433, 255);
    }
    _cngTxtFlg = _RClickFlg || _LClickFlg;
    let _ItmExitFlg = false;
    if (Input.isTriggered('ok') || TouchInput.isTriggered()) { 
        if (_sYNSel == 0 && !_cngTxtFlg) {
            _shopLayer = shop_flame = 0;
            _ItmExitFlg = true;
            let _SetX = IPos._x;
            let _SetY = IPos._y + (45 * _shopSelNo);
            this.SetPictC(PN_AdvSell, AdvPic + "PN_AdvSell", _SetX - 27, _SetY + 17, 255);
            switch (_ShopArr[_shopSelNo]._Type) {
                case 0: 
                    $gameParty._gold -= _SetPrice * _ItmGetCnt;
                    $gameParty.gainItem($dataItems[_ShopArr[_shopSelNo]._No], _ItmGetCnt)
                    _ShopArr[_shopSelNo]._Cnt -= _ItmGetCnt;
                    _ShopStopFlg = true;
                    this.JN_EventLoad("アイテム_購入", true);
                    break;
                case 1: 
                    $gameParty._gold -= _SetPrice * _ItmGetCnt;
                    $gameParty.gainItem($dataWeapons[_ShopArr[_shopSelNo]._No], _ItmGetCnt);
                    if (_ShopArr[_shopSelNo]._No % 5 != 1) {
                        if ($gameActors._data[1]._equips[0]._itemId == _ShopArr[_shopSelNo]._No - 1) {
                            $gameActors._data[1]._equips[0]._itemId = _ShopArr[_shopSelNo]._No; 
                        }
                        $gameParty.gainItem($dataWeapons[_ShopArr[_shopSelNo]._No - 1], -1); 
                    }
                    if (_ShopArr[_shopSelNo]._No % 5 != 0) {
                        _ShopArr[_shopSelNo]._No += 1;
                    } else {
                        _ShopArr[_shopSelNo]._Cnt -= _ItmGetCnt;
                    }
                    _ShopStopFlg = true;
                    this.JN_EventLoad("ガン_購入", true);
                    break;
                case 2: //防具(装飾)：これはアイテム屋での購入とする
                    $gameParty._gold -= _SetPrice * _ItmGetCnt;
                    $gameParty.gainItem($dataArmors[_ShopArr[_shopSelNo]._No], _ItmGetCnt);
                    _ShopArr[_shopSelNo]._Cnt -= _ItmGetCnt;
                    _ShopStopFlg = true;
                    this.JN_EventLoad("アイテム_購入", true);
                    break;
            }
            this.Adv_L1ShopView(_SType, _shopSelNo);
            this.Adv_L2_PicDel(); 
            this.Adv_L1ShopUpdate(true); 
            this.Adv_SpGold();
        }
    }
    if (Input.isTriggered('escape') || TouchInput.isCancelled() || _ItmExitFlg) { 
        SoundManager.playCancel();
        _shopLayer = shop_flame = 0;
        this.Adv_L2_PicDel(); 
        this.Adv_L1ShopUpdate(true); 
        if (!_ShopStopFlg) {
            this.Shop_TypeSet(Ftype.定期);
        }
    }
}
let _SelIco = 0;
let _SetName = 0;
let _SetPrice = 0;
let _ShopGetSel = function (_Type, _No) {
    switch (_Type) {
        case 0: 
            _SelIco = $dataItems[_No].iconIndex;
            _SetName = $dataItems[_No].name;
            _SetPrice = Math.floor($dataItems[_No].price * ((100 - $gameVariables.value(VN_ショップ割引)) / 100));
            break;
        case 1: 
            _SelIco = $dataWeapons[_No].iconIndex;
            _SetName = $dataWeapons[_No].name;
            _SetPrice = Math.floor($dataWeapons[_No].price * ((100 - $gameVariables.value(VN_武器割引)) / 100));
            break;
        case 2: //防具(装飾)
            _SelIco = $dataArmors[_No].iconIndex;
            _SetName = $dataArmors[_No].name;
            _SetPrice = Math.floor($dataArmors[_No].price * ((100 - $gameVariables.value(VN_ショップ割引)) / 100));
            break;
    }
}
Game_Interpreter.prototype.Adv_L1Shop_SelDraw = function () {
    if (_ShopArr.length == 0) return;
    let _SetDescArr = []; 
    if (_shopSelNo >= _ShopArr.length) {
        _shopSelNo = _ShopArr.length - 1;
        this.ShopCursolMove();
    }
    switch (_ShopArr[_shopSelNo]._Type) {
        case 0: 
            _ShopGetSel(0, _ShopArr[_shopSelNo]._No);
            _SetDescArr = $dataItems[_ShopArr[_shopSelNo]._No].description.split(/\n/);
            _SetDescArr.unshift(MetaChecker($dataItems[_ShopArr[_shopSelNo]._No], "Effect", ""));
            break;
        case 1: 
            _ShopGetSel(1, _ShopArr[_shopSelNo]._No);
            let selectWeapon = $dataWeapons[_ShopArr[_shopSelNo]._No];
            _SetDescArr = selectWeapon.description.split(/\n/);
            _SetDescArr.unshift(MetaChecker(selectWeapon, "Effect", ""));
            if (_SetDescArr[0] == "") { 
                _SetDescArr[0] = "Cost：" + selectWeapon.params[1] + "　Attack：" + selectWeapon.params[2] + "　Hit：" + selectWeapon.params[4]
            }
            break;
        case 2: //防具(装飾)
            _ShopGetSel(2, _ShopArr[_shopSelNo]._No);
            _SetDescArr = $dataArmors[_ShopArr[_shopSelNo]._No].description.split(/\n/);
            _SetDescArr.unshift(MetaChecker($dataArmors[_ShopArr[_shopSelNo]._No], "Effect", ""));
            break;
    }
    let _SetX = IPos._x - 20;
    let _SetY = 631;
    D_Text_Cng_font = "Makinas"; 
    this.MovePict(PN_ISelIco, true, true, 1, 255, 200, 200);
    this.SetPicStr(PN_ISelName, "\\I[" + _SelIco + "] " + _SetName + "　" + String(_SetPrice) + "B ",
        25, _SetX + 5, _SetY + 0);
    this.DelPictSpan(PN_ISetuTxt, PN_ISetuTxt + 2);
    for (let i = 0; i <= _SetDescArr.length - 1; i++) {
        this.SetPicStr(PN_ISetuTxt + i, " " + _SetDescArr[i] + " ", 18, _SetX, _SetY + 44 + i * 23);
    }
    D_Text_Cng_font = ""; 
}
