/*:
* @plugindesc v1.1 经验储蓄池
* @author CHK
*
* @help
* 【救命!】
* ----------------------------------------------------------------
* [插件指令]
* 打开储蓄池
*
* ----------------------------------------------------------------
* [脚本]
* ①打开储蓄池:SceneManager.push(Scene_ExpBox);
* ②变更储蓄池的经验:$gameSystem.BGEWexp(X);
* 【例子-经验+100】$gameSystem.BGEWexp(100);
* 【例子-经验-100】$gameSystem.BGEWexp(-100);
*
* ----------------------------------------------------------------
* 插件如果有漏洞的话请在这个网站联系我ε=( o`ω′)ノ。
* [url]https://rpg.blue/thread-491758-1-1.html[/url]
*
*
* @param ---经验储蓄设定---
* @default
*
* @param 通关经验比例
* @desc 战斗通关给与的经验值按比例放入储蓄池中。
* 默认10%(%符号不用写)
* @default 10
*
* @param 储蓄上限
* @desc 储蓄池中保管的经验值上限。默认100万(单位万)
* @default 100
*
* @param [分配经验]命令名称
* @desc 默认[分配经验]
* @default 分配经验
*
*
*
*
*
* @param ---奖励折算设定---
* @default
*
* @param 折算奖励
* @desc 把储蓄池中的经验值折算为金币、或道具。
* 金币填写0,道具填写它的ID。默认0
* @default 0
*
* @param 转换比例
* @desc 将储蓄池中的经验按比例转换。默认100
* 【100】每100点经验给1枚金币或1个道具。
* @default 100
*
* @param [折算奖励]命令名称
* @desc 默认[折算奖励]
* @default 折算奖励
*
*
*
*
*
* @param ---声音设定---
* @default
*
* @param 打开-储蓄池时的声音
* @type file
* @dir audio/se/
* @desc 请确保游戏中有该se声音文件。清空就不播放声音。
* 默认Book1
* @default Book1
*
* @param 打开-声音的音量
* @desc 默认90
* @default 90
*
* @param 打开-声音的加速
* @desc 默认100
* @default 100
*
*
* @param 分配-成功时的声音
* @type file
* @dir audio/se/
* @desc 请确保游戏中有该se声音文件。清空就不播放声音。
* 默认Recovery
* @default Recovery
*
* @param 分配-声音的音量
* @desc 默认90
* @default 90
*
* @param 分配-声音的加速
* @desc 默认100
* @default 100
*
*
* @param 折算-成功时的声音
* @type file
* @dir audio/se/
* @desc 请确保游戏中有该se声音文件。清空就不播放声音。
* 默认Shop2
* @default Shop2
*
* @param 折算-声音的音量
* @desc 默认90
* @default 90
*
* @param 折算-声音的加速
* @desc 默认100
* @default 100
*
*
*
*
*
* @param ---文字设定---
* @default
*
* @param 储蓄池标题
* @desc 默认战斗经验储蓄池。
* @default 战斗经验储蓄池
*
* @param 标题字号大小
* @desc 默认24
* @default 24
*
* @param 命令字号大小
* @desc 默认24
* @default 24
*
* @param 结算字号大小
* @desc 默认24
* @default 24
*
* @param 金币名称
* @desc 默认金币
* @default 金币
*
* @param 背景图片
* @desc 填写图片的名字,不用写格式。默认无。
* 请把图片放在 img/pictures 的文件夹里。
* @default
*/
var parameters = PluginManager.parameters('CHK_ExpBox');
var JYCX1 = Number(parameters['通关经验比例'] || 10);
JYCX1 *= 0.01;
var JYCX2 = Number(parameters['储蓄上限'] || 100);
JYCX2 *= 10000;
var JYCX3 = String(parameters['[分配经验]命令名称'] || '分配经验');
var JLZS1 = Number(parameters['折算奖励'] || 0);
var JLZS2 = Number(parameters['转换比例'] || 100);
var JLZS3 = String(parameters['[折算奖励]命令名称'] || '折算奖励');
var name1 = String(parameters['打开-储蓄池时的声音']);
var se1 = name1?{"name":name1,"volume":Number(parameters['打开-声音的音量']||90),"pitch":Number(parameters['打开-声音的加速']||100),"pan":0}:'';
var name2 = String(parameters['分配-成功时的声音']);
var se2 = name2?{"name":name2,"volume":Number(parameters['分配-声音的音量']||90),"pitch":Number(parameters['分配-声音的加速']||100),"pan":0}:'';
var name3 = String(parameters['折算-成功时的声音']);
var se3 = name3?{"name":name3,"volume":Number(parameters['折算-声音的音量']||90),"pitch":Number(parameters['折算-声音的加速']||100),"pan":0}:'';
var WZSD1 = String(parameters['储蓄池标题'] || '战斗经验储蓄池');
var WZSD2 = Number(parameters['标题字号大小'] || 24);
var WZSD3 = Number(parameters['命令字号大小'] || 24);
var WZSD4 = Number(parameters['结算字号大小'] || 24);
var WZSD5 = String(parameters['金币名称'] || '金币');
var BJSD = String(parameters['背景图片'] || '');
if (BJSD) ImageManager.loadBitmap('img/pictures/', BJSD, 0, true);
//-----------------------------------------------------------------------------
function Window_ExpBox() {
this.initialize.apply(this, arguments);
}
Window_ExpBox.prototype = Object.create(Window_Command.prototype);
Window_ExpBox.prototype.constructor = Window_ExpBox;
Window_ExpBox.prototype.initialize = function() {
Window_Command.prototype.initialize.call(this, 0, 0);
this.refresh();
if (BJSD) this.opacity = 0;
};
Window_ExpBox.prototype.windowWidth = function() {
return 716-180;
};
Window_ExpBox.prototype.windowHeight = function() {
return 576;
};
Window_ExpBox.prototype.standardFontSize = function() {
return WZSD3;
};
Window_ExpBox.prototype.standardPadding = function() {
return 0;
};
Window_ExpBox.prototype.itemTextAlign = function() {
return 'center';
};
Window_ExpBox.prototype.itemRect = function(index) {
var rect = new Rectangle();
var maxCols = this.maxCols();
rect.width = this.itemWidth()-18*2;
rect.height = this.itemHeight();
rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX+18;
rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;
rect.y = rect.y+this.windowHeight()-rect.height*2-this.standardPadding()-this.standardFontSize();
return rect;
};
Window_ExpBox.prototype.makeCommandList = function() {
this.addCommand(JYCX3, 'FPexp');
this.addCommand(JLZS3, 'ZSitem');
};
Window_ExpBox.prototype.refresh = function() {
Window_Command.prototype.refresh.call(this);
if (!BJSD) {
this.contents.paintOpacity = 77;
this.contents.fillRect(2, 30, this.contentsWidth()-4, this.contentsHeight()-220, this.textColor(15));
this.contents.paintOpacity = 200;
this.contents.gradientFillRect(2, 2, this.contentsWidth()-4, 28, '#5d76ad', '#000000',90);
this.contents.gradientFillRect(2, 30, (this.contentsWidth()-4)/2, 1, '#000000', '#5d5d5d');
this.contents.gradientFillRect((this.contentsWidth()-4)/2+2, 30, (this.contentsWidth()-4)/2, 1, '#5d5d5d', '#000000');
this.contents.paintOpacity = 255;
};
var item = JLZS1>0?$dataItems[JLZS1]:null;
var name = JLZS1>0?item.name:WZSD5;
this.changeTextColor(this.textColor(JLZS1>0?(item.meta.颜色?item.meta.颜色:16):6));
var s = JLZS1>0?$gameParty.numItems(item):$gameParty.gold();
var max = JLZS1>0?$gameParty.maxItems():$gameParty.maxGold();
if (s>=max) this.changeTextColor(this.textColor(18));
this.drawText('背包持有['+name+']:'+s+(s>=max?'(上限)':''), 0, 350, this.contentsWidth(), 'center');
this.contents.fontSize = 16;
this.changeTextColor(this.textColor(8));
this.drawText(WZSD1, 0, -3, this.contentsWidth(), 'center');
this.resetFontSettings();
var w = 200;
var h = 274;
var x = parseInt((this.contentsWidth()-w)/2);
var y = this.contentsHeight()-h-this.itemHeight()*2-18*2-126;
this.contents.paintOpacity = 155;
this.contents.fillRect(x, y, w, h, this.textColor(15));
this.contents.paintOpacity = 255;
var s = $gameSystem.EWexpBFB()/100;
h = parseInt(270 * s);
y = this.contentsHeight()-h-this.itemHeight()*2-18*2-130;
this.contents.gradientFillRect(x+2, y+2, w-4, h, this.textColor(24), this.textColor(3),90);
this.changeTextColor(this.textColor(24));
this.drawText($gameSystem.EWexp()+'('+$gameSystem.EWexpBFB()+'%)', 0, 35, this.contentsWidth(), 'center');
var yy = 388;
this.changeTextColor(this.textColor(8));
this.drawText('①战斗通关时敌人经验值的'+(JYCX1*100)+'%累计在此。', 18, yy, this.contentsWidth());
this.drawText('②经验值最高累计至'+(JYCX2/10000)+'万,超过无效。', 18, yy+this.standardFontSize(), this.contentsWidth());
this.drawText('③可将经验分配给指定角色,或折算['+name+']。', 18, yy+this.standardFontSize()*2, this.contentsWidth());
this.resetFontSettings();
};
//-----------------------------------------------------------------------------
function Window_ExpActor() {
this.initialize.apply(this, arguments);
}
Window_ExpActor.prototype = Object.create(Window_MenuStatus.prototype);
Window_ExpActor.prototype.constructor = Window_ExpActor;
Window_ExpActor.prototype.initialize = function() {
Window_MenuStatus.prototype.initialize.call(this, 0, 0);
this.deactivate();
this.deselect();
if (BJSD) this.opacity = 0;
};
Window_ExpActor.prototype.windowWidth = function() {
return 180;
};
Window_ExpActor.prototype.windowHeight = function() {
return 576;
};
Window_ExpActor.prototype.drawItem = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRect(index);
this.changePaintOpacity(!actor.isMaxLevel());
var h = parseInt((this.windowHeight()-18*2)/4);
this.contents._context.imageSmoothingEnabled = false;
this.drawActorFace(actor, rect.x+5, rect.y, h-10, h-10);
this.contents._context.imageSmoothingEnabled = true;
this.contents.fontSize = 16;
var y = rect.y+h;
this.drawText(actor.level+'级 '+actor.name(), rect.x, y-40, rect.width, 'center');
var nexp = actor.currentExp()-actor.expForLevel(actor.level);
var mexp = actor.nextLevelExp()-actor.expForLevel(actor.level);
var changdu = actor.isMaxLevel()? 1 : nexp/mexp;
var text = actor.isMaxLevel()? '∞' : nexp+'/'+mexp;
var yanse1 = actor.isMaxLevel()? '#bda461' : '#00731e';
var yanse2 = actor.isMaxLevel()? '#f5d682' : '#00ff43';
this.contents.gradientFillRect(rect.x, y-10, rect.width, 10, '#474747',this.textColor(15),90);
this.contents.gradientFillRect(rect.x+1, y-9, (rect.width-2)*changdu, 8, yanse2, yanse1,90);
this.contents.fontSize = 13;
this.drawText(text, rect.x, y-25, rect.width, 'center');
this.changePaintOpacity(true);
};
//-----------------------------------------------------------------------------
function Window_ZsBox() {
this.initialize.apply(this, arguments);
}
Window_ZsBox.prototype = Object.create(Window_Command.prototype);
Window_ZsBox.prototype.constructor = Window_ZsBox;
Window_ZsBox.prototype.initialize = function() {
Window_Command.prototype.initialize.call(this, 0, 0);
this.x = Math.ceil((Graphics.width - this.width) / 2)-(536-this.width)/2;
this.y = Math.ceil((Graphics.height - this.height) / 2)-10;
this._ZsShu = 0;
this._Actor = null;
this.deactivate();
this.hide();
};
Window_ZsBox.prototype.windowWidth = function() {
return 716/2;
};
Window_ZsBox.prototype.windowHeight = function() {
return 576/4;
};
Window_ZsBox.prototype.standardFontSize = function() {
return WZSD4;
};
Window_ZsBox.prototype.maxCols = function() {
if (!this._Actor&&$gameSystem.EWexpBFB()<1&&!this._ZsShu) return 1;
return 5;
};
Window_ZsBox.prototype.itemTextAlign = function() {
return 'center';
};
Window_ZsBox.prototype.spacing = function() {
return 0;
};
Window_ZsBox.prototype.itemRect = function(index) {
var rect = new Rectangle();
var maxCols = this.maxCols();
rect.width = this.itemWidth();
rect.height = this.itemHeight();
rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;
rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;
rect.y = rect.y+this.windowHeight()-rect.height-this.standardPadding()-this.standardFontSize();
return rect;
};
Window_ZsBox.prototype.makeCommandList = function() {
if (!this._Actor&&$gameSystem.EWexpBFB()<1&&!this._ZsShu) return this.addCommand('经验值不足1%无法折算!', 'ZJ4', false);
this.addCommand('+1%', 'ZJ1', $gameSystem.EWexpBFB()>=1);
this.addCommand('+10%', 'ZJ2', $gameSystem.EWexpBFB()>=10);
this.addCommand('全部', 'ZJ3', this._Actor?$gameSystem.EWexp()>0:$gameSystem.EWexpBFB()>=1);
this.addCommand('重置', 'ZJ4', this._ZsShu>0);
this.addCommand('确定', 'ZJok', this._ZsShu>0);
};
Window_ZsBox.prototype.refresh = function() {
Window_Command.prototype.refresh.call(this);
this.contents.paintOpacity = 255;
this.contents.fontSize = 20;
var text = this._Actor?'请输入给['+this._Actor.name()+']的额度。':'请输入想要折算的额度。';
this.drawText(text, 0, -5, this.contentsWidth(), 'center');
this.contents.fontSize = 18;
this.changeTextColor(this.textColor(24));
if (this._Actor) {
var actor = this._Actor;
var nexp = actor.currentExp()-actor.expForLevel(actor.level);
var mexp = actor.nextLevelExp()-actor.expForLevel(actor.level);
text = '距离升级还差'+(mexp-nexp)+'点经验。';
} else {
var dw = JLZS1>0?'个。':'枚。';
text = '经验值折算比例:1%'+'换'+Math.round(JYCX2*0.01/JLZS2)+dw;
};
this.drawText(text, 0, this.contents.fontSize, this.contentsWidth(), 'center');
this.changeTextColor(this.textColor(16));
text = '折算'+(JLZS1>0?$dataItems[JLZS1].name:WZSD5)+':'+this._ZsShu;
if (this._Actor) text = '给与经验:'+ this._ZsShu;
this.drawText(text, 0, this.contents.fontSize*2, this.contentsWidth(), 'center');
this.resetFontSettings();
};
//-----------------------------------------------------------------------------
function Scene_ExpBox() {
this.initialize.apply(this, arguments);
}
Scene_ExpBox.prototype = Object.create(Scene_MenuBase.prototype);
Scene_ExpBox.prototype.constructor = Scene_ExpBox;
Scene_ExpBox.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_ExpBox.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
if (se1) AudioManager.playSe(se1);
this._ExpBoxWindow = new Window_ExpBox();
this._ExpBoxWindow.setHandler('FPexp', this.onFpexpOk.bind(this));
this._ExpBoxWindow.setHandler('ZSitem', this.onZSitemOk.bind(this));
this._ExpBoxWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._ExpBoxWindow);
this._ExpActorWindow = new Window_ExpActor();
this._ExpActorWindow.setHandler('ok', this.onExpActorOk.bind(this));
this._ExpActorWindow.setHandler('cancel', this.onExpActorCancel.bind(this));
this.addChild(this._ExpActorWindow);
this._ZsBoxWindow = new Window_ZsBox();
this._ZsBoxWindow.setHandler('ZJ1', this.onZJ1Ok.bind(this));
this._ZsBoxWindow.setHandler('ZJ2', this.onZJ2Ok.bind(this));
this._ZsBoxWindow.setHandler('ZJ3', this.onZJ3Ok.bind(this));
this._ZsBoxWindow.setHandler('ZJ4', this.onZJ4Ok.bind(this));
this._ZsBoxWindow.setHandler('ZJok', this.onZJOk.bind(this));
this._ZsBoxWindow.setHandler('cancel', this.onZJCancel.bind(this));
this.addChild(this._ZsBoxWindow);
var w1 = this._ExpBoxWindow;
var w2 = this._ExpActorWindow;
w1.x = Math.ceil((Graphics.width - w1.width - w2.width) / 2);
w1.y = w2.y = Math.ceil((Graphics.height - w1.height) / 2);
w2.x = Math.ceil((Graphics.width - w2.width + w1.width) / 2);
};
Scene_ExpBox.prototype.createWindowLayer = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var x = (Graphics.width - width) / 2;
var y = (Graphics.height - height) / 2;
this._windowLayer = new WindowLayer();
this._windowLayer.move(x, y, width, height);
this.addChild(this._windowLayer);
};
Scene_ExpBox.prototype.createBackground = function() {
Scene_MenuBase.prototype.createBackground.call(this);
if (BJSD) {
this._ExpBoxBJ = new Sprite(ImageManager.loadPicture("lidexin1"));
this.addChild(this._ExpBoxBJ);
this._ExpBoxBJ.x = (Graphics.width-this._ExpBoxBJ.width)/2;
this._ExpBoxBJ.y = (Graphics.height-this._ExpBoxBJ.height)/2;
};
};
Scene_ExpBox.prototype.onFpexpOk = function() {
this._ExpActorWindow.activate();
this._ExpActorWindow.refresh();
this._ExpActorWindow.select(0);
};
Scene_ExpBox.prototype.onZSitemOk = function() {
this._ZsBoxWindow.show();
this._ZsBoxWindow.activate();
this._ZsBoxWindow.refresh();
this._ZsBoxWindow.select(0);
};
Scene_ExpBox.prototype.onExpActorOk = function() {
this._ZsBoxWindow._Actor = $gameParty.members()[this._ExpActorWindow.index()];
this._ZsBoxWindow.show();
this._ZsBoxWindow.activate();
this._ZsBoxWindow.refresh();
this._ZsBoxWindow.select(0);//
};
Scene_ExpBox.prototype.onExpActorCancel = function() {
this._ZsBoxWindow._Actor = null;
this._ExpActorWindow.deselect();
this._ExpBoxWindow.activate();
this._ExpBoxWindow.refresh();
this._ExpBoxWindow.select(0);
};
Scene_ExpBox.prototype.onZJ1Ok = function() {
var zs = this._ZsBoxWindow._Actor?1:JLZS2;
var s = Math.round(JYCX2*0.01/zs);
this._ZsBoxWindow._ZsShu += s;
$gameSystem.BGEWexp(-s*zs);
this._ZsBoxWindow.activate();
this._ZsBoxWindow.refresh();
this._ExpBoxWindow.refresh();
};
Scene_ExpBox.prototype.onZJ2Ok = function() {
var zs = this._ZsBoxWindow._Actor?1:JLZS2;
var s = Math.round(JYCX2*0.1/zs);
this._ZsBoxWindow._ZsShu += s;
$gameSystem.BGEWexp(-s*zs);
this._ZsBoxWindow.activate();
this._ZsBoxWindow.refresh();
this._ExpBoxWindow.refresh();
};
Scene_ExpBox.prototype.onZJ3Ok = function() {
var zs = this._ZsBoxWindow._Actor?1:JLZS2;
var s = Math.round($gameSystem.EWexp()/zs);
this._ZsBoxWindow._ZsShu += s;
$gameSystem.BGEWexp(-s*zs);
this._ZsBoxWindow.activate();
this._ZsBoxWindow.refresh();
this._ZsBoxWindow.select(4);
this._ExpBoxWindow.refresh();
};
Scene_ExpBox.prototype.onZJ4Ok = function() {
var zs = this._ZsBoxWindow._Actor?1:JLZS2;
$gameSystem.BGEWexp(this._ZsBoxWindow._ZsShu*zs);
this._ZsBoxWindow._ZsShu = 0;
this._ZsBoxWindow.activate();
this._ZsBoxWindow.refresh();
this._ExpBoxWindow.refresh();
};
Scene_ExpBox.prototype.onZJOk = function() {
var s = this._ZsBoxWindow._ZsShu;
if (this._ZsBoxWindow._Actor) {
if (se2) AudioManager.playSe(se2);
var i = this._ZsBoxWindow._Actor;
i.changeExp(i.currentExp()+s, false);
} else {
if (se3) AudioManager.playSe(se3);
if (JLZS1>0) {
$gameParty.gainItem($dataItems[JLZS1], s);
} else {
$gameParty.gainGold(s);
}
};
this._ZsBoxWindow._ZsShu = 0;
this.onZJCancel();
};
Scene_ExpBox.prototype.onZJCancel = function() {
if (this._ZsBoxWindow._ZsShu>0) {
var zs = this._ZsBoxWindow._Actor?1:JLZS2;
$gameSystem.BGEWexp(this._ZsBoxWindow._ZsShu*zs);
this._ZsBoxWindow._ZsShu = 0;
};
this._ZsBoxWindow.refresh();
this._ZsBoxWindow.hide();
this._ZsBoxWindow.deselect();
if (this._ZsBoxWindow._Actor) {
this._ExpActorWindow.activate();
this._ExpActorWindow.refresh();
this._ExpBoxWindow.refresh();
} else {
this._ExpBoxWindow.activate();
this._ExpBoxWindow.refresh();
};
};
//-----------------------------------------------------------------------------
Game_System.prototype.EWexp = function() {
if (!this._DREWexp) this._DREWexp = 0;
return this._DREWexp.clamp(0, JYCX2);
};
Game_System.prototype.BGEWexp = function(s) {
var exp = this.EWexp();
s = Math.round(s);
if (exp+s>JYCX2) s = JYCX2-exp;
this._DREWexp += s;
};
Game_System.prototype.EWexpBFB = function() {
return parseInt(this.EWexp() / JYCX2 * 100).clamp(0, 100);
};
var _EWBattleManager_gainExp = BattleManager.gainExp;
BattleManager.gainExp = function() {
_EWBattleManager_gainExp.call(this);
if (this._rewards && this._rewards.exp) $gameSystem.BGEWexp(parseInt(this._rewards.exp*JYCX1));
};
var _EWGame_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_EWGame_Interpreter_pluginCommand.call(this, command, args)
if (command === '打开储蓄池') SceneManager.push(Scene_ExpBox);
};