Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Independent Equipment 给新手们写的打造装备系统

psb

图片格式为IDPD_Mess.png
以下是插件,共分为三部分
JavaScript:
//==================================================================================================================

 /*:

 * @plugindesc 独立装备(A:核心) 。

 * 

 * @author 腾讯QQ 2144972924

 * 

 * @help

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 1 插件命令:

 *IDPDRemake   进入装备改造场景。

 *

 *AddWeapon id qt sl  获得一件武器(id:武器ID;qt:武器品质;sl:武器初始插槽)

 *例:获得一件ID是 2,品质 3,插槽 1 的武器:AddWeapon 2 3 1

 *※不填后面的 品质 和 插槽 两项,当控制开关打开时,两项(品质+插槽)随机。比如:AddWeapon 2

 *

 *AddArmor id qt sl   获得一件防具(id:防具ID;qt:防具品质;sl:防具初始插槽)

 *例:同上。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 2 装备需要的打造材料备注:

 *  在武器/防具里备注:<XIEMts:id=num,id=num...>   (id:物品ID;num:该物品所需的个数)

 *  例:某装备需要 物品2,10个;物品5,2个。备注:<XIEMts:2=10,5=2>

 *         某装备需要 物品1,3个;物品2,4个;物品3,5个;物品4,6个。备注:<XIEMts:1=3,2=4,3=5,4=6>

 *

 *  ※未备注打造材料的装备,不列入打造列表。

 *

 *  ※未备注打造材料的装备,拆解时不会得到物品。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 3 装备等级限制备注:

 *  在武器/防具里备注:<XIELimit:level,num> 表示该装备的等级限制。(num:等级)

 *  例:某装备要求等级 10  :<XIELimit:level,10>

 *  不备注时,装备的默认等级是 1 。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 4 用于装备强化的物品备注:

 *   物品备注:<XIEStg>  表示该物品用于装备强化。

 *   系统只读取一种强化物品,所以不要备注多了。

 *   装备强化所需的物品个数,依装备的强化次数逐渐增多。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 5 用于装备升星的物品备注:

 *   物品备注:<XIESr:rate>  表示该物品用于装备强化。(rate:该物品增加的升星几率)

 *   例;备注一个升星几率为 100 的物品:<XIESr:100>

 *       备注一个升星几率为 50 的物品:<XIESr:50>

 *

 *   ※装备强化和升星,装备的一些 特性 参数也会根据设置的百分比提升。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 6 用于修复装备耐久度的物品备注:

 *   物品备注:<XIERepair:max>  表示该物品用于修复装备耐久。(max:表示该物品的最大修复量)

 *   例;备注一个修复 5 耐久的物品:<XIERepair:5>

 *       备注一个修复 20 耐久的物品:<XIERepair:20>

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 7 用于给装备增加插槽的物品备注:

 *   物品备注:<XIESlt>  表示该物品用于给装备增加插槽。

 *   系统也是读取一种增加插槽的物品,所以不要备注多了。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 8 装备所镶嵌的宝石物品备注:

 *   物品备注:<XIEGem>  表示该物品用于给装备镶嵌。

 *   若未备注,选择镶嵌时不会出现该物品。

 *----------------------------------------------------------------------------------------------------------------------------

 *■ 9 镶嵌的宝石类物品增加的属性设置:

 *   数据库-道具 -> 效果 -> 其他 -> 增长   项目里面刚好 8 项,对应角色 8 项属性。

 *   可以设置多个,比如 既增加最大HP100,又增加攻击50......。

 *   其他的项目设置和增长无关联。

 *----------------------------------------------------------------------------------------------------------------------------

 *@param ■ 控制 ■ 

 * @param cnSwitch

 * @desc 控制装备随机品质和插槽的开关。开关关闭时装备为普通品质,0插槽;开关打开时随机。

 * @default 20

 *--------------------------------------------------------------

 * @param qtRate

 * @desc 品质增幅装备各属性的百分比。

 * @default 10

 *--------------------------------------------------------------

 * @param starRate

 * @desc 升星次数增幅装备各属性的百分比。

 * @default 8

 *--------------------------------------------------------------

 * @param stgRate

 * @desc 强化次数增幅装备各属性的百分比。

 * @default 5

 *--------------------------------------------------------------

 * @param starMax

 * @desc 初始最大升星次数。

 * @default 20

 *--------------------------------------------------------------

 * @param dbtBase

 * @desc 耐久度基础值(实际耐久度会根据装备品质有一定增加,并上下浮动)。

 * @default 30

 *--------------------------------------------------------------

 *@param ■ 金钱 ■

 * @param makeGold

 * @desc 打造装备金钱是装备价格的百分比。

 * @default 50

 *--------------------------------------------------------------

 * @param dabGold

 * @desc 装备拆解金钱是装备价格的百分比。

 * @default 10

 *--------------------------------------------------------------

 * @param rprGold

 * @desc 装备每修复一点耐久所需金钱是装备价格的百分比。。

 * @default 5

 *--------------------------------------------------------------

 * @param stgGold

 * @desc 装备强化所需金钱基数。算式:强化次数 x 基数。

 * @default 100

 *--------------------------------------------------------------

 * @param starGold

 * @desc 装备升星所需金钱基数。算式:升星次数 x 基数。

 * @default 200

 *--------------------------------------------------------------

 * @param sltGold

 * @desc 装备开槽所需金钱基数。算式:开槽次数 x 基数。

 * @default 500

 *--------------------------------------------------------------

 * @param gemGold

 * @desc 装备镶嵌所需金钱基数。算式:镶嵌次数 x 基数。

 * @default 1000

 *--------------------------------------------------------------

 *@param ■ 几率 ■

 * @param qtRate0

 * @desc 品质随机时,产生 品质0 的装备的几率百分比。

 * @default 60

 *--------------------------------------------------------------

 * @param qtRate1

 * @desc 品质随机时,未产生 品质0 时,产生 品质1 的装备的几率百分比。

 * @default 60

 *--------------------------------------------------------------

 * @param qtRate2

 * @desc 品质随机时,未产生 品质1 时,产生 品质2 的装备的几率百分比。

 * @default 60

 *--------------------------------------------------------------

 * @param qtRate3

 * @desc 品质随机时,未产生 品质2 时,产生 品质3 的装备的几率百分比。

 * @default 60

 *--------------------------------------------------------------

 * @param qtRate4

 * @desc 品质随机时,未产生 品质3 时,产生 品质4 的装备的几率百分比。

 * @default 60

 *--------------------------------------------------------------

 *@param ■ 颜色 ■

 * @param color1

 * @desc 装备分级描绘物品名的颜色1(格式:红,绿,蓝)。

 * @default 255,255,255

 *--------------------------------------------------------------

 * @param color2

 * @desc 装备分级描绘物品名的颜色2(格式:红,绿,蓝)。

 * @default 0,0,200

 *--------------------------------------------------------------

 * @param color3

 * @desc 装备分级描绘物品名的颜色3(格式:红,绿,蓝)。

 * @default 255,255,0

 *--------------------------------------------------------------

 * @param color4

 * @desc 装备分级描绘物品名的颜色4(格式:红,绿,蓝)。

 * @default 255,180,0

 *--------------------------------------------------------------

 * @param color5

 * @desc 装备分级描绘物品名的颜色5(格式:红,绿,蓝)。

 * @default 0,200,0

 *--------------------------------------------------------------

 * @param color6

 * @desc 装备分级描绘物品名的颜色6(格式:红,绿,蓝)。

 * @default 0,255,255

 *--------------------------------------------------------------

 * @param color7

 * @desc 装备分级描绘物品名的颜色7(格式:红,绿,蓝)。

 * @default 255,0,255

 *--------------------------------------------------------------

 * @param color8

 * @desc 装备分级描绘物品名的颜色8(格式:红,绿,蓝)。

 * @default 255,0,0

 *--------------------------------------------------------------

 * @param color9

 * @desc 装备分级描绘物品名的颜色9(格式:红,绿,蓝)。

 * @default 0,0,0

 *--------------------------------------------------------------

 *@param ■ 音效 ■

 * @param mkOkSe

 * @desc 改造进度读条SE。

 * @default Absorb2

 *--------------------------------------------------------------

 * @param mkSucSe

 * @desc 改造成功SE。

 * @default Flash2

 *--------------------------------------------------------------

 * @param mkFalSe

 * @desc 改造失败SE。

 * @default Darkness3

 *--------------------------------------------------------------

 *@param ■ 用语 ■

 * @param titWord

 * @desc 装备改造界面的标题用语。

 * @default 装备改造

 *--------------------------------------------------------------

 * @param setWords

 * @desc 装备改造用语。

 * @default 打造,拆解,修复,强化,升星,开槽,镶嵌

 *--------------------------------------------------------------

 * @param qtWords

 * @desc 装备品质用语,中间用半角逗号隔开(最大5级)。

 * @default 下下级,下级,中级,上级,上上级

 *--------------------------------------------------------------

 * @param evtWords

 * @desc 装备分级类型用语,中间用半角逗号隔开(最大9级)。

 * @default 普通,稀有,传承,圣物,勇者,传说,神器,史诗,超神器

 **--------------------------------------------------------------

*/

//===================================================================================================================

var XdRsData = XdRsData || {};

XdRsData.IpEquip          =    XdRsData.IpEquip || {};

XdRsData.IpEquip.pepr     =    PluginManager.parameters('XdRs_IDPD_Equip_A');

XdRsData.IpEquip.cnSwitch =   +XdRsData.IpEquip.pepr['cnSwitch'];

XdRsData.IpEquip.qtRate   =   +XdRsData.IpEquip.pepr['qtRate'];

XdRsData.IpEquip.starRate =   +XdRsData.IpEquip.pepr['starRate'];

XdRsData.IpEquip.stgRate  =   +XdRsData.IpEquip.pepr['stgRate'];

XdRsData.IpEquip.makeGold =   +XdRsData.IpEquip.pepr['makeGold'];

XdRsData.IpEquip.dabGold  =   +XdRsData.IpEquip.pepr['dabGold'];

XdRsData.IpEquip.rprGold  =   +XdRsData.IpEquip.pepr['rprGold'];

XdRsData.IpEquip.stgGold  =   +XdRsData.IpEquip.pepr['stgGold'];

XdRsData.IpEquip.starGold =   +XdRsData.IpEquip.pepr['starGold'];

XdRsData.IpEquip.sltGold  =   +XdRsData.IpEquip.pepr['sltGold'];

XdRsData.IpEquip.gemGold  =   +XdRsData.IpEquip.pepr['gemGold'];

XdRsData.IpEquip.starMax  =   +XdRsData.IpEquip.pepr['starMax'];

XdRsData.IpEquip.dbtBase  =   +XdRsData.IpEquip.pepr['dbtBase'];

XdRsData.IpEquip.qtRate0  =   +XdRsData.IpEquip.pepr['qtRate0'];

XdRsData.IpEquip.qtRate1  =   +XdRsData.IpEquip.pepr['qtRate1'];

XdRsData.IpEquip.qtRate2  =   +XdRsData.IpEquip.pepr['qtRate2'];

XdRsData.IpEquip.qtRate3  =   +XdRsData.IpEquip.pepr['qtRate3'];

XdRsData.IpEquip.qtRate4  =   +XdRsData.IpEquip.pepr['qtRate4'];

XdRsData.IpEquip.qtWords  = ''+XdRsData.IpEquip.pepr['qtWords'];

XdRsData.IpEquip.evtWords = ''+XdRsData.IpEquip.pepr['evtWords'];

XdRsData.IpEquip.titWord  = ''+XdRsData.IpEquip.pepr['titWord'];

XdRsData.IpEquip.setWords = ''+XdRsData.IpEquip.pepr['setWords'];

XdRsData.IpEquip.mkOkSe   = ''+XdRsData.IpEquip.pepr['mkOkSe'];

XdRsData.IpEquip.mkSucSe  = ''+XdRsData.IpEquip.pepr['mkSucSe'];

XdRsData.IpEquip.mkFalSe  = ''+XdRsData.IpEquip.pepr['mkFalSe'];

XdRsData.IpEquip.colors   = [];

XdRsData.IpEquip.addData  = [0,1,false,false];

for(var i=1;i<10;i++){XdRsData.IpEquip.colors.push('rgb('+XdRsData.IpEquip.pepr['color'+i]+')');}

//===================================================================================================================

var $baseWeapons = null;

var $baseArmors  = null;

var $dataWeapons = [null];

var $dataArmors  = [null];

DataManager._databaseFiles.forEach(function(data){

    if (data.name === '$dataWeapons') data.name = '$baseWeapons';

    if (data.name === '$dataArmors')  data.name = '$baseArmors';

});

DataManager.isWeapon = function(item) {

    return item && ($dataWeapons.contains(item) || $baseWeapons.contains(item));

};

DataManager.isArmor = function(item) {

    return item && ($dataArmors.contains(item) || $baseArmors.contains(item));

};

XdRsData.IpEquip.DMmakeSaveContents = DataManager.makeSaveContents;

DataManager.makeSaveContents = function() {

    var contents = XdRsData.IpEquip.DMmakeSaveContents.call(this);

    contents.weapons = $dataWeapons;

    contents.armors  = $dataArmors;

    return contents;

};

XdRsData.IpEquip.DMextractSaveContents = DataManager.extractSaveContents;

DataManager.extractSaveContents = function(contents) {

    XdRsData.IpEquip.DMextractSaveContents.call(this,contents);

    $dataWeapons = contents.weapons;

    $dataArmors  = contents.armors;

};

//===================================================================================================================

XdRsData.IpEquip.deleteEquip = function(equip) {

    if (!this.isEquip(equip)) return;

    if ($dataWeapons.contains(equip)) var obj = $dataWeapons;

    if ($dataArmors.contains(equip))  var obj = $dataArmors;

    delete obj[equip.id];

};

XdRsData.IpEquip.addEquip = function(baseEquip, qt, st) {

    var type = this.baseEquipType(baseEquip);

    this.addData[0] = type;

    var obj  = type == 2 ? $dataArmors : $dataWeapons;

    var newEquip = this.createEquip(baseEquip, type, qt, st);

    obj[newEquip.id] = newEquip;

};

XdRsData.IpEquip.createEquip = function(baseEquip, type, qt, st) {

    var newEquip = JSON.parse(JSON.stringify(baseEquip));

    this.setId(type);

    newEquip.baseId = baseEquip.id;

    newEquip.id = this.addData[1];

    newEquip.stgCount = newEquip.starCount = 0;

    this.setEquipQt(newEquip, qt);

    this.setQtAdd(newEquip);

    this.setEquipDbt(newEquip);

    this.setTraitsAdd(newEquip, this.qtRate * newEquip.quality);

    this.setSlot(newEquip,st);

    this.setLimites(newEquip);

    this.setMaterials(newEquip);

    this.setPrice(newEquip);

    this.addData[2] = this.addData[3] = false;

    return newEquip;

};

XdRsData.IpEquip.setId = function(type) {

    var obj = type == 2 ? $dataArmors : $dataWeapons;

    this.addData[0] = type;this.addData[1] = 1;

    while (!!obj[this.addData[1]]) this.addData[1]++;

};

XdRsData.IpEquip.setEquipQt = function(equip,qt) {

    if (qt !== false) {equip.quality = qt; return;}

    switch (true) {

    case Math.randomInt(100) < this.qtRate0 :qt = 0; break;

    case Math.randomInt(100) < this.qtRate1 :qt = 1; break;

    case Math.randomInt(100) < this.qtRate2 :qt = 2; break;

    case Math.randomInt(100) < this.qtRate3 :qt = 3; break;

    case Math.randomInt(100) < this.qtRate4 :qt = 4; break;

    }

    equip.quality = !!qt ? qt : 0;

};

XdRsData.IpEquip.allEl = function(equip) {

    var num = 0;

    for (var i=0;i<8;i++){

        if (!equip.params[i]) continue;

        var add = equip.params[i]

        add = i < 2 ? (i == 0 ? ~~(add<span style="color: #0066FF;">/10) : ~~(add/5)) : add;

        add = Math.max(add,1);

        num += add;

    }

    return num;

};

XdRsData.IpEquip.setQtAdd = function(equip) {

    equip.qtAddData = [0,0,0,0,0,0,0,0];

    if (!equip.quality || !this.allEl(equip)) return;

    var num = this.allEl(equip);

    if (!num) return;

    num = Math.max(Math.ceil(num * this.qtRate * equip.quality / 100),1);

    var type, data, add;

    while (!!num){

        type = Math.randomInt(8);

        data = Math.randomInt(num) + 1;

        add = type < 2 ? (type == 0 ? data * 10 : data * 5) : data;

        equip.params[type] += add;

        equip.qtAddData[type] = 1;

        num -= data;

    }

};

XdRsData.IpEquip.setTraitsAdd = function(equip,rate) {

    if (!rate) return;

    var data = [11,12,13,21,22,23,32,33,34,61];

    for (var i=0;i<equip.traits.length;i++){

        var tra = equip.traits[i];

        if (!data.contains(tra.code)) continue;

        var type = tra.code == 33 ? 1 : 0;

        var max = tra.code == 34 ? 9 : (tra.code == 61 ? 1 : false);

        tra.value = this.addNum(tra.value,rate,max,type);

    }

};

XdRsData.IpEquip.addNum = function(val,rate,max,type) {

    val += val * rate / 100;

    if (!!max) val = Math.max(val,max);

    return !!type ? Math.ceil(val) : val;

};

XdRsData.IpEquip.setEquipDbt = function(equip) {

    var add = Math.max(~~(this.dbtBase * 3 / 10), 1);

    add = Math.randomInt(add) + 1;

    add = !!Math.randomInt(2) ? add : -add;

    equip.dbtMax = equip.dbt = this.dbtBase + add;

    equip.dbtData = Math.randomInt(10) + 5;

};

XdRsData.IpEquip.setSlot = function(equip, st) {

    if (st !== 0 && !st) {

        var data = [60,50,40,30,20,10];

        var index = 0;

        var num = Math.randomInt(100);

        while (num > data[index]){

            index = (index + 1) % 6;

            num = Math.randomInt(100);

        }

        st = index;

    }

    equip.slots = [];

    while(!!st) {equip.slots.push(null);st--;}

};

XdRsData.IpEquip.setLimites = function(equip) {

    if (!!equip.limit) return;

    equip.limit = [{'type':0,'num':1}];

    var data = equip.note.match(<span style="color: #0066FF;">/<XIELimit:(\S+)>/g);

    if (!data) return;

    var mat,type,num,mod = ['level','atk','def','mtk','mdf','agi','luk'];

    for (var i=0;i<data.length;i++){

        mat = data[i].match(<span style="color: #0066FF;">/<XIELimit:(\S+)>/)[1];

        type = mat.split(',')[0];num = +(mat.split(',')[1]);

        if (!type || !num || !mod.contains(type)) continue;

        if (type === 'level') {equip.limit[0].num = num;continue;}

        equip.limit.push({'type':mod.indexOf(type)+1,'num':num});

    }

};

XdRsData.IpEquip.setMaterials = function(equip) {

    equip.materials = [];

    var data = equip.note.match(<span style="color: #0066FF;">/<XIEMts:(\S+)>/);

    if (!data || !data[1]) return;

    data = data[1].split(',');

    for (var i=0;i<data.length;i++){

        var id  = data[i].split('=')[0];

        var num = data[i].split('=')[1];

        if (!id || !num || !$dataItems[id]) continue;

        equip.materials.push({'id':+id,'num':+num});

        $dataItems[id].isMake = true;

    }

};

XdRsData.IpEquip.setPrice = function(equip) {

    equip.price += equip.slots.length * equip.price / 10;

    equip.price += equip.price * equip.quality * this.qtRate / 100;

    equip.price = Math.ceil(equip.price);

};

XdRsData.IpEquip.isBaseEquip = function(equip) {

    if (!!equip && $baseWeapons.contains(equip)) return true;

    if (!!equip && $baseArmors.contains(equip)) return true;

    return false;

};

XdRsData.IpEquip.baseEquipType = function(equip) {

    if (!this.isBaseEquip(equip))return null;

    if ($baseWeapons.contains(equip)) return 1;

    if ($baseArmors.contains(equip))  return 2;

};

XdRsData.IpEquip.isEquip = function(equip) {

    if (!!equip && $dataWeapons.contains(equip)) return true;

    if (!!equip && $dataArmors.contains(equip)) return true;

    return false;

};

XdRsData.IpEquip.equipForType = function(id,type) {

    if (type == 2) return $dataArmors[id];

    return $dataWeapons[id];

};

XdRsData.IpEquip.changeStarMax = function(max) {

    this.starMax = max.clamp(1,20);

};

XdRsData.IpEquip.upRate1 = function(equip,item) {

    var ir = item.note.match(<span style="color: #0066FF;">/<XIESr:(\S+)>/);

    ir = ir ? +ir[1] : 0;

    var rate = (20 - equip.starCount) * 5;

    rate = (rate * ir / 100).toFixed(2);

    return rate;

};

XdRsData.IpEquip.upRate2 = function(equip) {

    var rate = 100;

    for (var i=0;i<equip.stgCount;i++){rate -= rate / 100;}

    return rate.toFixed(2);

};

XdRsData.IpEquip.canStarUp = function(equip) {

    return !!equip && equip.starCount < this.starMax;

};

XdRsData.IpEquip.canStgUp = function(equip) {

    return !!equip;

};

XdRsData.IpEquip.needStgNum = function(equip) {

    return equip.stgCount+1;

};

XdRsData.IpEquip.starUp = function(equip) {

    if (!this.canStarUp(equip)) return;

    equip.starCount++;

    equip.price += Math.ceil(equip.price * this.starRate / 100);

    this.setTraitsAdd(equip, this.starRate);

    this.setPrameAdd(equip, this.starRate);

};

XdRsData.IpEquip.stgUp = function(equip) {

    if (!this.canStgUp(equip)) return;

    equip.stgCount++;

    equip.price += Math.ceil(equip.price * this.stgRate / 100);

    this.setTraitsAdd(equip, this.stgRate);

    this.setPrameAdd(equip, this.stgRate);

};

XdRsData.IpEquip.setPrameAdd = function(equip,rate) {

    if (!equip || !rate) return;

    for (var i=0;i<8;i++){

        if (!equip.params[i]) continue;

        equip.params[i] += Math.ceil(equip.params[i] * rate / 100);

    }

};

XdRsData.IpEquip.refreshDbt = function(equip) {

    if (!equip.dbt) return;

    equip.dbtData--;

    if (!equip.dbtData) {

        equip.dbt--;

        equip.dbtData = Math.randomInt(10) + 5;

    }

};

XdRsData.IpEquip.repair = function(equip, item) {

    if (!equip || !item) return;

    var num = +item.note.match(<span style="color: #0066FF;">/<XIERepair:(\S+)>/)[1];

    equip.dbt = Math.min(equip.dbt+num, equip.dbtMax);

};

XdRsData.IpEquip.gemsSize = function(equip) {

    var num = 0;

    for (var i=0;i<equip.slots.length;i++){if(!!equip.slots[i]) num++;}

    return num;

};

XdRsData.IpEquip.slotting = function(equip) {

    if (equip.slots.length == 6) return;

    equip.slots.push(null);

    equip.price += Math.ceil(equip.price / 10);

};

XdRsData.IpEquip.canSetGem = function(equip, gem) {

    if (this.gemsSize(equip) == equip.slots.length) return false;

    if (!gem) return false;

    return true;

};

XdRsData.IpEquip.setGem = function(equip, gem) {

    if (!this.canSetGem(equip, gem)) return;

    var index = 0,max = equip.slots.length;

    while (!!equip.slots[index] && index < max) index++;

    if (!!equip.slots[index]) return;

    equip.slots[index] = gem.id;

    equip.price += Math.ceil(gem.price / 2);

};

XdRsData.IpEquip.equipScore = function(equip) {

    var score = equip.quality * this.qtRate;

    score += equip.starCount * this.starRate;

    score += equip.stgCount * this.stgRate;

    return score;

};

XdRsData.IpEquip.equipKind = function(equip) {

    if (!this.isEquip(equip)) return '';

    var index = Math.floor(this.equipScore(equip) / 20).clamp(0,8);

    return this.evtWords.split(',')[index];

};

XdRsData.IpEquip.nameColor = function(item) {

    if (!this.isEquip(item)) return 'rgb(255,255,255)';

    var index = Math.floor(this.equipScore(item) / 20).clamp(0,8);

    return this.colors[index];

};

XdRsData.IpEquip.paramColor = function(item,type) {

    if (!this.isEquip(item)) return 'rgb(255,255,255)';

    return !!item.qtAddData[type] ? 'rgb(0,200,0)' : 'rgb(255,255,255)';

};

XdRsData.IpEquip.dbtColor = function(equip) {

    if (!this.isEquip(equip)) return 'rgb(255,255,255)';

    return equip.dbt < 6 ? (!!equip.dbt ? 'rgb(255,100,0)' : 'rgb(160,0,0)') : 'rgb(255,255,255)';

};

XdRsData.IpEquip.qtWord = function(equip) {

    if (!this.isEquip(equip)) return '';

    return this.qtWords.split(',')[equip.quality];

};

XdRsData.IpEquip.canMakeEquips = function() {

    var data = [];

    for (var i=1;i<$baseWeapons.length;i++){

        if ($baseWeapons[i].materials === undefined) this.setMaterials($baseWeapons[i]);

        if (!!$baseWeapons[i].materials.length) data.push($baseWeapons[i]);

    }

    for (var i=1;i<$baseArmors.length;i++){

        if ($baseArmors[i].materials === undefined) this.setMaterials($baseArmors[i]);

        if (!!$baseArmors[i].materials.length) data.push($baseArmors[i]);

    }

    return data;

};

XdRsData.IpEquip.itemIsMake = function(item) {

    return (!!item && item.note.match(<span style="color: #0066FF;">/<XIEMake>/));

};

XdRsData.IpEquip.itemIsStar = function(item) {

    return (!!item && item.note.match(<span style="color: #0066FF;">/<XIESr:(\S+)>/));

};

XdRsData.IpEquip.itemIsStg = function(item) {

    return (!!item && item.note.match(<span style="color: #0066FF;">/<XIEStg>/));

};

XdRsData.IpEquip.itemIsRepair = function(item) {

    return (!!item && item.note.match(<span style="color: #0066FF;">/<XIERepair:(\S+)>/));

};

XdRsData.IpEquip.itemIsSlt = function(item) {

    return (!!item && item.note.match(<span style="color: #0066FF;">/<XIESlt>/));

};

XdRsData.IpEquip.itemIsGem = function(item) {

    return (!!item && item.note.match(<span style="color: #0066FF;">/<XIEGem>/));

};

//===============================================================================================================

 
 
JavaScript:
<div class="javascript" id="{CB}" style="font-family: monospace;"><ol> 

//==================================================================================================================

 /*:

 * @plugindesc 独立装备(B:整合) 。

 * 

 * @author 2144972924

 * 

 * @help 

 *

*/

//==================================================================================================================

var XdRsData = XdRsData || {};

XdRsData.IpEquip = XdRsData.IpEquip || {};

//==================================================================================================================

Game_Interpreter.prototype.command127 = function() {

    var value = this.operateValue(this._params[1], this._params[2], this._params[3]);

    var weapon = $baseWeapons[this._params[0]];

    if (value < 1) {$gameParty.loseEquip(weapon,0);return true;}

    $gameParty.gainItem(weapon, value, this._params[4]);

    return true;

};

Game_Interpreter.prototype.command128 = function() {

    var value = this.operateValue(this._params[1], this._params[2], this._params[3]);

    var armor = $baseArmors[this._params[0]];

    if (value < 1) {$gameParty.loseEquip(armor,0);return true;}

    $gameParty.gainItem(armor, value, this._params[4]);

    return true;

};

Game_Interpreter.prototype.addEquip = function(baseId, type, qt, sl) {

    var obj = type == 1 ? $baseWeapons : $baseArmors;

    var equip = obj[baseId];

    if (!equip) return;

    XdRsData.IpEquip.addData[2] = (!!qt || qt == 0) ? qt : false;

    XdRsData.IpEquip.addData[3] = (!!sl || sl == 0) ? sl : false;

    $gameParty.gainItem(equip,1);

};

XdRsData.IpEquip.GIpluginCommand = Game_Interpreter.prototype.pluginCommand;

Game_Interpreter.prototype.pluginCommand = function(command, args) {

    XdRsData.IpEquip.GIpluginCommand.call(this, command, args);

    switch (command) {

        case 'IDPDRemake': SceneManager.goto(XdRs_EquipReform);break;

        case 'AddWeapon':  this.addEquip(+args[0],1,+args[1],+args[2]);break;

        case 'AddArmor':   this.addEquip(+args[0],2,+args[1],+args[2]);break;

    }

};

//==================================================================================================================

XdRsData.IpEquip.GAexecuteDamage = Game_Action.prototype.executeDamage;

Game_Action.prototype.executeDamage = function(target, value) {

    if (this.subject().constructor === Game_Actor && !!value && this.subject().refreshWeaponsDbt()){}

    XdRsData.IpEquip.GAexecuteDamage.call(this,target,value);

};

//==================================================================================================================

XdRsData.IpEquip.GBmeetsItemConditions = Game_BattlerBase.prototype.meetsItemConditions;

Game_BattlerBase.prototype.meetsItemConditions = function(item) {

    return XdRsData.IpEquip.GBmeetsItemConditions.call(this,item) && !this.isIDPDItem(item);

};

Game_BattlerBase.prototype.isIDPDItem = function(item) {

    return (XdRsData.IpEquip.itemIsMake(item) || XdRsData.IpEquip.itemIsStar(item)  ||

            XdRsData.IpEquip.itemIsStg(item)  || XdRsData.IpEquip.itemIsRepair(item)||

            XdRsData.IpEquip.itemIsSlt(item)  || XdRsData.IpEquip.itemIsGem(item));

};

XdRsData.IpEquip.GBcanEquip = Game_BattlerBase.prototype.canEquip;

Game_BattlerBase.prototype.canEquip = function(item) {

    return this.ipCanEquip(item) && XdRsData.IpEquip.GBcanEquip.call(this,item);

};

Game_BattlerBase.prototype.ipCanEquip = function(item) {

    if (this.constructor === Game_Actor) {

        if (!XdRsData.IpEquip.isEquip(item)) return false;

        for (var i=0; i < item.limit.length; i++){

            if (item.limit[i].type == 0 && item.limit[i].num > this.level) return false;

            else if (item.limit[i].num > this.param(item.limit[i].type))   return false;

        }

    }

    return true;

};

XdRsData.IpEquip.GBsetHp = Game_BattlerBase.prototype.setHp;

Game_BattlerBase.prototype.setHp = function(hp) {

    if (this.constructor === Game_Actor && this._hp >= hp && this.refreshArmorsDbt()){}

    XdRsData.IpEquip.GBsetHp.call(this,hp);

};

//==================================================================================================================

Game_Actor.prototype.initEquips = function(equips) {

    var slots = this.equipSlots();

    var maxSlots = slots.length;

    this._equips = [];newEuips = [];

    for (var e = 0; e < equips.length; e++) {

        if (!!equips[e]) {

            var type = (e == 0 || e == 1 && slots[e] === 1) ? 1 : 2;

            var baseEquip = type == 1 ? $baseWeapons[equips[e]] : $baseArmors[equips[e]];

            XdRsData.IpEquip.addEquip(baseEquip,0,0);

            newEuips.push(XdRsData.IpEquip.addData[1]);

        }else{newEuips.push(0);} 

    }

    for (var i = 0; i < maxSlots; i++) {

        this._equips[i] = new Game_Item();

    }

    for (var j = 0; j < newEuips.length; j++) {

        var type = (j == 0 || j == 1 && slots[j] === 1) ? 1 : 2;

        var equip = XdRsData.IpEquip.equipForType(newEuips[j],type);

        if (!!equip && !this.canEquip(equip)) {

            $gameParty.gainItem(equip, 1);continue;

        }

        if (j < maxSlots) {

            this._equips[j].setEquip(slots[j] === 1, newEuips[j]);

        }

    }

    this.releaseUnequippableItems(true);

    this.refresh();

};

Game_Actor.prototype.paramPlus = function(paramId) {

    var value = this.equipPlus(paramId);

    var equips = this.equips();

    for (var i = 0; i < equips.length; i++) {

        var equip = equips[i];

        if (!!equip && !!XdRsData.IpEquip.gemsSize(equip) && !!equip.dbt) {

            for (var j=0;j<equip.slots.length;j++){

                if (!equip.slots[j]) continue;

                var item = $dataItems[equip.slots[j]];

                value += this.gemPlus(item, paramId);

            }

        }

    }

    return value;

};

Game_Actor.prototype.equipPlus = function(paramId) {

    var value = Game_Battler.prototype.paramPlus.call(this, paramId);

    var equips = this.equips();

    for (var i = 0; i < equips.length; i++) {

        var item = equips[i];

        if (item && !!item.dbt) {

            value += item.params[paramId];

        }

    }

    return value;

};

Game_Actor.prototype.gemPlus = function(gem,paramId) {

    var val = 0;

    for (var i=0;i<gem.effects.length;i++){

        if (gem.effects[i].code !== 42) continue;

        if (gem.effects[i].dataId !== paramId) continue;

        val += gem.effects[i].value1;

    }

    return val;

};

Game_Actor.prototype.refreshWeaponsDbt = function() {

    this.weapons().forEach(function(weapon){XdRsData.IpEquip.refreshDbt(weapon)});

};

Game_Actor.prototype.refreshArmorsDbt = function() {

    this.armors().forEach(function(armor){XdRsData.IpEquip.refreshDbt(armor)});

};

//==================================================================================================================

Game_Party.prototype.numEquips = function(baseId) {

    var container = this.itemContainer(item),num = 0;

    if (!container) return 0;

    for (var i in container){if (baseId === container[i].baseId) num++;}

    return num;

};

XdRsData.IpEquip.GPgainItem = Game_Party.prototype.gainItem;

Game_Party.prototype.gainItem = function(item, amount, includeEquip) {

    if (XdRsData.IpEquip.isBaseEquip(item)){this.gainEquip(item);}

    else if (XdRsData.IpEquip.isEquip(item)){this.loseEquip(item, amount);}

    else{XdRsData.IpEquip.GPgainItem.call(this,item, amount, includeEquip)};

};

Game_Party.prototype.gainEquip = function(item) {

    var qt = st = 0;

    if ($gameSwitches.value(XdRsData.IpEquip.cnSwitch)){

        var data1 = XdRsData.IpEquip.addData[2];

        var data2 = XdRsData.IpEquip.addData[3];

        qt = !!data1 ? data1.clamp(0,4) : data1;

        st = !!data2 ? data2.clamp(0,6) : data2;

    }

    XdRsData.IpEquip.addEquip(item,qt,st);

    var container = this.itemContainer(item);

    container[XdRsData.IpEquip.addData[1]] = 1;

};

Game_Party.prototype.loseEquip = function(item, amount) {

    var container = this.itemContainer(item);

    if (!container) return;

    if (amount > 0) {container[item.id] = 1;return;}

    if (container[item.id]) delete container[item.id];

    if (!amount) XdRsData.IpEquip.deleteEquip(item);

};

Game_Party.prototype.repairItems = function() {

    return this.items().filter(function(item){

        return !!item && item.note.match(<span style="color: #0066FF;">/<XIERepair:(\S+)>/);

    });

};

Game_Party.prototype.starItems = function() {

    return this.items().filter(function(item){

        return !!item && item.note.match(<span style="color: #0066FF;">/<XIESr:(\S+)>/);

    });

};

Game_Party.prototype.stgItems = function() {

    return $dataItems.filter(function(item){

        return !!item && item.note.match(<span style="color: #0066FF;">/<XIEStg>/);

    });

};

Game_Party.prototype.sltItems = function() {

    return $dataItems.filter(function(item){

        return !!item && item.note.match(<span style="color: #0066FF;">/<XIESlt>/);

    });

};

Game_Party.prototype.gemItems = function() {

    return this.items().filter(function(item){

        return !!item && item.note.match(<span style="color: #0066FF;">/<XIEGem>/);

    });

};

//==================================================================================================================

Window_Base.prototype.drawItemName = function(item, x, y, width) {

    width = width || 312;

    if (item) {

        var iconBoxWidth = Window_Base._iconWidth + 4;

        this.changeTextColor(XdRsData.IpEquip.nameColor(item));

        this.drawIcon(item.iconIndex, x + 2, y + 2);

        this.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth);

    }

};

//==================================================================================================================

Window_ItemList.prototype.drawItem = function(index) {

    var item = this._data[index];

    if (item) {

        var numberWidth = this.numberWidth();

        var rect = this.itemRect(index);

        rect.width -= this.textPadding();

        this.changePaintOpacity(this.isEnabled(item));

        this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);

        if (DataManager.isItem(item)) this.drawItemNumber(item, rect.x, rect.y, rect.width);

        this.changePaintOpacity(1);

    }

};

//==================================================================================================================

Window_ShopBuy.prototype.makeItemList = function() {

    this._data = [];

    this._price = [];

    this._shopGoods.forEach(function(goods) {

        var item = null;

        switch (goods[0]) {

        case 0:

            item = $dataItems[goods[1]];

            break;

        case 1:

            item = $baseWeapons[goods[1]];

            break;

        case 2:

            item = $baseArmors[goods[1]];

            break;

        }

        if (item) {

            this._data.push(item);

            this._price.push(goods[2] === 0 ? item.price : goods[3]);

        }

    }, this);

};

//==================================================================================================================

XdRsData.IpEquip.SIcreate = Scene_Item.prototype.create;

Scene_Item.prototype.create = function() {

    XdRsData.IpEquip.SIcreate.call(this);

    this.createHelp();

};

Scene_Item.prototype.createHelp = function() {

    this._ipHelp = new Xr_ItemMessage();

    this.addChild(this._ipHelp);

};

Scene_Item.prototype.update = function() {

    Scene_ItemBase.prototype.update.call(this);

    this.updateIpHelp();

};

Scene_Item.prototype.updateIpHelp = function() {

    if (this._itemWindow.isOpenAndActive()) {

        this._ipHelp.setItem(this._itemWindow.item());

        this._ipHelp.setPlace((this._itemWindow.index()+1)%2*320+80,Math.floor(this._itemWindow.index()/2)*40+220);

    }else{this._ipHelp.setItem(null);}

};

//==================================================================================================================

XdRsData.IpEquip.SScreate = Scene_Shop.prototype.create;

Scene_Shop.prototype.create = function() {

    XdRsData.IpEquip.SScreate.call(this);

    this.createHelp();

};

Scene_Shop.prototype.createHelp = function() {

    this._ipHelp = new Xr_ItemMessage();

    this.addChild(this._ipHelp);

};

Scene_Shop.prototype.onBuyOk = function() {

    this._item = this._buyWindow.item();

    if (!DataManager.isItem(this._item)) {

        if ($gameParty.gold() < this._item.price){SoundManager.playBuzzer();return;}

        SoundManager.playShop();this.doBuy(1);

        this._goldWindow.refresh();

        this._statusWindow.refresh();

        this.endNumberInput();

        return;

    }

    this._buyWindow.hide();

    this._numberWindow.setup(this._item, this.maxBuy(), this.buyingPrice());

    this._numberWindow.setCurrencyUnit(this.currencyUnit());

    this._numberWindow.show();

    this._numberWindow.activate();

};

Scene_Shop.prototype.onSellOk = function() {

    this._item = this._sellWindow.item();

    if (!DataManager.isItem(this._item)) {

        SoundManager.playShop();this.doSell(0);

        this._goldWindow.refresh();

        this._statusWindow.refresh();

        this.endNumberInput();

        return;

    }

    this._categoryWindow.hide();

    this._sellWindow.hide();

    this._numberWindow.setup(this._item, this.maxSell(), this.sellingPrice());

    this._numberWindow.setCurrencyUnit(this.currencyUnit());

    this._numberWindow.show();

    this._numberWindow.activate();

    this._statusWindow.setItem(this._item);

    this._statusWindow.show();

};

Scene_Shop.prototype.doBuy = function(number) {

    $gameParty.loseGold(number * this.buyingPrice());

    $gameParty.gainItem(this._item, number);

};

Scene_Shop.prototype.doSell = function(number) {

    $gameParty.gainGold(number * this.sellingPrice());

    if (XdRsData.IpEquip.isEquip(this._item)) {

        $gameParty.gainGold(Math.floor(this._item.price / 2));

        $gameParty.loseEquip(this._item, 0);

    }else{$gameParty.loseItem(this._item, number);}

};

Scene_Shop.prototype.update = function() {

    Scene_MenuBase.prototype.update.call(this);

    this.updateIpHelp();

};

Scene_Shop.prototype.updateIpHelp = function() {

    if (this._buyWindow.isOpenAndActive()) {

        this._ipHelp.setItem(this._buyWindow.item());

        this._ipHelp.setPlace(400,this._buyWindow.index()*40+230);

    }else if (this._sellWindow.isOpenAndActive()) {

        this._ipHelp.setItem(this._sellWindow.item());

        this._ipHelp.setPlace((this._sellWindow.index()+1)%2*320+80,Math.floor(this._sellWindow.index()/2)*40+260);

    }else{this._ipHelp.setItem(null);}

};

//==================================================================================================================

XdRsData.IpEquip.SEcreate = Scene_Equip.prototype.create;

Scene_Equip.prototype.create = function() {

    XdRsData.IpEquip.SEcreate.call(this);

    this.createHelp();

};

Scene_Equip.prototype.createHelp = function() {

    this._ipHelp = new Xr_ItemMessage();

    this.addChild(this._ipHelp);

};

Scene_Equip.prototype.update = function() {

    Scene_MenuBase.prototype.update.call(this);

    this.updateIpHelp();

};

Scene_Equip.prototype.updateIpHelp = function() {

    if (this._slotWindow.isOpenAndActive()) {

        this._ipHelp.setItem(this._slotWindow.item());

        this._ipHelp.setPlace(10,this._slotWindow.index()*40+30);

    }else if (this._itemWindow.isOpenAndActive()) {

        this._ipHelp.setItem(this._itemWindow.item());

        this._ipHelp.setPlace((this._itemWindow.index()+1)%2*320+80,Math.floor(this._itemWindow.index()/2)*40+260);

    }else{this._ipHelp.setItem(null);}

};

//==================================================================================================================

 
 
JavaScript:
<div class="javascript" id="{CB}" style="font-family: monospace;"><ol> 

//==================================================================================================================

 /*:

 * @plugindesc 独立装备(C:效果) 。

 * 

 * @author 2144972924

 * 

 * @help

 *

*/

//==================================================================================================================

var XdRsData = XdRsData || {};

XdRsData.IpEquip = XdRsData.IpEquip || {};

//==================================================================================================================

Bitmap.prototype.setLineColor = function(color) {

    this.outlineColor = color || 'rgba(0,0,0,0.5)';

};

//==================================================================================================================

TouchInput.inRect = function(rect) {

    if (this.x < rect.x || this.x > rect.x+rect.width)  return false;

    if (this.y < rect.y || this.y > rect.y+rect.height) return false;

    return true;

};

//==================================================================================================================

XdRsData.IpEquip.GSinitialize = Game_System.prototype.initialize;

Game_System.prototype.initialize = function() {

    XdRsData.IpEquip.GSinitialize.call(this);

    this.iniIeColors();

};

Game_System.prototype.iniIeColors = function() {

    this._colorType = 0;

    this._ieColors = [[0,80,80],[80,80,0],[0,80,0],[0,0,80]];

    this._ieColors.push([80,0,80],[80,0,0],[80,80,80]);

};

Game_System.prototype.colorType = function() {

    return this._colorType;

};

Game_System.prototype.setColorType = function(type) {

    this._colorType = type;

};

Game_System.prototype.ieColors = function() {

    return this._ieColors;

};

Game_System.prototype.ieColor = function(type,a) {

    var data = this._ieColors[this._colorType];

    for (var i=0;i<3;i++){if (!!data[i]) data[i] = !!type ? 80 : 200;}

    return 'rgba('+data[0]+','+data[1]+','+data[2]+','+a+')';

};

//==================================================================================================================

//☆基本窗口☆

function XdRs_Ip_UiBase() {

    this.initialize.apply(this, arguments);

}

 

XdRs_Ip_UiBase.prototype = Object.create(Sprite_Base.prototype);

XdRs_Ip_UiBase.prototype.constructor = XdRs_Ip_UiBase;

Object.defineProperty(XdRs_Ip_UiBase.prototype, 'active', {

    get: function()      {return this._active;},

    set: function(value) {this._active = value;},

    configurable: true

});

XdRs_Ip_UiBase.prototype.initialize = function(x,y,w,h) {

    Sprite_Base.prototype.initialize.call(this);

    this._active = true;

    this._dataColorType = $gameSystem.colorType();

    this._dataIndex = this._index = 0;

    if (this.setBitmap(w,h) || this.move(x,y)){}

};

XdRs_Ip_UiBase.prototype.setBitmap = function(w,h) {

    this.bitmap = new Bitmap(w,h);

    this._cot = new Sprite(new Bitmap(w,h));

    this.addChild(this._cot);

};

XdRs_Ip_UiBase.prototype.backColor = function(type,a) {

    if (a !== 0 ) a = a || 1;

    return $gameSystem.ieColor(type, a);

};

XdRs_Ip_UiBase.prototype.getColor = function(data,a) {

    if (data.length == 3) {

        a = a === undefined ? 1 : a;

        return 'rgba('+data[0]+','+data[1]+','+data[2]+','+a+')';

    }

    return 'rgba('+data[0]+','+data[1]+','+data[2]+','+data[3]+')';

};

XdRs_Ip_UiBase.prototype.clear = function() {

    this._cot.bitmap.clear();

};

XdRs_Ip_UiBase.prototype.clearRect = function(x,y,w,h) {

    this._cot.bitmap.clearRect(x,y,w,h);

};

XdRs_Ip_UiBase.prototype.setFontSize = function(size) {

    this._cot.bitmap.fontSize = size || 24;

};

XdRs_Ip_UiBase.prototype.setFontColor = function(color) {

    this._cot.bitmap.textColor = color || 'rgb(255,255,255)';

};

XdRs_Ip_UiBase.prototype.setLineColor = function(color) {

    this._cot.bitmap.setLineColor(color);

};

XdRs_Ip_UiBase.prototype.setupCot = function() {

    if (this.setFontSize() || this.setFontColor() || this.setLineColor()){}

};

XdRs_Ip_UiBase.prototype.drawText = function(text,x,y,w,h,a) {

    this._cot.bitmap.drawText(text,x,y,w,h,a);

};

XdRs_Ip_UiBase.prototype.drawIcon = function(index,x,y) {

    var bitmap = ImageManager.loadSystem('IconSet');

    var pw = Window_Base._iconWidth,ph = Window_Base._iconHeight;

    var sx = index % 16 * pw,sy = Math.floor(index / 16) * ph;

    this._cot.bitmap.blt(bitmap, sx, sy, pw, ph, x, y);

};

XdRs_Ip_UiBase.prototype.drawSysText = function(text,x,y,a) {

    this.setFontSize();this.setFontColor();

    this.setLineColor('rgba(255,120,0,0.5)');

    var cx = this._cot.bitmap.measureTextWidth(text);

    this.drawText(text,x,y,cx,30,a);

};

XdRs_Ip_UiBase.prototype.drawNomText = function(text,x,y,color,a) {

    this.setFontSize(22);this.setFontColor(color);

    this.setLineColor();

    var cx = this._cot.bitmap.measureTextWidth(text);

    this.drawText(text,x,y,cx,26,a);

};

XdRs_Ip_UiBase.prototype.drawItem = function(item,x,y,qt) {

    this.drawIcon(item.iconIndex,x,y);

    var color = XdRsData.IpEquip.nameColor(item);

    this.drawNomText(item.name,x+36,y+2,color);

};

XdRs_Ip_UiBase.prototype.drawRect = function(x,y,w,h,n,type,ab) {

    var color = [120,120,120];

    for (var i=0;i<n;i++){

        this.bitmap.fillRect(x,y,w,h,this.getColor(color));

        x++;y++;w-=2;h-=2;

        for (var c=0;c<3;c++){color[c] = Math.max(color[c]-20,0);}

        this.bitmap.clearRect(x,y,w,h);

    }

    if (!!ab) {

        var ny = h / ab;

        for (var i=0;i<ab;i++){

            this.bitmap.fillRect(x,y+i*ny,w,ny,this.backColor(type));

            type = !!type ? 0 : 1;

        }

        return;

    }

    this.bitmap.fillRect(x,y,w,h,this.backColor(type));

};

XdRs_Ip_UiBase.prototype.update = function() {

    Sprite_Base.prototype.update.call(this);

    if (this.updateBack() || this.updateIndex()){}

};

XdRs_Ip_UiBase.prototype.updateBack = function() {

    if (this._dataColorType == $gameSystem.colorType()) return;

    this._dataColorType = $gameSystem.colorType();

    this.drawBack();

};

XdRs_Ip_UiBase.prototype.updateIndex = function() {

    if (this._dataIndex == this._index) return;

    SoundManager.playCursor();

    this._dataIndex = this._index;

};

//===============================================================================================================

function XdRs_Ip_Arraw() {

    this.initialize.apply(this, arguments);

}

XdRs_Ip_Arraw.prototype = Object.create(Sprite.prototype);

XdRs_Ip_Arraw.prototype.constructor = XdRs_Ip_Arraw;

 

XdRs_Ip_Arraw.prototype.initialize = function() {

    Sprite.prototype.initialize.call(this);

    this._setType = 0;

    if (this.setBitmap() || this.setArraw()){}

};

XdRs_Ip_Arraw.prototype.setBitmap = function() {

    this.bitmap = new Bitmap(40,30);

};

XdRs_Ip_Arraw.prototype.setArraw = function() {

    this.bitmap.clear();

    this.bitmap.setLineColor('rgba(255,0,255,0.5)');

    this.bitmap.fontSize = 14;

    this.bitmap.drawText('>',0,5,30,20,'center') 

    this.bitmap.fontSize = 32;

    this.bitmap.drawText('>',0,0,40,30,'center') 

};

XdRs_Ip_Arraw.prototype.move = function(x,y) {

    Sprite.prototype.move.call(this,x,y);

    this._setType = 0;

};

XdRs_Ip_Arraw.prototype.update = function() {

    Sprite.prototype.update.call(this);

    this.updateTrends();

};

XdRs_Ip_Arraw.prototype.updateTrends = function() {

    if (Graphics.frameCount%3 != 0) return;

    if (this._setType<10) {

        this._setType++;this.x += 1;

        if (this._setType == 5) this._setType = 20;

    }else{

        this._setType--;this.x -= 1;

        if (this._setType == 15) this._setType = 0;

    }

};

//===============================================================================================================

function XdRs_Ip_Cmd() {

    this.initialize.apply(this, arguments);

}

XdRs_Ip_Cmd.prototype = Object.create(XdRs_Ip_UiBase.prototype);

XdRs_Ip_Cmd.prototype.constructor = XdRs_Ip_Remake;

 

XdRs_Ip_Cmd.prototype.initialize = function(x,y,w,h,type,text) {

    XdRs_Ip_UiBase.prototype.initialize.call(this,x,y,w,h);

    this._addX = this._addY = 0;

    this._wid = w;this._het = h;this._text = text;

    this._dataArraw = this._isArraw = 0;

    this._presCount = 0;this._type = type;

    if (this.drawBack() || this.drawCmd()){}

};

XdRs_Ip_Cmd.prototype.setAdd = function(x,y) {

    this._addX = x;this._addY = y;

};

XdRs_Ip_Cmd.prototype.hide = function() {

    while(this.visible) this.visible = false;

};

XdRs_Ip_Cmd.prototype.show = function() {

    while(!this.visible) this.visible = true;

};

XdRs_Ip_Cmd.prototype.setText = function(text) {

    this._text = text;this.drawCmd();

};

XdRs_Ip_Cmd.prototype.drawBack = function() {

    this.bitmap.clear();

    this._cw = !this._type ? this._wid / 3 : this._wid;

    var data = !this._type ? this.drawBack0() : this.drawBack1();

};

XdRs_Ip_Cmd.prototype.drawBack0 = function() {

    var cw = this._cw;

    var b1 = 'rgba(80,80,80,0)',b2 = 'rgba(80,80,80,1)'

    this.bitmap.gradientFillRect(0,0,cw,this._het,b1,b2);

    this.bitmap.fillRect(cw-1,0,this._wid-cw+2,this._het,b2);

    this.bitmap.clearRect(0,1,this._wid-1,this._het-2);

    b1 = 'rgba(0,0,0,0)',b2 = 'rgba(0,0,0,1)'

    this.bitmap.gradientFillRect(0,1,cw,this._het-2,b1,b2);

    this.bitmap.fillRect(cw-1,1,this._wid-cw+2,this._het-2,b2);

    this.bitmap.clearRect(0,2,this._wid-2,this._het-4);

    var c1 = this.backColor(0,0),c2 = this.backColor(1,1);

    this.bitmap.gradientFillRect(0,2,cw,this._het-4,c1,c2);

    this.bitmap.fillRect(cw-1,2,this._wid-cw-1,this._het-4,c2);

};

XdRs_Ip_Cmd.prototype.drawBack1 = function() {

    this.drawRect(0,0,this._cw,this._het,3,1);

};

XdRs_Ip_Cmd.prototype.drawCmd = function() {

    this.clear();

    var color = !!this._isArraw ? 'rgba(255,0,255,0.5)' : 'rgba(0,0,0,0.5)';

    this.setLineColor(color);this.setFontSize(this._het / 2);

    color = !!this._isArraw ? 'rgb(255,255,255)' : 'rgb(160,160,160)';

    var cx = this._cw;this.setFontColor(color),ax = !this._type ? cx : 0;

    this.drawText(this._text,ax,2,this._wid-ax,this._het-4,'center');

};

XdRs_Ip_Cmd.prototype.setState = function(state) {

    this._isArraw = state;

};

XdRs_Ip_Cmd.prototype.pres = function() {

    this.scale.x = this.scale.y = 0.98;

    this._presCount = 10;

};

XdRs_Ip_Cmd.prototype.update = function() {

    XdRs_Ip_UiBase.prototype.update.call(this);

    if (this.updateBack() || this.updateArraw() || this.updatePres()){}

};

XdRs_Ip_Cmd.prototype.updateArraw = function() {

    if (this._dataArraw === this._isArraw) return;

    this._dataArraw = this._isArraw;

    this.drawCmd();

};

XdRs_Ip_Cmd.prototype.updatePres = function() {

    if (!this._presCount) return;

    this._presCount--;

    if (!this._presCount) this.scale.x = this.scale.y = 1;

};

XdRs_Ip_Cmd.prototype.area = function() {

    return new Rectangle(this.x+this._addX,this.y+this._addY,this._wid,this._het);

};

//===============================================================================================================

function XdRs_Ip_Item() {

    this.initialize.apply(this, arguments);

}

XdRs_Ip_Item.prototype = Object.create(XdRs_Ip_UiBase.prototype);

XdRs_Ip_Item.prototype.constructor = XdRs_Ip_Item;

 

XdRs_Ip_Item.prototype.initialize = function() {

    this._wid = 620;this._het = 340;

    this._addX = this._addY = 0;

    var x = (720 - this._wid) <span style="color: #0066FF;">/ 2,y = (540 - this._het) / 2 - 20;

    XdRs_Ip_UiBase.prototype.initialize.call(this,x,y,this._wid,this._het);

    this._wordData = XdRsData.IpEquip.setWords.split(',');

    this._type = 0;this._items = [];

    if (this.setPage() || this.drawBack()){}

    if (this.drawAll() || this.createCmd()){}

};

XdRs_Ip_Item.prototype.setAdd = function(x,y) {

    this._addX = x;this._addY = y;

};

XdRs_Ip_Item.prototype.hide = function() {

    this.visible = false;

    this._cmd.map(function(c){c.visible = false;});

};

XdRs_Ip_Item.prototype.show = function() {

    this.visible = true;

    this._cmd.map(function(c){c.visible = true;});

};

XdRs_Ip_Item.prototype.item = function(index) {

    return this.pageItems()[index];

};

XdRs_Ip_Item.prototype.pres = function(index) {

    return this._cmd[index].pres();

};

XdRs_Ip_Item.prototype.cmds = function() {

    return this._cmd;

};

XdRs_Ip_Item.prototype.setItems = function(items,type) {

    this._items = items;this._type = type;

    if (this.setPage() || this.drawAll()){}

};

XdRs_Ip_Item.prototype.setPage = function() {

    this._page = this._maxPage = 1;

    if (!this._items.length) return;

    this._maxPage = Math.ceil(this._items.length/10);

};

XdRs_Ip_Item.prototype.pageItems = function() {

    var min = (this._page-1) * 10;

    return this._items.slice(min,min+10);

};

XdRs_Ip_Item.prototype.page = function(num) {

    this._page += num;

    if (!this._page) this._page = this._maxPage;

    if (this._page >= this._maxPage) this._page = 1;

    if (this.drawItems() || this.drawPage()){}

};

XdRs_Ip_Item.prototype.setColorType = function(type) {

    XdRs_Ip_UiBase.prototype.setColorType.call(this,type);

    this._cmd[0].setColorType(type);

    this._cmd[1].setColorType(type);

};

XdRs_Ip_Item.prototype.createCmd = function() {

    this._cmd = [];

    var cmd1 = new XdRs_Ip_Cmd(100,280,110,40,1,'上一页');

    var cmd2 = new XdRs_Ip_Cmd(410,280,110,40,1,'下一页');

    cmd1.setAdd(this.x+this._addX+50,this.y+this._addY+40);

    cmd2.setAdd(this.x+this._addX+50,this.y+this._addY+40);

    this._cmd.push(cmd1,cmd2);

    this.addChild(cmd1);this.addChild(cmd2);

};

XdRs_Ip_Item.prototype.setShow = function(index) {

    this._cmd[0].setState(0);

    this._cmd[1].setState(0);

    if (index == 2) return;

    this._cmd[index].setState(1);

};

XdRs_Ip_Item.prototype.drawBack = function() {

    this.drawRect(0,0,this._wid,this._het,4,0);

    this.bitmap.fillRect(4,4,this._wid-8,40,this.backColor(1));

    this.bitmap.fillRect(4,44,this._wid-8,2,'rgb(80,80,80)');

    for (var i=0;i<10;i++){

        var x = i % 2 * 300 + 30,y = Math.floor(i / 2) * 42 + 60;

        this.drawRect(x,y,260,40,3,1);

    }

};

XdRs_Ip_Item.prototype.drawAll = function() {

    if (this.drawMess() || this.drawItems() || this.drawPage()){}

};

XdRs_Ip_Item.prototype.drawMess = function() {

    this.clearRect(4,8,this._wid-8,32);

    var text = '请选择用于'+this._wordData[this._type]+'的物品';

    this.setLineColor('rgba(255,120,0,0.5)');

    this.drawText(text,4,8,this._wid-8,32,'center');

};

XdRs_Ip_Item.prototype.drawItems = function() {

    this.clearRect(30,60,560,270);

    var items = this.pageItems();

    if (!items.length) return;

    for (var i=0;i<items.length;i++){

        var x = i % 2 * 300 + 38,y = Math.floor(i / 2) * 42 + 64;

        this.drawItem(items[i],x,y);

        var text = 'x'+$gameParty.numItems(items[i]);

        this.drawText(text,x+160,y,82,32,'right');

    }

};

XdRs_Ip_Item.prototype.drawPage = function() {

   if (this.setFontSize(22) || this.setLineColor()){}

   var text = ''+this._page + ' / '+this._maxPage;

   this.drawText(text,4,285,this._wid-8,32,'center');

};

XdRs_Ip_Item.prototype.itemArea = function() {

   return new Rectangle(this.x+this._addX+30,this.y+this._addY+60,560,205);

};

//===============================================================================================================

function XdRs_Ip_Tip() {

    this.initialize.apply(this, arguments);

}

XdRs_Ip_Tip.prototype = Object.create(XdRs_Ip_UiBase.prototype);

XdRs_Ip_Tip.prototype.constructor = XdRs_Ip_Tip;

 

XdRs_Ip_Tip.prototype.initialize = function() {

    this._wid = 720;this._het = 120;

    var x = 0,y = (540 - this._het) / 2;

    XdRs_Ip_UiBase.prototype.initialize.call(this,x,y,this._wid,this._het);

    this._wordData = XdRsData.IpEquip.setWords.split(',');

    this._type = 0;this._runCount = 0;this._over = false;this._itemSet = false;

    this.drawBack();this.drawTit();

};

XdRs_Ip_Tip.prototype.hide = function() {

    this._itemSet = this.visible = false;

    this._over = false;

};

XdRs_Ip_Tip.prototype.isOver = function() {

    return this._over;

};

XdRs_Ip_Tip.prototype.isItem = function() {

    return this._itemSet;

};

XdRs_Ip_Tip.prototype.run = function(type) {

    this._type = type;this.drawTit();

    this.visible = true;this._runCount = 120;

    var seName = XdRsData.IpEquip.mkOkSe;

    if (!XdRsData.IpEquip.mkOkSe) return;

    AudioManager.playSe({"name":seName,"volume":100,"pitch":100,"pan":0});

};

XdRs_Ip_Tip.prototype.runColor = function() {

    var data = $gameSystem.ieColors()[$gameSystem.colorType()];

    data[3] = 1;

    var now = 80 + (120 - this._runCount);

    for (var i=0;i<3;i++){if (!!data[i]) data[i] = now;}

    return this.getColor(data);

};

XdRs_Ip_Tip.prototype.setItem = function(item, state) {

    this._item = item;this._state = state;

    this._itemSet = true;

    var name = !!state ? XdRsData.IpEquip.mkSucSe : XdRsData.IpEquip.mkFalSe;

    if (!!name) AudioManager.playSe({"name":name,"volume":100,"pitch":100,"pan":0});

    this.drawTip();

};

XdRs_Ip_Tip.prototype.titText = function() {

    return this._wordData[this._type] + '中';

};

XdRs_Ip_Tip.prototype.tipText = function() {

    var text = this._wordData[this._type];

    text += !!this._state ? '成功' : '失败';

    text = this._type  < 2 ? (!!this._type ? '得到物品' : '得到装备') : text;

    return text;

};

XdRs_Ip_Tip.prototype.drawBack = function() {

    this.bitmap.clear();

    var cw = this._wid / 5;

    var c1 = 'rgba(20,20,20,1)',c2 = 'rgba(20,20,20,0)';

    this.bitmap.gradientFillRect(0,0,cw,this._het,c2,c1);

    this.bitmap.gradientFillRect(this._wid-cw,0,cw,this._het,c1,c2);

    this.bitmap.fillRect(cw,0,this._wid-cw*2,this._het,c1);

    this.bitmap.clearRect(0,2,this._wid,this._het-4);

    var b1 = this.backColor(0,1),b2 = this.backColor(0,0);

    this.bitmap.gradientFillRect(0,2,cw,this._het-4,b2,b1);

    this.bitmap.gradientFillRect(this._wid-cw,2,cw,this._het-4,b1,b2);

    this.bitmap.fillRect(cw,2,this._wid-cw*2,this._het-4,b1);

};

XdRs_Ip_Tip.prototype.drawTit = function() {

    this.clear();

    var cw = this._wid / 5;

    var cx = this._cot.bitmap.measureTextWidth(this.titText());

    var x = (this._wid-cx) / 2;

    this.drawSysText(this.titText(), x, 15);

    this._cot.bitmap.fillRect(238,60,244,34);

    this.clearRect(240,62,240,30);

};

XdRs_Ip_Tip.prototype.drawTip = function() {

    this.clear();

    var cw = this._wid / 5;

    var cx = this._cot.bitmap.measureTextWidth(this.tipText());

    var x = (this._wid-cx) / 2,y = this._type < 2 ? 15 : 50;

    var color = !!this._state ? 'rgb(0,180,0)' : 'rgb(180,0,0)';

    this.setFontColor(color);this.setLineColor();

    this.drawText(this.tipText(), x, y, cx, 32);

    if (this._type == 1 && !this._item) {

        this.setFontColor('rgb(180,0,0)');

        this.drawText('- - - -', 0, y+36, this._wid, 32, 'center');

    }else{if (!!this._item)this.drawItem(this._item, x, y+36);}

};

XdRs_Ip_Tip.prototype.drawRun = function() {

    var x = 240 + (120 - this._runCount) * 2;

    this._cot.bitmap.fillRect(x,62,2,30,this.runColor());

};

XdRs_Ip_Tip.prototype.update = function() {

    XdRs_Ip_UiBase.prototype.update.call(this);

    this.updateRun();

};

XdRs_Ip_Tip.prototype.updateRun = function() {

    if (!this._runCount || !!(Graphics.frameCount % 2)) return;

    this.drawRun();this._runCount--;

    if (!this._runCount) this._over = true;

};

//===============================================================================================================

function XdRs_Ip_Remake() {

    this.initialize.apply(this, arguments);

}

XdRs_Ip_Remake.prototype = Object.create(XdRs_Ip_UiBase.prototype);

XdRs_Ip_Remake.prototype.constructor = XdRs_Ip_Remake;

 

XdRs_Ip_Remake.prototype.initialize = function() {

    this._wid = 720;this._het = 540;

    var x = (Graphics.width - this._wid) <span style="color: #0066FF;">/ 2,y = (Graphics.height - this._het) / 2;

    XdRs_Ip_UiBase.prototype.initialize.call(this,x,y,this._wid,this._het);

    this.iniData();

};

XdRs_Ip_Remake.prototype.iniData = function() {

    this._aconType = 0;this._waitCount = 0;

    this._dataCmdIndex = this._cmdIndex = 0;

    this._dataEquipIndex = this._equipIndex = 0;

    this._dataItemIndex = this._itemIndex = 0;

    this._dataColorndex = this._colorIndex = 0;

    this._wordData = XdRsData.IpEquip.setWords.split(',');

    this._goldData = [XdRsData.IpEquip.makeGold,XdRsData.IpEquip.dabGold];

    this._goldData.push(XdRsData.IpEquip.rprGold,XdRsData.IpEquip.stgGold);

    this._goldData.push(XdRsData.IpEquip.starGold,XdRsData.IpEquip.sltGold,XdRsData.IpEquip.gemGold);

    if (this.setEquips() || this.setupPage()){}

};

XdRs_Ip_Remake.prototype.start = function() {

    if (this.drawBack() || this.drawAll()){}

    if (this.createCmd() || this.createWindows() || this.createArraw()){}

};

XdRs_Ip_Remake.prototype.setEquips = function() {

    this._nowEquips = this.equipsForType();

    this._setEquip = null;this._setItem = null;

};

XdRs_Ip_Remake.prototype.equip = function() {

    if (this._setEquip == null) return null;

    return this._nowEquips[this._setEquip];

};

XdRs_Ip_Remake.prototype.setupPage = function() {

    if (!this._nowEquips.length) {this._page = this._maxPage = 0;return;}

    this._page = 1;

    this._maxPage = Math.ceil(this._nowEquips.length / 8);

};

XdRs_Ip_Remake.prototype.pageEquips = function() {

    if (!this._page) return [];

    var min = (this._page - 1) * 8;

    return this._nowEquips.slice(min,min+8);

};

XdRs_Ip_Remake.prototype.equipsForType = function() {

    if (!!this._index) return $gameParty.equipItems();

    return XdRsData.IpEquip.canMakeEquips();

};

XdRs_Ip_Remake.prototype.gold = function() {

    if (!this.equip() || this._index == 7) return 0;

    var num = this._goldData[this._index];

    var equip = this.equip();

    if (this._index < 2) {num = num * equip.price / 100;}

    else{

        switch(this._index){

            case 2:

                if (!this._item) return 0;

                var add = Math.min(equip.dbtMax-equip.dbt,this.itemNum());

                num = num * add * equip.price / 100 ;break;

            case 3:num += num * equip.stgCount ;break;

            case 4:num += num * equip.starCount;break;

            case 5:num += num * equip.slots.length;break;

            case 6:num += num * XdRsData.IpEquip.gemsSize(equip);

        }

    }

    return Math.ceil(num);

};

XdRs_Ip_Remake.prototype.itemsForType = function() {

    if (!this.equip()) return [];

    switch(this._index){

        case 0:return this.equip().materials;

        case 1:return this.equip().materials;

        case 2:return $gameParty.repairItems();

        case 3:return $gameParty.stgItems();

        case 4:return $gameParty.starItems();

        case 5:return $gameParty.sltItems();

        case 6:return $gameParty.gemItems();

    }

};

XdRs_Ip_Remake.prototype.itemRate = function() {

    switch(this._index){

        case 3:return XdRsData.IpEquip.upRate2(this.equip());

        case 4:return XdRsData.IpEquip.upRate1(this.equip(),this._item);

    }

};

XdRs_Ip_Remake.prototype.itemNum = function() {

    if (!this._item) return 0;

    switch(this._index){

        case 2:return +this._item.note.match(<span style="color: #0066FF;">/<XIERepair:(\S+)>/)[1];

        case 4:return +this._item.note.match(<span style="color: #0066FF;">/<XIESr:(\S+)>/)[1];

    }

};

XdRs_Ip_Remake.prototype.typeShow = function(equip) {

    switch(this._index){

        case 2:return ''+equip.dbt+':'+equip.dbtMax;

        case 3:return '+'+equip.stgCount;

        case 4:return '☆'+equip.starCount;

        case 5:return ''+equip.slots.length+':'+'6';

        case 6:return ''+XdRsData.IpEquip.gemsSize(equip)+':'+equip.slots.length;

    }

    return '';

};

XdRs_Ip_Remake.prototype.drawBack = function() {

    if (this.drawTitBack() || this.drawMesBack()){}

};

XdRs_Ip_Remake.prototype.drawAll = function() {

    if (this.drawTit() || this.drawType()){}

    if (this.drawPageEquips() || this.drawPageItems()){}

};

XdRs_Ip_Remake.prototype.drawTitBack = function() {

    var cx = this._wid / 3;

    var b1 = 'rgba(0,0,0,0)',b2 = 'rgba(0,0,0,1)';

    var c1 = this.backColor(0,0),c2 = this.backColor(1,1);

    this.bitmap.clearRect(0,0,this._wid,48);

    this.bitmap.gradientFillRect(0,0,cx,48,b1,b2);

    this.bitmap.fillRect(cx-2,0,cx+4,48,b2);

    this.bitmap.gradientFillRect(cx*2,0,cx,48,b2,b1);

    this.bitmap.clearRect(0,2,this._wid,44);

    this.bitmap.gradientFillRect(0,2,cx,44,c1,c2);

    this.bitmap.fillRect(cx-2,2,cx+4,44,c2);

    this.bitmap.gradientFillRect(cx*2,2,cx,44,c2,c1);

};

XdRs_Ip_Remake.prototype.drawMesBack = function() {

    var cx = this._wid / 3,ch = this._het-60;

    var b1 = 'rgba(0,0,0,0)',b2 = 'rgba(0,0,0,1)';

    this.bitmap.clearRect(0,60,this._wid,ch);

    this.bitmap.gradientFillRect(0,60,cx,ch,b1,b2);

    this.bitmap.fillRect(cx-2,60,cx+4,ch,b2);

    this.bitmap.gradientFillRect(cx*2,60,cx,ch,b2,b1);

    this.bitmap.clearRect(0,63,this._wid,ch-6);

    this.bitmap.fillRect(205,60,3,ch,b2);

    this.drawMesType();

};

XdRs_Ip_Remake.prototype.drawMesType = function() {

    var cx = this._wid / 3,ch = this._het-66;

    var b1 = this.backColor(0,0),b2 = this.backColor(0,1);

    this.bitmap.clearRect(208,63,this._wid-207,ch);

    this.bitmap.gradientFillRect(cx*2,63,cx,ch,b2,b1);

    var c1 = this.backColor(1,1),c2 = this.backColor(0,1);

    this.bitmap.gradientFillRect(208,63,this._wid-207-cx,ch,c1,c2);

    if (this._index == 7) return;

    this.drawRect(215,110,240,286,3,1,8);

};

XdRs_Ip_Remake.prototype.drawPalette = function() {

    if (this._index != 7) return;

    this.clearRect(208,63,this._wid-207,this._het-66);

    var c1 = 'rgba(20,20,20,0.8)',c2 = 'rgba(20,20,20,0)';

    var b1 = 'rgba(255,255,255,1)',b2 = 'rgba(255,255,255,0)';

    for (var i=0;i<8;i++){

        this.bitmap.gradientFillRect(240,90+i*60,360,2,c1,c2);

        if (i==7) continue;

        this.bitmap.gradientFillRect(340,95+i*60,260,52,b1,b2);

        var data = $gameSystem.ieColors()[i];

        var i1 = this.getColor(data,1),i2 = this.getColor(data,0);

        this.bitmap.gradientFillRect(345,100+i*60,250,42,i1,i2);

    }

};

XdRs_Ip_Remake.prototype.drawTit = function() {

    this.setFontSize(30);

    var text = XdRsData.IpEquip.titWord;

    this.drawText(text,0,2,this._wid,44,'center');

};

XdRs_Ip_Remake.prototype.drawType = function() {

    this.clearRect(0,60,this._wid,this._het-60);

    if (this._index == 7) {

         //this.bitmap.fillRect(360,90,240,420,'rgb(0,0,0)');

         for (var i=0;i<7;i++){

            var text = $gameSystem.colorType() == i ? '◆' : '◇';

            this.setLineColor();

            this.drawText(text,240,105+i*60,32,32);

            this.drawSysText('颜色'+(i+1),270,105+i*60);

         }

        return;

    }

    var text = '请选择你要'+this._wordData[this._index]+'的装备';

    this.drawSysText(text,215,72,'center');

};

XdRs_Ip_Remake.prototype.drawPageEquips = function() {

    this._dataPage = this._page;

    if (!this._page) {

        this.setFontSize(20);this.setLineColor();

        this.setFontColor('rgb(200,0,0)');

        this.drawText('当前没有对应装备',215,115,240,30,'center');

        return;

    }

    var equips = this.pageEquips();this.clearRect(215,110,240,286);

    for (var i=0;i<equips.length;i++){

        var x = 226,y = i*35+115;

        var text = this._setEquip == i+(this._page-1)*8 ? '◆' : '◇';

        this.drawNomText(text,x,y+2);

        this.drawItem(equips[i],x+30,y);

        if (this.typeShow(equips[i]) !== '') {

            this.setFontColor('rgb(255,255,255)');

            this.drawText(this.typeShow(equips[i]),x+155,y,60,30,'right');

        }

    }

    this.clearRect(215,395,240,32);

    this.drawNomText('页数: ',215,398);

    var text = ''+this._page+' / '+this._maxPage;

    this.setFontSize(20);this.setFontColor();this.setLineColor();

    this.drawText(text,215,395,240,32,'center');

};

XdRs_Ip_Remake.prototype.drawPageItems = function() {

    this.clearRect(455,110,240,450);

    if (this._index == 7) return;

    var ax = 465,ay = 115;

    var text = this._index == 1 ? '得到材料:' : [0,3,5].contains(this._index) ? '需要材料:' : '使用材料:';

    this.drawSysText(text,ax,ay);

    var ny = 150;

    if (this._index < 2) {ny = this.drawMts(ax,ny);}

    else{if (!!this._item){

            this.drawItem(this._item,ax,ny);

            if (this._index != 6) {

                var num = this.itemNum();

                this.drawText('+'+num,ax+140,ny,86,30,'center');

            }

            if (this._index == 4) {

                ny += 40;

                this.drawSysText('成功率:',ax,ny);

                var rate = this.itemRate();this.setLineColor();

                this.drawText(''+rate+'%',ax+120,ny,86,30,'right');

            }     

        }else if ([3,5].contains(this._index)){

            var item = this.itemsForType()[0];

            if (!!item) {

                this.drawItem(item,ax,ny);

                if (this._index == 5 || this.equip()) {

                    var num = this._index == 5 ? 1 : XdRsData.IpEquip.needStgNum(this.equip());

                    var color = $gameParty.numItems(item) < num ? 'rgb(255,0,0)' : 'rgb(0,200,0)';

                    this.setFontColor(color);

                    num = ''+$gameParty.numItems(item)+' : '+num;

                    this.drawText(num,ax+140,ny,86,30,'center');

                }

                if (this._index == 3 && this.equip()) {

                  ny += 40;

                  this.drawSysText('成功率:',ax,ny);

                  var rate = this.itemRate();this.setLineColor();

                  this.drawText(''+rate+'%',ax+120,ny,86,30,'right');

               }

            }

         }

         else{if (!this._item) {

            this.drawNomText('待选择',ax,ny, 'rgb(200,0,0)');}

        }

        ny += 30;

    }

    ay = ny + 10;

    var text = '需要'+TextManager.currencyUnit+':';

    this.drawSysText(text,ax,ay);

    if (!!this.equip()) {

        var color = $gameParty.gold() < this.gold() ? 'rgb(255,0,0)' : 'rgb(0,200,0)';

        this.drawNomText(''+this.gold(),ax,ay+32,color);

    }

};

XdRs_Ip_Remake.prototype.drawMts = function(x,y) {

    var items = this.itemsForType();

    if (!!items.length) {

        if (this._index < 2){

            for (var i=0;i<items.length;i++){

              var item = $dataItems[items[i].id];

              this.drawItem(item,x,y);

              if (this._index == 1) {y += 32;continue;}

              var color = $gameParty.numItems(item) < items[i].num ? 'rgb(255,0,0)' : 'rgb(0,200,0)';

              var text = ''+$gameParty.numItems(item)+' : '+items[i].num;

              this.setFontColor(color);

              this.drawText(text,x+140,y,86,30,'center');

              y += 32;

            }

        }

    }

    return y;

};

XdRs_Ip_Remake.prototype.createCmd = function() {

    if (!!this._cmds && !!this._cmds.length) return;

    this._cmds = [];

    for (var i=0;i<8;i++){

        var word = i == 7 ? '背景颜色' : '装备'+this._wordData[i];

        var cmd = new XdRs_Ip_Cmd(0,70+i*58,200,56,0,word);

        this._cmds.push(cmd);this.addChild(cmd);

    }

    this._cmds[this._index].setState(1);

    this.createEquipCmd();

};

XdRs_Ip_Remake.prototype.createEquipCmd = function() {

    if (this._equipCmd && this._equipCmd.length) return;

    this._equipCmd = [];

    var words = ['上一页','下一页',this._wordData[this._index],'取消']

    for (var i=0;i<4;i++){

        var x = i % 2 * 135 + 215,y = Math.floor(i / 2) * 50 + 430;

        var cmd = new XdRs_Ip_Cmd(x,y,105,40,1,words[i]);

        cmd.setAdd(this.x,this.y);

        this._equipCmd.push(cmd);this.addChild(cmd);

    }

};

XdRs_Ip_Remake.prototype.removeCmd = function() {

    this._equipCmd = this._equipCmd || [];

    if (this._equipCmd.length) {

        for (var i=0;i<4;i++){this.removeChild(this._equipCmd[i]);}

    }

    this._equipCmd.length = 0;

    if (!!this._arraw){this.removeChild(this._arraw);this._arraw = null;}

};

XdRs_Ip_Remake.prototype.createWindows = function() {

    this._itemW = new XdRs_Ip_Item();

    this._tip   = new XdRs_Ip_Tip();

    if (this._itemW.setAdd(this.x,this.y) || this.addChild(this._itemW)){}

    if (this._tip.hide() || this.addChild(this._tip)){}

};

XdRs_Ip_Remake.prototype.setHelp = function(help) {

    this._help = help;

};

XdRs_Ip_Remake.prototype.createArraw = function() {

    if (!!this._arraw) return;

    this._arraw = new XdRs_Ip_Arraw();

    if (this.setArrawPlace() || this.addChild(this._arraw)){}

};

XdRs_Ip_Remake.prototype.update = function() {

    XdRs_Ip_UiBase.prototype.update.call(this);

    if (this.updateWindow() || this.updateInput() || this.updateTouch()){}

};

XdRs_Ip_Remake.prototype.updateBack = function() {

    if (this._dataColorType == $gameSystem.colorType()) return;

    XdRs_Ip_UiBase.prototype.updateBack.call(this);

    if (this.drawPalette() || this.drawType()){}

};

XdRs_Ip_Remake.prototype.updateWindow = function() {

    if (this._aconType != 2 && this._itemW.visible && this._itemW.hide()){}

    if (this._aconType == 2 && !this._itemW.visible && this._itemW.show()){}

    if (this._aconType != 4 && this._tip.visible && this._tip.hide()){}

    this.updateHelp();

};

XdRs_Ip_Remake.prototype.updateHelp = function() {

    if (!this._help) return;

    if ([0,3,4].contains(this._aconType)){this._help.setItem(null);return;}

    if (this._aconType == 1){

        this._help.setItem(this.pageEquips()[this._equipIndex]);

        this._help.setPlace(460,150+this._equipIndex*35);

    }  

    if (this._aconType == 2){

        this._help.setItem(this.itemsForType()[this._itemIndex]);

        var x = (this._itemIndex + 1) % 2 * 440 + 20;

        var y = Math.floor(this._itemIndex / 2) * 40 + 190;

        this._help.setPlace(x,y);

    }

};

XdRs_Ip_Remake.prototype.updateInput = function() {

    if (!!this._waitCount) {this._waitCount--;return;}

    if (this._aconType == 0) {

        if (Input.isRepeated('cancel')&& this.forCel0()){}

        if (Input.isRepeated('ok')    && this.forOk0()){}

        if (Input.isRepeated('down')  && this.setIndex(this._index+1)){}

        if (Input.isRepeated('up')    && this.setIndex(this._index-1)){}

    }else if (this._aconType == 1) {

        if (Input.isRepeated('cancel')&& this.forCel1()){}

        if (Input.isRepeated('ok')    && this.forOk1()){}

        if (this._equipIndex < 8) {

            if (Input.isRepeated('down')  && this.setIndex(this._equipIndex+1)){}

            if (Input.isRepeated('up')    && this.setIndex(this._equipIndex-1)){}

        }else{

            if (Input.isRepeated('left') || Input.isRepeated('right')) {

                var add = Input.isRepeated('left') ? -1 : 1;

                this.setIndex(this._equipIndex + add);}

            if (Input.isRepeated('down')) {var index = this._equipIndex + 2;this.setIndex(index);}

            if (Input.isRepeated('up')) {

                var index = this._equipIndex == 8 ? this._equipIndex - 1 : this._equipIndex - 2;

                this.setIndex(index);} 

        }

    }else if (this._aconType == 2){

        if (Input.isRepeated('cancel')&& this.forCel2()){}

        if (Input.isRepeated('ok')    && this.forOk2()){}

        if (Input.isRepeated('down')  && this.setIndex(this._itemIndex+2)){}

        if (Input.isRepeated('up')    && this.setIndex(this._itemIndex-2)){}

        if (Input.isRepeated('left')  && this.setIndex(this._itemIndex-1)){}

        if (Input.isRepeated('right') && this.setIndex(this._itemIndex+1)){}

    }else if (this._aconType == 3){

        if (Input.isRepeated('cancel')&& this.forCelColor()){}

        if (Input.isRepeated('ok')    && this.forOkColor()){}

        if (Input.isRepeated('down')  && this.setIndex(this._colorIndex+1)){}

        if (Input.isRepeated('up')    && this.setIndex(this._colorIndex-1)){}

    }else{this.updateTip();

          if (Input.isRepeated('cancel') || Input.isRepeated('ok')) this.forCelTip();}

};

XdRs_Ip_Remake.prototype.updateTouch = function() {

    if (TouchInput.isCancelled() && this.setTouchCel()){}

    if (TouchInput.isRepeated()){

        switch(this._aconType){

            case 0:return this.setTouchIndex();

            case 1:return this.setTouchEquip();

            case 2:return this.setTouchItem();

            case 3:return this.setTouchColor();

            case 4:return this.forCelTip();

        }

    }

};

XdRs_Ip_Remake.prototype.setTouchCel = function() {

    switch(this._aconType){

        case 0:this.forCel0()    ;return;

        case 1:this.forCel1()    ;return;

        case 2:this.forCel2()    ;return;

        case 3:this.forCelColor();return;

        case 4:this.forCelTip()  ;return;  

    }

};

XdRs_Ip_Remake.prototype.setTouchIndex = function() {

    if (!TouchInput.inRect(this.cmdArea())) return;

    for (var i=0;i<8;i++){

        var area = this._cmds[i].area();

        area.x += this.x;area.y+= this.y;

        if (TouchInput.inRect(area)){

            if (this._index == i) {this.forOk0();}

            else{this.setIndex(i);}  

        }

    }

};

XdRs_Ip_Remake.prototype.setTouchEquip = function() {

    if (TouchInput.inRect(this.equipArea())) {

       var index =  Math.floor((TouchInput.y - 113 - this.y) / 35);

       if (this._equipIndex == index) {this.forOk1();}

       else{this.setIndex(index);}

       return;

    }

    for (var i=0;i<4;i++){

        if (TouchInput.inRect(this._equipCmd[i].area())) {

            if (this._equipIndex != i+8) {this.setIndex(i+8);return;}

            switch(i){

                case 0:this.setPage(-1)  ;return;

                case 1:this.setPage(1)   ;return;

                case 2:this.startReform();return;

                case 3:this.forCel1()    ;return;

            }

        }

    }

};

XdRs_Ip_Remake.prototype.setTouchItem = function() {

    if (TouchInput.inRect(this._itemW.itemArea())){

      for (var i=0;i<10;i++){

        var x = i % 2 * 330 + this.x + this._itemW.x;

        var y = Math.floor(i / 2) * 42 + 60 + this.y + this._itemW.y;

        var rect = new Rectangle(x,y,260,40);

        if (TouchInput.inRect(rect)){

            if (this._itemIndex != i){this.setIndex(i);}

            else{this.forOk2();}

        }

      }

    }

    if (TouchInput.inRect(this._itemW.cmds()[0].area())) {

       if (this._itemIndex != 10) {this.setIndex(10);return;}

       SoundManager.playOk();

       this._itemW.page(-1);this._itemW.pres(0);

    }

    if (TouchInput.inRect(this._itemW.cmds()[1].area())) {

       if (this._itemIndex != 11) {this.setIndex(11);return;}

       SoundManager.playOk();

       this._itemW.page(1);this._itemW.pres(1);

    }

};

XdRs_Ip_Remake.prototype.setTouchColor = function() {

    if (TouchInput.inRect(this.colorArea())){

        var index = Math.floor((TouchInput.y - this.y - 95) / 60);

        if (this._colorIndex != index){this.setIndex(index);return;}

        this.forOkColor();

    }

};

XdRs_Ip_Remake.prototype.setIndex = function(num) {

    if (this._aconType == 0){

        this._index = num;

        if (this._index > 7) this._index = 0;

        if (this._index < 0) this._index = 7;

    }else if (this._aconType == 1) {

        this._equipIndex = num;

        if (this._equipIndex > 11) this._equipIndex = 0;

        if (this._equipIndex < 0)  this._equipIndex = 10;

    }else if (this._aconType == 2){

        this._itemIndex = num;

        if (this._itemIndex > 11) this._itemIndex = 0;

        if (this._itemIndex < 0)  this._itemIndex = 10;

    }else{

        this._colorIndex = num;

        if (this._colorIndex > 6) this._colorIndex = 0;

        if (this._colorIndex < 0)  this._colorIndex = 6;

    }

    this.setArrawPlace();

};

XdRs_Ip_Remake.prototype.setPage = function(num) {

    this._page += num;

    SoundManager.playOk();

    var index = num < 0 ? 0 : 1;

    this._equipCmd[index].pres();

    if (this._page > this._maxPage) this._page = 1;

    if (!this._page) this._page = this._maxPage;

    if (this._dataPage != this._page && this.drawPageEquips()){}

};

XdRs_Ip_Remake.prototype.updateIndex = function() {

    if (this._aconType == 0) {

      if (this._dataIndex == this._index) return;

      XdRs_Ip_UiBase.prototype.updateIndex.call(this);

      for (var i=0;i<8;i++){this._cmds[i].setState(this._index == i ? 1 : 0);}

      this.updateShow();

    } else if (this._aconType == 1) {

        if (this._dataEquipIndex == this._equipIndex) return;

        SoundManager.playCursor();

        this._dataEquipIndex = this._equipIndex;

        this.setArrawPlace();

        if (this._equipIndex < 7 && !!this._equipIndex) return;

        for (var i=0;i<4;i++){this._equipCmd[i].setState(this._equipIndex-8 == i ? 1 : 0);}

    }else if (this._aconType == 2){

        if (this._dataItemIndex == this._itemIndex) return;

        SoundManager.playCursor();

        this._dataItemIndex = this._itemIndex;this.setArrawPlace();

        var index = this._itemIndex == 10 ? 0 : this._itemIndex == 11 ? 1 : 2;

        this._itemW.setShow(index);

    }else{

        if (this._dataColorIndex == this._colorIndex) return;

        this._dataColorIndex = this._colorIndex;

        SoundManager.playCursor();this.setArrawPlace();

    }

};

XdRs_Ip_Remake.prototype.updateShow = function() {

    this.drawMesType();

    if (this._index == 7) {

        if (this.removeCmd() || this.drawMesBack() || this.drawPalette() || this.drawType()){}

        this.createArraw();return;

    }

    if (this.setEquips() || this.setupPage() || this.drawType()){}

    if (this.drawPageEquips() || this.drawPageItems()){}

    if (this.createEquipCmd() || this._equipCmd[2].setText(this._wordData[this._index])){}

    this.createArraw();

};

XdRs_Ip_Remake.prototype.updateTip = function() {

    if (!this._tip.isOver()) return;

    if (!this._tip.isItem()) this.reMake();

};

XdRs_Ip_Remake.prototype.setArrawPlace = function() {

    if (!this._arraw) return;

    if (this._aconType == 0) {

        this._arraw.move(15,84+this._index * 58);

    }else if (this._aconType == 1 || this._aconType == 4) {

        if (this._equipIndex < 8) {this._arraw.move(200,115+this._equipIndex * 35);}

        else{var i = this._equipIndex-8;

            var x = i % 2 * 135 + 180,y = Math.floor(i / 2) * 50 + 435;

            this._arraw.move(x,y);}

    }else if (this._aconType == 2){ 

        if (this._itemIndex < 10) {

            var x = this._itemIndex % 2 * 300 + 45,y = Math.floor(this._itemIndex / 2) * 42 + 145;

        }else{var x = (this._itemIndex-10) * 310 + 120,y = 364;}

        this._arraw.move(x,y);

    }else{

        var x = 200,y = this._colorIndex * 60 + 105;

        this._arraw.move(x,y);

    }

};

XdRs_Ip_Remake.prototype.forOkColor = function() {

    if (this._colorIndex == this._colorType) return;

    SoundManager.playOk();

    $gameSystem.setColorType(this._colorIndex);

};

XdRs_Ip_Remake.prototype.forCelColor = function() {

    SoundManager.playCancel();

    this._aconType = 0;

    this.setArrawPlace();

};

XdRs_Ip_Remake.prototype.forCelTip = function() {

    if (!this._tip.isOver()) return;

    SoundManager.playOk();

    this._tip.hide();

    this._aconType = 1;

    this.setArrawPlace();

    this._waitCount = 10;

};

XdRs_Ip_Remake.prototype.forOk0 = function() {

    SoundManager.playOk();

    this._aconType = this._index == 7 ? 3 : 1;

    this._cmds[this._index].pres();

    this.setArrawPlace();

};

XdRs_Ip_Remake.prototype.forCel0 = function() {

    SoundManager.playCancel();

    SceneManager.goto(Scene_Map);

};

XdRs_Ip_Remake.prototype.forOk1 = function() {

    if (this._equipIndex < 8) {

        if (!this.pageEquips()[this._equipIndex]) {SoundManager.playBuzzer();return;}

        SoundManager.playOk();

        var index = (this._page-1) * 8 + this._equipIndex;

        if (this._setEquip !== index) {

           this._setEquip = index;this._item = null;

           if (this.drawPageEquips() || this.drawPageItems()){}

        }else{

            if (!this._item && !!this._index && this._index%2 == 0) {

                this.startItemcmd();return;

            }

            this._waitCount = 10;this.setIndex(10);

        }

    }

    if (!!this._waitCount) return;

    if (this._equipIndex == 8  && this.setPage(-1)){}

    if (this._equipIndex == 9  && this.setPage(1)){}

    if (this._equipIndex == 10 && this.startReform()){}

    if (this._equipIndex == 11 && this.forCel1()){}

};

XdRs_Ip_Remake.prototype.forCel1 = function() {

    SoundManager.playCancel();

    this._aconType = 0;this._setEquip = null;this._item = null;

    this._dataEquipIndex = this._equipIndex = 0;

    if (this.drawPageEquips() || this.drawPageItems()){}

    for (var i=0;i<4;i++){this._equipCmd[i].setState(0);}

    this.setArrawPlace();

};

XdRs_Ip_Remake.prototype.forOk2 = function() {

    if (this._itemIndex < 10) {

        if (!this._itemW.item(this._itemIndex)){SoundManager.playBuzzer();return;}

        else{SoundManager.playOk();

            this._item = this._itemW.item(this._itemIndex);

            this.drawPageItems();this._aconType = 1;

            this.setIndex(10);this.setArrawPlace();

        }

    }else{

        var num = this._itemIndex == 10 ? -1 : 1;

        SoundManager.playOk();

        this._itemW.page(num);this._itemW.pres(this._itemIndex-10);

    }

};

XdRs_Ip_Remake.prototype.forCel2 = function() {

    SoundManager.playCancel();

    this._aconType = 1;this.setArrawPlace();

};

XdRs_Ip_Remake.prototype.startItemcmd = function() {

    this._dataItemIndex = this._itemIndex = 0;

    this._aconType = 2;this.setArrawPlace();

    this._itemW.setItems(this.itemsForType(),this._index);

};

XdRs_Ip_Remake.prototype.startReform = function() {

    if (!this.mtsJudge()){SoundManager.playBuzzer();return;}

    this._aconType = 4;

    this._tip.run(this._index);

    this.expend();

};

XdRs_Ip_Remake.prototype.mtsJudge = function() {

    if (!this.equip() || $gameParty.gold() < this.gold()) return false;

    switch(this._index){

        case 0: var items = this.itemsForType();

                for (var i=0;i<items.length;i++){

                    var item = $dataItems[items[i].id];

                    if ($gameParty.numItems(item) < items[i].num) return false;

                }

                return true;

        case 1: return true;

        case 2: if (!this._item || this.equip().dbtMax == this.equip().dbt) return false;

                return true;

        case 3: var item = this.itemsForType()[0];

                if (!item || $gameParty.numItems(item) < XdRsData.IpEquip.needStgNum(this.equip())) return false;

                return true;

        case 4: if (!this._item || !XdRsData.IpEquip.canStarUp(this.equip())) return false;

                if (!$gameParty.numItems(this._item)) return false;

                return true;

        case 5: var item = this.itemsForType()[0];

                if (!item || !$gameParty.numItems(item)) return false;

                if (this.equip().slots.length == 6) return false;

                return true;

        case 6: if (!XdRsData.IpEquip.canSetGem(this.equip(),this._item)) return false;

                if (!$gameParty.numItems(this._item)) return false;

                return true;

    }

    return false;

};

XdRs_Ip_Remake.prototype.expend = function() {

    $gameParty.loseGold(this.gold());

    var items = [];

    switch(this._index){

        case 0:items = this.itemsForType();break; 

        case 2:items.push({'id':this._item.id,'num':1});break; 

        case 3:items.push({'id':this.itemsForType()[0].id,'num':XdRsData.IpEquip.needStgNum(this.equip())});break; 

        case 4:items.push({'id':this._item.id,'num':1});break; 

        case 5:items.push({'id':this.itemsForType()[0].id,'num':1});break; 

        case 6:items.push({'id':this._item.id,'num':1});break; 

    }

    if (!items.length) return;

    for (var i=0;i<items.length;i++){

        $gameParty.loseItem($dataItems[items[i].id], items[i].num);

    }

    this.drawPageItems();

};

XdRs_Ip_Remake.prototype.reMake = function() {

    var item = null,state = true;

    switch(this._index){

        case 0:var qt = st = 0;

            if ($gameSwitches.value(XdRsData.IpEquip.cnSwitch)){

                qt = XdRsData.IpEquip.addData[2];

                st = XdRsData.IpEquip.addData[3];

            }

            XdRsData.IpEquip.addEquip(this.equip(),qt,st);

            var type = XdRsData.IpEquip.addData[0],id = XdRsData.IpEquip.addData[1];

            item = type == 2 ? $dataArmors[id] : $dataWeapons[id];

            $gameParty.gainItem(item,1);break;

        case 1:if (Math.randomInt(100) < 80 && this.itemsForType().length > 0) {

            var data = this.itemsForType()[Math.randomInt(this.itemsForType().length)];

            item = $dataItems[data.id];

            $gameParty.gainItem(item,1);}

            $gameParty.loseEquip(this.equip(),0);

            this.setEquips();break;

        case 2:XdRsData.IpEquip.repair(this.equip(),this._item);break;    

        case 3:if (Math.randomInt(100) < this.itemRate()) {

            XdRsData.IpEquip.stgUp(this.equip());}

            else{state = false;}break;

        case 4:if (Math.randomInt(100) < this.itemRate()) {

             XdRsData.IpEquip.starUp(this.equip()); 

             }else{state = false;}break;

        case 5:XdRsData.IpEquip.slotting(this.equip());break;

        case 6:XdRsData.IpEquip.setGem(this.equip(),this._item);break;

    }

    this._tip.setItem(item,state);

    if (!$gameParty.numItems(this._item)) this._item = null;

    this.drawPageEquips();this.drawPageItems();

};

XdRs_Ip_Remake.prototype.cmdArea = function() {

    return new Rectangle(this.x+62,this.y+72,135,460);

};

XdRs_Ip_Remake.prototype.equipArea = function() {

    return new Rectangle(this.x+218,this.y+113,234,280);

};

XdRs_Ip_Remake.prototype.colorArea = function() {

    return new Rectangle(this.x+240,this.y+95,360,420);

};

//==================================================================================================================

function Xr_ItemMessage() {

    this.initialize.apply(this, arguments);

}

 

Xr_ItemMessage.prototype = Object.create(XdRs_Ip_UiBase.prototype);

Xr_ItemMessage.prototype.constructor = Xr_ItemMessage;

 

Xr_ItemMessage.prototype.initialize = function() {

    XdRs_Ip_UiBase.prototype.initialize.call(this);

};

Xr_ItemMessage.prototype.setItem = function(item) {

    if (this._item === item) return;

    this._item = item;this.renew();

    this.visible = !!item;

};

Xr_ItemMessage.prototype.setPlace = function(x,y) {

    if (this.x === x && this.y === y) return;

    x = x.clamp(0,Graphics.width-320);

    y = y.clamp(0,Graphics.height-this.heightCount());

    if (this.x === x && this.y === y) return;

    this.move(x,y);

};

Xr_ItemMessage.prototype.heightCount = function() {

    if (!this._item) return 0;

    var height = 95;

    if (!DataManager.isItem(this._item)) height += 140;

    if (XdRsData.IpEquip.isEquip(this._item)) height += 80;

    if (XdRsData.IpEquip.isEquip(this._item) && !!this._item.slots.length) height += 55;

    var n = this.getGemsWord().length;

    if (!!n) height += n * 26 + 12;

    if (!!this._item.description){height += this.getDpHeight()+8;}

    return height;

};

Xr_ItemMessage.prototype.renew = function() {

    this.removeShow();this._count = 0;

    if (!this._item) return;

    this._x = 5;this._y = 8;

    this.bitmap = new Bitmap(320, this.heightCount());

    this.bitmap.clear();

    this.drawBack();this.drawItemName();

    if (DataManager.isItem(this._item)){this.drawItem();}

    else{this.drawEquip();}

};

Xr_ItemMessage.prototype.removeShow = function() {

    this._stars = this._stars || [];

    this._gems = this._gems   || [];

    if (this._stars.length) {

    for (var i=0;i<this._stars.length;i++){this.removeChild(this._stars[i]);}

    this._stars.length = 0;}

    if (this._gems.length) {

    for (var i=0;i<this._gems.length;i++){this.removeChild(this._gems[i]);}

    this._stars._gems = 0;}

};

Xr_ItemMessage.prototype.drawItem = function() {

    if (this.drawMess() || this.drawDp()){}

};

Xr_ItemMessage.prototype.drawEquip = function() {

    this.drawStg();this.drawStar();

    this.drawMess();this.drawParams();

    this.drawGemWords();this.drawDp();

};

Xr_ItemMessage.prototype.setColor = function(r,g,b) {

   return 'rgb('+r+','+g+','+b+')';

};

Xr_ItemMessage.prototype.drawBack = function() {

    var x = 0, y = 0, w = this.bitmap.width, h = this.bitmap.height;

    var a = 120;

    for (var i=0;i<3;i++){

        this.bitmap.fillRect(x,y,w,h,this.setColor(a,a,a));

        x += 1;y += 1; w -= 2; h -= 2; a -= 30;

    }

    for (var i=0;i<2;i++){

        this.bitmap.fillRect(x,y,w,h,this.setColor(a,a,a));

        x += 1;y += 1; w -= 2; h -= 2; a += 20;

    }

    this.bitmap.clearRect(x,y,w,h);

    this.bitmap.fillRect(x,y,w,h,this.backColor(0,0.8));

};

Xr_ItemMessage.prototype.setKun = function(x,y,w,h,type) {

    var a = 100;

    for (var i=0;i<3;i++){

        this.bitmap.fillRect(x,y,w,h,this.setColor(a,a,a));

        x += 1;y += 1; w -= 2; h -= 2; a -= 30;

    }

    this.bitmap.fillRect(x,y,w,h,this.backColor(type,1));

};

Xr_ItemMessage.prototype.drawItemName = function() {

    var pw = Window_Base._iconWidth;

    var ph = Window_Base._iconHeight;

    this.bitmap.fillRect(this._x,this._y,308,ph+8,'rgb(120,120,120)');

    this._x += 8; this._y += 4;

    this.setKun(this._x-4,this._y-4,pw+8,ph+8,0);

    var bitmap = ImageManager.loadSystem('IconSet');

    var sx = this._item.iconIndex % 16 * pw;

    var sy = Math.floor(this._item.iconIndex / 16) * ph;

    this.bitmap.blt(bitmap, sx, sy, pw, ph, this._x, this._y);

    var color = XdRsData.IpEquip.nameColor(this._item);

    this.bitmap.textColor = color;

    this.bitmap.fontSize = 24;

    this.bitmap.smooth = false;

    var tw = this.bitmap.width - 100;

    this.bitmap.drawText(this._item.name, this._x + 38, this._y, tw, 32, 'center');

    this._x = 5; this._y += 40;

};

Xr_ItemMessage.prototype.drawStg = function() {

    if (!XdRsData.IpEquip.isEquip(this._item)) return;

    this.bitmap.textColor = 'rgb(200,100,0)';

    this.bitmap.drawText('+ '+this._item.stgCount, this._x + 252, this._y-40, 48, 32, 'right');

};

Xr_ItemMessage.prototype.drawStar = function() {

    if (!XdRsData.IpEquip.isEquip(this._item)) return;

    this.setKun(this._x,this._y,310,26,40);

    if (!this._item.starCount) {this._y += 30;return;}

    for (var j=0; j<this._item.starCount; j++){

      var star = new Sprite(ImageManager.loadPicture('IDPD_Mess'));

      star.setFrame(0,0,14,14);star.move(j*15+this._x+4,this._y+5);

      this._stars.push(star);this.addChild(star);

    }

    this._y += 30;

};

Xr_ItemMessage.prototype.drawMess = function() {

    this._x = 10;

    if (XdRsData.IpEquip.isEquip(this._item)) this.drawEquipWord(this._x,this._y);

    if (!DataManager.isItem(this._item)) this.drawLimit(this._x,this._y);

    this.drawPrice(this._x,this._y);

    if (XdRsData.IpEquip.isEquip(this._item)) this.drawDbt(this._x,this._y);

    this._y += 5;

}

Xr_ItemMessage.prototype.drawParams = function() {

    this.setKun(this._x,this._y,300,116,0);

    var ax,ay,txt,color;

    for (var i=0;i<8;i++){

        this.bitmap.fontSize = 16;

        ax = i % 2 * 150 + this._x + 8; ay = ~~(i / 2) * 28 + this._y;

        this.setKun(ax+56,ay+4,80,24,1);

        txt = TextManager.param(i);

        this.bitmap.textColor = 'rgb(0,255,255)';

        this.bitmap.drawText(txt, ax, ay+7, 54, 20, 'right');

        this.bitmap.textColor = 'rgb(255,255,255)';

        this.bitmap.fontSize = 12;

        this.bitmap.drawText('+', ax+60, ay+8, 20, 20);

        this.bitmap.fontSize = 16;

        txt = ''+this._item.params[i];

        this.bitmap.textColor = XdRsData.IpEquip.paramColor(this._item,i);

        this.bitmap.drawText(txt, ax+80, ay+7, 50, 20,'right');

    }

    this._y += 120;

};

Xr_ItemMessage.prototype.drawGemWords = function() {

    if (!this._item.slots || !this._item.slots.length) return;

    var words = this.getGemsWord();

    var ph = 48 +  words.length*26;

    this.bitmap.fontSize = 20;

    this.setKun(this._x,this._y,300,ph,0);

    this._y += 4;var ax = this._x+72;

    if (!!this._item.slots.length) {

        this.bitmap.textColor = 'rgb(0,200,200)';

        this.bitmap.drawText('插槽:', this._x+8, this._y+8, 48, 22);

        for (var i=0;i<this._item.slots.length;i++){

             var bitmap = ImageManager.loadPicture('IDPD_Mess');

             this.bitmap.blt(bitmap,70,0,32,32,this._x+62+i*38,this._y+3);

             if (this._item.slots[i] !== null) {

                var item = $dataItems[this._item.slots[i]];

                var gem = new Sprite(ImageManager.loadSystem('IconSet'));

                gem.setFrame(item.iconIndex%16*32,Math.floor(item.iconIndex/16)*32,32,32);

                gem.scale.x = gem.scale.y = 0.6;gem.move(this._x+68+i*38,this._y+10);

                this._gems.push(gem); this.addChild(gem);

             }

        }

        this._y += 34;

    }

    this.bitmap.fontSize = 16;

    if (!!words.length) {

        for (var i=0;i<words.length;i++){

             var ax = this._x + 5,ay = this._y + i * 26 + 6;

             this.setKun(ax,ay,290,24,1);

             this.bitmap.textColor = 'rgb(0,200,0)';

             this.bitmap.drawText('★', ax+5, ay, 22, 22);

             this.bitmap.textColor = 'rgb(255,0,200)';

             this.bitmap.drawText(words[i], ax+30, ay, 260, 22);

        }

    }

    this._y += words.length * 26 + 22;

};

Xr_ItemMessage.prototype.drawDp = function() {

    if (!this._item.description) {return;}

    this._x = 5; 

    this.bitmap.fillRect(this._x,this._y,310,this.getDpHeight(),'rgb(0,0,0)');

    this.bitmap.textColor = 'rgb(0,200,200)';

    this.bitmap.fontSize = 20;

    var text = this._item.description.split(''),len = text.length;

    this._x += 20; this._y += 5;

    for (var i=0;i<len;i++){

        var cx = this.bitmap.measureTextWidth(text[i]);

        if (this._x+cx >= 305) {this._x = 6; this._y += 24;}

        this.bitmap.drawText(text[i], this._x, this._y, cx, 24);

        this._x += cx;

    }

};

Xr_ItemMessage.prototype.getGemsWord = function() {

    var data = [];

    if (!XdRsData.IpEquip.isEquip(this._item)) return data;

    for (var i=0;i<this._item.slots.length;i++){

        if (!this._item.slots[i]) continue;

        data.push(this.gemWord($dataItems[this._item.slots[i]]));

    }

    return data;

};

Xr_ItemMessage.prototype.gemWord = function(item) {

    var text = '';

    for (var i=0;i<item.effects.length;i++){

        if (item.effects[i].code != 42) continue;

        text += TextManager.param(item.effects[i].dataId) +'增加'+item.effects[i].value1+';';

    }

    return text;

};

Xr_ItemMessage.prototype.drawEquipWord = function() {

    this.bitmap.fontSize = 16;

    this.bitmap.textColor = XdRsData.IpEquip.nameColor(this._item);

    var text = '〓 '+XdRsData.IpEquip.qtWord(this._item) + ' '+XdRsData.IpEquip.equipKind(this._item)+' 〓';

    this.bitmap.drawText(text, this._x, this._y, 240, 24);

    this._y += 25;

};

Xr_ItemMessage.prototype.drawLimit = function() {

    this.bitmap.fontSize = 16;

    this.bitmap.textColor = 'rgb(0,255,255)';

    this.bitmap.drawText('等级:', this._x, this._y, 80, 24);

    this.bitmap.textColor = 'rgb(255,255,255)';

    XdRsData.IpEquip.setLimites(this._item);

    this.bitmap.drawText(''+this._item.limit[0].num, this._x+50, this._y+2, 140, 20);

    this._y += 25;

};

Xr_ItemMessage.prototype.drawPrice = function() {

    this.bitmap.fontSize = 16;

    this.bitmap.textColor = 'rgb(0,255,255)';

    this.bitmap.drawText('价格:', this._x, this._y, 50, 24);

    this.bitmap.textColor = 'rgb(255,255,255)';

    this.bitmap.drawText(''+this._item.price, this._x+50, this._y+2, 140, 20);

    this._y += 25;

};

 

Xr_ItemMessage.prototype.drawDbt = function() {

    this.bitmap.fontSize = 16;

    this.bitmap.textColor = 'rgb(0,255,255)';

    this.bitmap.drawText('耐久度:', this._x, this._y, 68, 24);

    this.bitmap.textColor = XdRsData.IpEquip.dbtColor(this._item);

    this.bitmap.drawText(''+this._item.dbt +':'+this._item.dbtMax, this._x+68, this._y+2, 140, 20);

    this._y += 25;

};

Xr_ItemMessage.prototype.getDpHeight = function() {

    return Math.ceil((this._item.description.length + 1) / 16) * 24 + 12;

};

Xr_ItemMessage.prototype.update = function() {

    Sprite.prototype.update.call(this);

    this.updateFrame();

};

Xr_ItemMessage.prototype.updateFrame = function() {

    if (!this._stars || !this._stars.length) return;

    this._count = (this._count + 1) % 50;

    if (!(this._count % 10)) {

        for (var i=0;i<this._stars.length;i++){

            this._stars[i].setFrame(Math.floor(this._count / 10)*14,0,14,14);

        }

    }

};

//==================================================================================================================

function XdRs_EquipReform() {

    this.initialize.apply(this, arguments);

}

 

XdRs_EquipReform.prototype = Object.create(Scene_Base.prototype);

XdRs_EquipReform.prototype.constructor = XdRs_EquipReform;

 

XdRs_EquipReform.prototype.initialize = function() {

    Scene_Base.prototype.initialize.call(this);

};

XdRs_EquipReform.prototype.create = function() {

    Scene_Base.prototype.create.call(this);

    this.createBackground();

    this.createBackWindow();

    this.createHelpWindow();

};

XdRs_EquipReform.prototype.createBackground = function() {

    this._backgroundSprite = new Sprite();

    this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();

    this.addChild(this._backgroundSprite);

};

XdRs_EquipReform.prototype.createBackWindow = function() {

    this._back = new XdRs_Ip_Remake();

    this.addChild(this._back);

};

XdRs_EquipReform.prototype.createHelpWindow = function() {

    this._help = new Xr_ItemMessage();

    this.addChild(this._help);

    this._back.setHelp(this._help);

};

XdRs_EquipReform.prototype.start = function() {

    Scene_Base.prototype.start.call(this);

    SceneManager.clearStack();

    this._back.start();

};

//==================================================================================================================
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top