ItemBook and EnemyBook v1.4a by ScottyTV - FIX by MrCopra

omega9380

Veteran
Veteran
Joined
Mar 24, 2013
Messages
68
Reaction score
9
First Language
English
Primarily Uses
ItemBook and EnemyBook v1.4a by ScottyTV - FIX by MrCopra


Hey all!  To everyone who was having issues with the ItemBook and EnemyBook updates that ScottyTV and Yoji Ojima created back in 2015, I've got the fixed versions here.  Thanks to the efforts of the Javascript godling mrcopra, these scripts both work in v1.2 of RMMV.


Note:  I did not do the fixes for these plugins, I am not a coder.  Please direct all thanks to mrcopra, ScottyTV, and Yoji Ojima.  I am posting the fixes with mrcopra's permission.  Thanks, and enjoy!


Here's the code:


ItemBook v1.4

//=============================================================================
// ItemBook2.js
//=============================================================================

/*:
* @plugindesc v1.4a by SkottyTV // Displays detailed statuses of items.
* Fixed By mrcopra v1.1
* @author Yoji Ojima & SkottyTV (thx to DragonPC)
*
* @param ----- Functions -----
*
* @param Unknown Data
* @desc The index name for an unknown item.
* @default ??????
*
* @param AutoFill
* @desc Decide if items will automaticly show up in the book
* when collected. (true or false)
* @default true
*
* @param Gold Icon
* @desc Decide if you want to use the Gold Icon from
* Yanfly Core Engine. (true or false)
* @default false
*
* @param Items in Row
* @desc Decide how many items you want to show up in one row.
* (default 1)
* @default 1
*
* @param Show Key Items
* @desc Decide if you want to show the Key Items.
* (default true)
* @default true
*
* @param Half Index Height
* @desc Decide if you want to half the Index Window height.
* (default - true) (false will get overwritten by the damage window!)
* @default true
*
* @param Max Effects Count
* @desc Decide how many skills will be shown.
* (default - 7) (7 is recommended for small resolutions!)
* @default 7
*
* @param Max Skill Characters
* @desc Maximun amount of Characters displayed before "...".
* @default 17
*
* @param ----- Switches -----
*
* @param Show Price Switch
* @desc Choose the switch ID that shows the price.
* (default 0)
* @default 0
*
* @param Show Effects Switch
* @desc Choose the switch ID that shows the effects.
* (default 0)
* @default 0
*
* @param Show Equip/Type Switch
* @desc Choose the switch ID that shows the equip/type.
* (default 0)
* @default 0
*
* @param Show Parameters Switch
* @desc Choose the switch ID that shows the parameters.
* (default 0)
* @default 0
*
* @param ----- Visuals -----
*
* @param Line Opacity
* @desc Choose the opacity for the lines.
* (default - 120)
* @default 120
*
* @param Effects Values Color
* @desc Choose the color for the effects values.
* (default - 3)
* @default 3
*
* @param ----- Text -----
*
* @param Effects Text
* @desc The text for "Effects".
* @default Effects
*
* @param Parameter Text
* @desc The text for "Parameter".
* @default Parameter
*
* @param HP Regeneration Text
* @desc The text for "HP Regen".
* @default HP Regen:
*
* @param MP Regeneration Text
* @desc The text for "MP Regen".
* @default MP Regen:
*
* @param TP Gain Text
* @desc The text for "TP Gain".
* @default TP Gain:
*
* @param Add State Text
* @desc The text for "Add State".
* @default Add State:
*
* @param Remove State Text
* @desc The text for "Remove State".
* @default Remove State:
*
* @param Element Text
* @desc The text for "Element".
* @default Element:
*
* @param Element Rate Text
* @desc The text for "Element Rate".
* @default Element Rate:
*
* @param Attack Speed Text
* @desc The text for "Attack Speed".
* @default Attack Speed:
*
* @param Learn Skill Text
* @desc The text for "Learn Skill".
* @default Learn Skill:
*
* @param Equip Text
* @desc The text for "Equip".
* @default Equip:
*
* @param Type Text
* @desc The text for "Type".
* @default Type:
*
* @param Item Type Text
* @desc The text for "Item Type".
* @default Item Type:
*
* @param Success Rate Text
* @desc The text for "Success Rate".
* @default Success Rate:
*
* @help
*
* ============================================================================
* SkottyTV v1.1 ->
*
* - Decide if items will get an entry automaticly when they collected!
* - Decide how many items appear in one row!
* - Decide if you want to use the Gold Icon from Yanflys Core Engine!
* - Advanced Visual upgrades!
*
* SkottyTV v1.2 ->
*
* - Visual upgrades!
*
* SkottyTV v1.3 ->
*
* - Decide if you want to half the Index height.
* - Decide if you want to show Key Items.
* - Advanced Visual upgrades!
* - Use switches to enable different information!
* (Price, Equip/Type, Stats)
*
* SkottyTV v1.4a ->
*
* - Advanced Visual upgrades!
* - Added traits and effects window!
* - Use switches to enable different windows and informations!
* (Price, Equip/Type, Effects, Parameters)
* - Added Max Character Length for Skills and States text.(see bottom of help)
* - Bug fixes!
*
* ============================================================================
*
* Plugin Command:
* ItemBook open # Open the item book screen
* ItemBook add item 1 # Add item #1 to the item book
* ItemBook add weapon 2 # Add weapon #2 to the item book
* ItemBook add armor 3 # Add armor #3 to the item book
* ItemBook remove item 4 # Remove item #4 from the item book
* ItemBook remove weapon 5 # Remove weapon #5 from the item book
* ItemBook remove armor 6 # Remove armor #6 from the item book
* ItemBook complete # Complete the item book
* ItemBook clear # Clear the item book
*
* Item (Weapon, Armor) Note:
* <book:no> # This item does not appear in the item book
*
* ============================================================================
*
* How to get Max Character Length for Skills and States text.
* (to prevent Clipping, customizable by your for your skills and states.)
* (keep in mind your longest skills and stats, count characters AND spaces
* to get the number then subtract 3(for the dots) and you get your max
* displayable characters)
*
*/

(function() {

var parameters = PluginManager.parameters('ItemBook2');
var unknownData = String(parameters['Unknown Data'] || '??????');
var autoFill = String(parameters['AutoFill'] || 'true');
var goldIcon = String(parameters['Gold Icon'] || 'false');
var ShowKeyItems = String(parameters['Show Key Items'] || 'true');
var IndexHeight = String(parameters['Half Index Height'] || 'true');
var listRow = Number(parameters['Items in Row'] || 1);
var maxEffects = Number(parameters['Max Effects Count'] || 7);

var ShowPrice = Number(parameters['Show Price Switch'] || 0);
var ShowEffects = Number(parameters['Show Effects Switch'] || 0);
var ShowTypes = Number(parameters['Show Equip/Type Switch'] || 0);
var ShowParams = Number(parameters['Show Parameters Switch'] || 0);

var lineOpac = Number(parameters['Line Opacity'] || 120);
var posColor = Number(parameters['Effects Values Color'] || 3);

var Effects = String(parameters['Effects Text'] || 'Effects');
var parText = String(parameters['Parameter Text'] || 'Parameter');
var hpReg = String(parameters['HP Regeneration Text'] || 'HP Regen:');
var mpReg = String(parameters['MP Regeneration Text'] || 'MP Regen:');
var tpReg = String(parameters['TP Gain Text'] || 'TP Gain:');
var addState = String(parameters['Add State Text'] || 'Add State:');
var remState = String(parameters['Remove State Text'] || 'Remove State:');
var elementText = String(parameters['Element Text'] || 'Element:');
var elementRate = String(parameters['Element Rate Text'] || 'Element Rate:');
var attackSpeed = String(parameters['Attack Speed Text'] || 'Attack Speed:');
var learnSkill = String(parameters['Learn Skill Text'] || 'Learn Skill:');
var max = Number(parameters['Max Skill Characters'] || 17);

var equipText = String(parameters['Equip Text'] || 'Equip:');
var typeText = String(parameters['Type Text'] || 'Type:');
var itemTypeText = String(parameters['Item Type Text'] || 'Item Type:');
var sucRateText = String(parameters['Success Rate Text'] || 'Success Rate:');

var arr = [0,1,2,3,4,5,6,7,8,9,10,hpReg,mpReg,tpReg,
14,15,16,17,18,19,20,addState,remState,23,24,25,26,27,28,29,
30,31,32,33,34,35,36,37,38,39,40,41,42,learnSkill,44,45,46,47,48,49,50];
var arr2 = [0,1,2,3,4,5,6,7,8,9,10,elementRate,12,13,
14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
30,elementText,32,attackSpeed,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50];
var arrl = [hpReg,mpReg,tpReg,addState,remState,learnSkill,elementRate,elementText,sucRateText,itemTypeText,attackSpeed]

var lgth = 0;
var longest
var distance = 10;

for(var i=0; i < arrl.length; i++){
if(arrl.length > lgth){
var lgth = arrl.length;
var longest = lgth;
}
}

var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'ItemBook') {
switch (args[0]) {
case 'open':
SceneManager.push(Scene_ItemBook);
break;
case 'add':
$gameSystem.addToItemBook(args[1], Number(args[2]));
break;
case 'remove':
$gameSystem.removeFromItemBook(args[1], Number(args[2]));
break;
case 'complete':
$gameSystem.completeItemBook();
break;
case 'clear':
$gameSystem.clearItemBook();
break;
}
}
};

Game_System.prototype.addToItemBook = function(type, dataId) {
if (!this._ItemBookFlags) {
this.clearItemBook();
}
var typeIndex = this.itemBookTypeToIndex(type);
if (typeIndex >= 0) {
this._ItemBookFlags[typeIndex][dataId] = true;
}
};

Game_System.prototype.removeFromItemBook = function(type, dataId) {
if (this._ItemBookFlags) {
var typeIndex = this.itemBookTypeToIndex(type);
if (typeIndex >= 0) {
this._ItemBookFlags[typeIndex][dataId] = false;
}
}
};

Game_System.prototype.itemBookTypeToIndex = function(type) {
switch (type) {
case 'item':
return 0;
case 'weapon':
return 1;
case 'armor':
return 2;
default:
return -1;
}
};

Game_System.prototype.completeItemBook = function() {
var i;
this.clearItemBook();
for (i = 1; i < $dataItems.length; i++) {
this._ItemBookFlags[0] = true;
}
for (i = 1; i < $dataWeapons.length; i++) {
this._ItemBookFlags[1] = true;
}
for (i = 1; i < $dataArmors.length; i++) {
this._ItemBookFlags[2] = true;
}
};

Game_System.prototype.clearItemBook = function() {
this._ItemBookFlags = [[], [], []];
};

Game_System.prototype.isInItemBook = function(item) {
if (this._ItemBookFlags && item) {
var typeIndex = -1;
if (DataManager.isItem(item)) {
typeIndex = 0;
} else if (DataManager.isWeapon(item)) {
typeIndex = 1;
} else if (DataManager.isArmor(item)) {
typeIndex = 2;
}
if (typeIndex >= 0) {
return !!this._ItemBookFlags[typeIndex][item.id];
} else {
return false;
}
} else {
return false;
}
};

var _Game_Party_gainItem = Game_Party.prototype.gainItem;
Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
_Game_Party_gainItem.call(this, item, amount, includeEquip);
if (item && amount > 0) {
var type;
if (DataManager.isItem(item)) {
type = 'item';
} else if (DataManager.isWeapon(item)) {
type = 'weapon';
} else if (DataManager.isArmor(item)) {
type = 'armor';
}

if (autoFill === 'true') {
$gameSystem.addToItemBook(type, item.id);
}
}
};

function Scene_ItemBook() {
this.initialize.apply(this, arguments);
}

Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype);
Scene_ItemBook.prototype.constructor = Scene_ItemBook;

Scene_ItemBook.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};

Scene_ItemBook.prototype.create = function() {

var w3 = Graphics.boxWidth / 3;
var ww = (Graphics.boxWidth / 3)*2 + 2;
var wh = Graphics.boxHeight / 10;

Scene_MenuBase.prototype.create.call(this);
this._indexWindow = new Window_ItemBookIndex(0, 0);
this._indexWindow.setHandler('cancel', this.popScene.bind(this));

this._statusWindow = new Window_ItemBookStatus(w3, 0, ww, wh*3);
this._statusWindow2 = new Window_ItemBookStatus2(w3, wh*3, ww, wh*5.5);

if ($gameSwitches.value(ShowEffects) === true || ShowEffects === 0) {
this._statusWindow3 = new Window_ItemBookStatus3(w3, wh*8.5, ww, wh*1.5); }
else {
this._statusWindow3 = new Window_ItemBookStatus3(w3, wh*3, ww, wh*1.5); }

this._statusWindow4 = new Window_ItemBookStatus4(0, wh*5, Graphics.boxWidth/3, wh*5);
this.addWindow(this._indexWindow);
this.addWindow(this._statusWindow);

if ($gameSwitches.value(ShowEffects) === true || ShowEffects === 0) {
this.addWindow(this._statusWindow2); }

if ($gameSwitches.value(ShowTypes) === true || ShowTypes === 0) {
this.addWindow(this._statusWindow3); }

if ($gameSwitches.value(ShowParams) === true || ShowParams === 0) {
this.addWindow(this._statusWindow4); }

this._indexWindow.setStatusWindow(this._statusWindow);
this._indexWindow.setStatusWindow2(this._statusWindow2);
this._indexWindow.setStatusWindow3(this._statusWindow3);
this._indexWindow.setStatusWindow4(this._statusWindow4);
};

function Window_ItemBookIndex() {
this.initialize.apply(this, arguments);
}

Window_ItemBookIndex.prototype = Object.create(Window_Selectable.prototype);
Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex;

Window_ItemBookIndex.lastTopRow = 0;
Window_ItemBookIndex.lastIndex = 0;

Window_ItemBookIndex.prototype.initialize = function(x, y) {
var width = Graphics.boxWidth / 3;
if ($gameSwitches.value(ShowParams) === true || ShowParams === 0 || IndexHeight === "true") {
var height = Graphics.boxHeight/2;
}
else{
var height = Graphics.boxHeight;
}
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this.refresh();
this.setTopRow(Window_ItemBookIndex.lastTopRow);
this.select(Window_ItemBookIndex.lastIndex);
this.activate();
};

Window_ItemBookIndex.prototype.maxCols = function() {
return listRow;
};

Window_ItemBookIndex.prototype.maxItems = function() {
return this._list ? this._list.length : 0;
};

Window_ItemBookIndex.prototype.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
this.updateStatus();
};
Window_ItemBookIndex.prototype.setStatusWindow2 = function(statusWindow2) {
this._statusWindow2 = statusWindow2;
this.updateStatus();
};
Window_ItemBookIndex.prototype.setStatusWindow3 = function(statusWindow3) {
this._statusWindow3 = statusWindow3;
this.updateStatus();
};
Window_ItemBookIndex.prototype.setStatusWindow4 = function(statusWindow4) {
this._statusWindow4 = statusWindow4;
this.updateStatus();
};

Window_ItemBookIndex.prototype.update = function() {
Window_Selectable.prototype.update.call(this);
this.updateStatus();
};

Window_ItemBookIndex.prototype.updateStatus = function() {
if (this._statusWindow) {
var item = this._list[this.index()];
this._statusWindow.setItem(item);
}
if (this._statusWindow2) {
var item = this._list[this.index()];
this._statusWindow2.setItem(item);
}
if (this._statusWindow3) {
var item = this._list[this.index()];
this._statusWindow3.setItem(item);
}
if (this._statusWindow4) {
var item = this._list[this.index()];
this._statusWindow4.setItem(item);
}
};

Window_ItemBookIndex.prototype.refresh = function() {
var i, item;
this._list = [];
for (i = 1; i < Math.min(2000, $dataItems.length); i++) {
item = $dataItems;
if (item && item.name && item.itypeId === 1 && item.meta.book !== 'no') {
this._list.push(item);
}
}
if (ShowKeyItems === 'true') {
for (i = 1; i < Math.min(2000, $dataItems.length); i++) {
item = $dataItems;
if (item && item.name && item.itypeId === 2 && item.meta.book !== 'no') {
this._list.push(item);
}
}
}
for (i = 1; i < Math.min(2000, $dataWeapons.length); i++) {
item = $dataWeapons;
if (item && item.name && item.meta.book !== 'no') {
this._list.push(item);
}
}
for (i = 1; i < Math.min(2000, $dataArmors.length); i++) {
item = $dataArmors;
if (item && item.name && item.meta.book !== 'no') {
this._list.push(item);
}
}
this.createContents();
this.drawAllItems();
};

Window_ItemBookIndex.prototype.drawItem = function(index) {
var item = this._list[index];
var rect = this.itemRect(index);
var width = rect.width - this.textPadding();
if ($gameSystem.isInItemBook(item)) {
this.drawItemName(item, rect.x, rect.y, width);
} else {
var iw = Window_Base._iconWidth + 4;
this.drawText(unknownData, rect.x + iw, rect.y, width - iw);
}
};

Window_ItemBookIndex.prototype.processCancel = function() {
Window_Selectable.prototype.processCancel.call(this);
Window_ItemBookIndex.lastTopRow = this.topRow();
Window_ItemBookIndex.lastIndex = this.index();
};

function Window_ItemBookStatus() {
this.initialize.apply(this, arguments);
}
function Window_ItemBookStatus2() {
this.initialize.apply(this, arguments);
}
function Window_ItemBookStatus3() {
this.initialize.apply(this, arguments);
}
function Window_ItemBookStatus4() {
this.initialize.apply(this, arguments);
}

Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype);
Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus;

Window_ItemBookStatus2.prototype = Object.create(Window_Base.prototype);
Window_ItemBookStatus2.prototype.constructor = Window_ItemBookStatus2;

Window_ItemBookStatus3.prototype = Object.create(Window_Base.prototype);
Window_ItemBookStatus3.prototype.constructor = Window_ItemBookStatus3;

Window_ItemBookStatus4.prototype = Object.create(Window_Base.prototype);
Window_ItemBookStatus4.prototype.constructor = Window_ItemBookStatus4;

Window_ItemBookStatus.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
};

Window_ItemBookStatus.prototype.setItem = function(item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};
Window_ItemBookStatus2.prototype.setItem = function(item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};
Window_ItemBookStatus3.prototype.setItem = function(item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};
Window_ItemBookStatus4.prototype.setItem = function(item) {
if (this._item !== item) {
this._item = item;
this.refresh();
}
};

Window_ItemBookStatus.prototype.refresh = function() {
var item = this._item;
var x = 0;
var y = 0;
var lineHeight = this.lineHeight();

this.contents.clear();

if (!item || !$gameSystem.isInItemBook(item)) {
return;
}

this.drawItemName(item, x-1, y);

this.contents.paintOpacity = lineOpac;
this.contents.fillRect(x, 40, this.contents.width, 2, this.normalColor());
this.contents.paintOpacity = 255;

this.drawTextEx(item.description, x, (lineHeight)+10);

if ($gameSwitches.value(ShowPrice) === true || ShowPrice === 0) {
var price = item.price > 0 ? item.price : '-';

if (goldIcon === 'true') {
this.drawText(price, this.contents.width - 42 - this.textWidth(price), this.contents.height - lineHeight);
this.drawIcon(Yanfly.Icon.Gold, this.contents.width - 32, this.contents.height - lineHeight);
} else {
this.drawText(price, this.contents.width - this.textWidth(price) - this.textWidth(TextManager.currencyUnit) - 10, this.contents.height - lineHeight);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.currencyUnit, this.contents.width - this.textWidth(TextManager.currencyUnit), this.contents.height - lineHeight);
this.resetTextColor();
}
}

};

Window_ItemBookStatus2.prototype.refresh = function() {
var item = this._item;
var x = 0;
var y = 0;
var lineHeight = this.lineHeight();

this.contents.clear();

if (!item || !$gameSystem.isInItemBook(item)) {
return;
}

this.drawText(Effects, this.contents.width/2 - this.textWidth(Effects)/2, y);
y += lineHeight + 6;

this.contents.paintOpacity = lineOpac;
this.contents.fillRect(x, lineHeight, this.contents.width, 2, this.normalColor());
this.contents.paintOpacity = 255;


var x1 = x + this.textWidth(longest);

if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {

for (var j = 0; j < item.traits.length && j < maxEffects; j++) {

//---------------------------------------------------------- Is -> Element / Rate ---------------------------------------------
var it = item.traits[j];
if (it.code === 11 || it.code === 31) {
var x1 = x + arr2[it.code].length+ this.textWidth(longest);
this.changeTextColor(this.systemColor());
this.drawText(arr2[it.code], x, y);
this.resetTextColor();

if (it.code === 31) {
var x2 = x1;
}else{
var x2 = x1 + 56;
this.changeTextColor(this.textColor(posColor));
this.drawText(Math.round(it.value*100) + "%", x1, y);
}
this.resetTextColor();
this.drawText($dataSystem.elements[it.dataId] + " ", x2, y);

y += lineHeight;
}
//---------------------------------------------------------- Is -> Attack Speed ---------------------------------------------
if (it.code === 33) {
var x1 = x + arr2[it.code].length+ this.textWidth(longest);
this.changeTextColor(this.systemColor());
this.drawText(arr2[it.code], x, y);
this.resetTextColor();

var x2 = x1 + 56;
this.changeTextColor(this.textColor(posColor));
this.drawText(Math.round(it.value), x2, y);
this.resetTextColor();

y += lineHeight;
}
//---------------------------------------------------------- Is -> Learn Skill ---------------------------------------------
if (it.code === 43) {

var Icon = $dataSkills[it.dataId].iconIndex;
var Name = $dataSkills[it.dataId].name;

this.changeTextColor(this.systemColor());
this.drawText(arr[it.code], x, y);
this.resetTextColor();

this.drawIcon(Icon, x2-5, y);
this.drawText(Name, x2+40, y);
y += lineHeight;
}
//---------------------------------------------------------------------------------------------------------------------------------
}

}
else{

//---------------------------------------------------------- ITEM EFFECTS Create ----------------------------------------------------

for (var j = 0; j < item.effects.length && j < maxEffects; j++) {
$gameMessage.add(String(item.effects.length));
//---------------------------------------------------------- Is -> HP / MP / TP - Regen ---------------------------------------------
var ie = item.effects[j];
$gameMessage.add(String(ie.code));
if (ie.code === 11 || ie.code === 12 || ie.code === 13) {
var x2 = x1 + this.textWidth("+" + Math.round(ie.value1*100) + "% ");
var x3 = x2 + this.textWidth("- ");

var lgth = arr[ie.code].length;
var longest = lgth;

this.changeTextColor(this.systemColor());
this.drawText(arr[ie.code], x, y);
this.resetTextColor();

if (ie.value1 > 0 && ie.value2 > 0) {
this.changeTextColor(this.textColor(posColor));
this.drawText("+" + Math.round(ie.value1*100) + "%",x1, y);
this.resetTextColor();

this.changeTextColor(this.systemColor());
this.drawText(",", x2, y);
this.resetTextColor();

this.changeTextColor(this.textColor(posColor));
this.drawText("+" + Math.round(ie.value2), x3, y);
this.resetTextColor();
}
else if (ie.value1 > 0) {

this.changeTextColor(this.textColor(posColor));
if (ie.code === 13) {
this.drawText("+" + Math.round(ie.value1), x1, y);
}
else {
this.drawText("+" + Math.round(ie.value1*100) + "%", x1, y);
}
this.resetTextColor();
}
else if (ie.value2 > 0) {

this.changeTextColor(this.textColor(posColor));
this.drawText("+" + Math.round(ie.value2), x1, y);
this.resetTextColor();
}
y += lineHeight;
}
//----------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------- Is -> Add/Remove State ------------------------------------------------
if (ie.code === 21 ||ie.code === 22) {
var x1 =x+this.textWidth(arr[ie.code])//+ this.textWidth(longest);
var Icon = $dataStates[ie.dataId].iconIndex;
var Name = $dataStates[ie.dataId].name;

this.changeTextColor(this.systemColor());
this.drawText(arr[ie.code], x, y);
this.resetTextColor();

this.drawText(" "+Math.round(ie.value1*100) + "% ", x1, y, 60, "left");
this.drawIcon(Icon, x1+56, y);
if (Name.length >= max) {
var newLength = name.length - (Name.length - max) - 4
this.drawText(Name.slice(0,newLength) + "...", x1+96, y)
}
else {
this.drawText(Name, x1+96, y);}
y += lineHeight;
}
//---------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------- Is -> Learn Skill ----------------------------------------------------
if (ie.code === 43) {

var Icon = $dataSkills[ie.dataId].iconIndex;
var Name = $dataSkills[ie.dataId].name;

this.changeTextColor(this.systemColor());
this.drawText(arr[ie.code], x, y);
this.resetTextColor();

this.drawIcon(Icon, x1, y);
if (Name.length >= max) {
var newLength = name.length - (Name.length - max)
this.drawText(Name.slice(0,newLength) + "...", x1+40, y)
}
else {
this.drawText(Name, x1+40, y); }
y += lineHeight;
}
//---------------------------------------------------------------------------------------------------------------------------------
}

}
};

Window_ItemBookStatus3.prototype.refresh = function() {
var item = this._item;
var x = 0;
var y = -5;
var lineHeight = this.lineHeight();

this.contents.clear();

if (!item || !$gameSystem.isInItemBook(item)) {
return;
}

if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {

var etype = $dataSystem.equipTypes[item.etypeId];
var type;

if (DataManager.isWeapon(item)) {
type = $dataSystem.weaponTypes[item.wtypeId];
} else {
type = $dataSystem.armorTypes[item.atypeId];
}

this.changeTextColor(this.systemColor());
this.drawText(equipText, x, y);
this.drawText(typeText, x, y+lineHeight-5);
this.resetTextColor();
this.drawText(etype, x + this.textWidth(equipText) + distance, y);
this.drawText(type, x + this.textWidth(typeText) + distance, y+lineHeight-5);

}
else {

this.changeTextColor(this.systemColor());
this.drawText(itemTypeText, x, y);
this.drawText(sucRateText, x, y+lineHeight-5);
this.resetTextColor();

if (item.itypeId === 1) {
this.drawText(TextManager.item, x + this.textWidth(itemTypeText) + distance, y);
}
else{
this.drawText(TextManager.keyItem, x + this.textWidth(itemTypeText) + distance, y);
}
this.drawText(item.successRate + "%", x + this.textWidth(sucRateText) + distance, y+lineHeight-5);
}
};

Window_ItemBookStatus4.prototype.refresh = function() {
var item = this._item;
var lineHeight = this.lineHeight();
var x = 0;
var y = lineHeight-8;

this.contents.clear();

if (!item || !$gameSystem.isInItemBook(item)) {
return;
}

if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {

this.drawText(parText, this.contents.width/2-this.textWidth(parText)/2, -8);

this.contents.paintOpacity = lineOpac;
this.contents.fillRect(x, 25, this.contents.width, 2, this.normalColor());
this.contents.paintOpacity = 255;

for (var i = 0; i < 8; i++) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y);
this.resetTextColor();
if (item.params === 0) {
this.drawText("-", x + 170, y, 60, 'right');
} else{
this.drawText(item.params, x + 170, y, 60, 'right');
}
y += lineHeight-5;
}
}

};

})();






EnemyBook v1.4:

//=============================================================================
// EnemyBook.js
//=============================================================================

/*:
* @plugindesc v1.4a by SkottyTV // Displays detailed statuses of enemys.
* Fixed By mrcopra
* @author Yoji Ojima (Compatibility with YEP) / + SkottyTV (thx to DragonPC)
*
* @param ----- Functions -----
*
* @param Unknown Data
* @desc The index name for an unknown enemy.
* @default ??????
*
* @param AutoFill
* @desc Decide if enemys will automaticly show up in the book when defeated
* @default false
*
* @param Gold Icon
* @desc Decide if you want to use the Gold Icon from
* Yanfly Core Engine. (true or false)
* @default true
*
* @param ID before Name
* @desc Decide if enemys will have the ID number in front of their name
* @default true
*
* @param Enemys in Row
* @desc Decide how many enemys you want to show in one row.
* (default 1, maximum is 4 !)
* @default 1
*
* @param Half Index Height
* @desc Decide if you want to half the Index Window height.
* (default - true) (false will get overwritten by the damage window!)
* @default true
*
* @param Max Skill Count
* @desc Decide how many skills will be shown.
* (default - 6) (6 is recommended for small resolutions!)
* @default 6
*
* @param ----- Text -----
*
* @param No Item Text
* @desc Choose the text for "No Item".
* (0 - 31 default = - none -)
* @default - none -
*
* @param No Skill Text
* @desc Choose the text for "No Item".
* (default = - none -)
* @default - none -
*
* @param Damage Mod Text
* @desc Choose the text for "Damage Mod.".
* (default - Damage Mod.)
* @default Damage Mod.
*
* @param ----- Colors -----
*
* @param Positive Damage Color
* @desc Choose the color for positive damge mod.
* (0 - 31 default - 3)
* @default 3
*
* @param Negative Damage Color
* @desc Choose the color for negative damge mod.
* (0 - 31 default - 18)
* @default 18
*
* @param Skills Text Color
* @desc Choose the text color for the skills.
* (0 - 31 default - 0)
* @default 0
*
* @param Line Opacity
* @desc Choose the opacity of the lines.
* (0 - 255 default = 120)
* @default 120
*
* @param ----- Switches -----
*
* @param Show Items Switch
* @desc Choose the switch ID that shows the Items.
* (default 0)
* @default 0
*
* @param Show Ability Switch
* @desc Choose the switch ID that shows the Abilities.
* (default 0)
* @default 0
*
* @param Show EXP Switch
* @desc Choose the switch ID that shows the EXP.
* (default 0)
* @default 0
*
* @param Show Gold Switch
* @desc Choose the switch ID that shows the Gold.
* (default 0)
* @default 0
*
* @param Show Status Switch
* @desc Choose the switch ID that shows the status.
* (default 0)
* @default 0
*
* @param Show Damage Switch
* @desc Choose the switch ID that shows the Damage window.
* (default 0)
* @default 0
*
* @param ----- Animation -----
*
* @param Pulsing Enemy
* @desc Decide if you want to display an animated enemy.
* (default true)
* @default true
*
* @param Pulsing Intensity
* @desc Decide how strong the animation should be.
* Higher number = Less Intensity (default 4)
* @default 4
*
* @help
*
* ============================================================================
* SkottyTV v1.1 ->
*
* - Decide if enemys will get an entry automaticly when they appear/transform!
* - Now you can add an Enemy by a variable value!
* - Able to add a third info line (desc3)!
* - Advanced Visual upgrades!
*
* SkottyTV v1.2 ->
*
* - Decide how many columns appear in one row!
* - Decide if you want to use the Gold Icon from Yanfly Core Engine!
*
* SkottyTV v1.3 ->
*
* - Decide if you want to halve the Index height.
* - Advanced Visual upgrades!
* - Pulsing animation upgrade!
* - Use switches to enable different information!
* (EXP, Gold, Items and Parameters)
*
* SkottyTV v1.4 ->
*
* - Removed half Index Height.(to make room for the Damage Window.)
* - Added an optional "additional damage" window!
* - Added an optional "skills" section!
* - Added more switches.
* - Customizable Visual upgrades.
* - Bug fixes!
*
* SkottyTV v1.4a ->
*
* - Added max skill count function.
* ============================================================================
*
* Plugin Command:
* EnemyBook open # Open the enemy book screen
* EnemyBook add 3 # Add enemy #3 to the enemy book
* EnemyBook addvar 10 # Add enemy (ID) that is in variable 10
* EnemyBook remove 4 # Remove enemy #4 from the enemy book
* EnemyBook complete # Complete the enemy book
* EnemyBook clear # Clear the enemy book
*
* Enemy Note:
* <desc1:The mighty Duck> # Description text in the enemy book, line 1
* <desc2:This is Line 2> # Description text in the enemy book, line 2
* <desc3:Some Info here?> # Description text in the enemy book, line 3
* <book:no> # This enemy does not appear in the enemy book
*
* ============================================================================
*
* Investigate Skill Tutorial:
* (You will need YanFly´s Battle Engine Core and ActSeqPack1 to get it work)
*
* - First set the "AutoFill" option of this plugin to false
* - Now create a skill which calls a common event X and have the following
* in its notebox:
* <Target Action>
* Change Variable Y = target._enemyId
* </Target Action>
* - Now in the common event X call a Plugin-Line and write:
* EnemyBook addvar Y
* - Done!
*
* (X and Y is a number you choose)
*/

(function() {
//--------------------------------------------------- Variables --------------------------------------------------------
var parameters = PluginManager.parameters('EnemyBook');

var unknownData = String(parameters['Unknown Data'] || '??????')
var AutoFill = String(parameters['AutoFill'] || 'false');
var IDatName = String(parameters['ID before Name'] || 'true');
var goldIcon = String(parameters['Gold Icon'] || 'true');
var AnimEnemy = String(parameters['Pulsing Enemy'] || 'true');
var damageText = String(parameters['Damage Mod Text'] || 'Damage Mod.');
var noitemText = String(parameters['No Item Text'] || '- none -');
var noskillText = String(parameters['No Skill Text'] || '- none -');
var HalfIndexHeight = String(parameters['Half Index Height'] || 'true');

var listEnemysRow = Number(parameters['Enemys in Row']);
var ShowItems = Number(parameters['Show Items Switch']);
var ShowAbilities = Number(parameters['Show Ability Switch']);
var ShowEXP = Number(parameters['Show EXP Switch']);
var ShowGold = Number(parameters['Show Gold Switch']);
var ShowStatus = Number(parameters['Show Status Switch']);
var ShowDamage = Number(parameters['Show Damage Switch']);
var posColor = Number(parameters['Positive Damage Color'] || 3);
var negColor = Number(parameters['Negative Damage Color'] || 18);
var skillColor = Number(parameters['Skills Text Color'] || 0);
var lineOpacity = Number(parameters['Line Opacity'] || 120);
var maxSkills = Number(parameters['Max Skill Count'] || 6);
var AnimIntens = Number(parameters['Pulsing Intensity']);
//--------------------------------------------------- Plugin Commands -----------------------------------------------------------
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'EnemyBook') {
switch (args[0]) {
case 'open':
SceneManager.push(Scene_EnemyBook);
break;
case 'add':
$gameSystem.addToEnemyBook(Number(args[1]));
break;
case 'addvar':
$gameSystem.addToEnemyBook(Number($gameVariables.value(args[1])));
break;
case 'remove':
$gameSystem.removeFromEnemyBook(Number(args[1]));
break;
case 'complete':
$gameSystem.completeEnemyBook();
break;
case 'clear':
$gameSystem.clearEnemyBook();
break;
}
}
};
//--------------------------------------------------- Function Add Enemy -------------------------------------------------------
Game_System.prototype.addToEnemyBook = function(enemyId) {
if (!this._enemyBookFlags) {
this.clearEnemyBook();
}
this._enemyBookFlags[enemyId] = true;
};
//--------------------------------------------------- Function Remove Enemy -----------------------------------------------------
Game_System.prototype.removeFromEnemyBook = function(enemyId) {
if (this._enemyBookFlags) {
this._enemyBookFlags[enemyId] = false;
}
};
//--------------------------------------------------- Function Complete Enemy Book ----------------------------------------------
Game_System.prototype.completeEnemyBook = function() {
this.clearEnemyBook();
for (var i = 1; i < $dataEnemies.length; i++) {
this._enemyBookFlags = true;
}
};
//--------------------------------------------------- Function Clear Enemy Book -------------------------------------------------
Game_System.prototype.clearEnemyBook = function() {
this._enemyBookFlags = [];
};
//--------------------------------------------------- Function Is the Enemy In The Book -----------------------------------------
Game_System.prototype.isInEnemyBook = function(enemy) {
if (this._enemyBookFlags && enemy) {
return !!this._enemyBookFlags[enemy.id];
} else {
return false;
}
};
//--------------------------------------------------- Variable/Function Is enemy in the troop, if so add enemy to book-----------
var _Game_Troop_setup = Game_Troop.prototype.setup;
Game_Troop.prototype.setup = function(troopId) {
_Game_Troop_setup.call(this, troopId);
this.members().forEach(function(enemy) {
if (enemy.isAppeared()) {

if (AutoFill === 'true') {
$gameSystem.addToEnemyBook(enemy.enemyId());
}
}
}, this);
};

var _Game_Enemy_appear = Game_Enemy.prototype.appear;
Game_Enemy.prototype.appear = function() {
_Game_Enemy_appear.call(this);
if (AutoFill === 'true') {
$gameSystem.addToEnemyBook(this._enemyId);
}
};

var _Game_Enemy_transform = Game_Enemy.prototype.transform;
Game_Enemy.prototype.transform = function(enemyId) {
_Game_Enemy_transform.call(this, enemyId);
if (AutoFill === 'true') {
$gameSystem.addToEnemyBook(enemyId);
}
};

function Scene_EnemyBook() {
this.initialize.apply(this, arguments);
}
//-------------------------------------------------------------------------------------------------------------------------------
Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype);
Scene_EnemyBook.prototype.constructor = Scene_EnemyBook;

Scene_EnemyBook.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};

Scene_EnemyBook.prototype.create = function() {

var w3 = Graphics.boxWidth / 3;
var ww = (Graphics.boxWidth / 3)*2 + 2;
var wh = Graphics.boxHeight / 10;

Scene_MenuBase.prototype.create.call(this);
this._indexWindow = new Window_EnemyBookIndex(0, 0);
this._indexWindow.setHandler('cancel', this.popScene.bind(this));

this._statusWindow = new Window_EnemyBookStatus(w3, 0, ww, wh*2);
if ($gameSwitches.value(ShowStatus) === true || ShowStatus === 0) {
this._statusWindow2 = new Window_EnemyBookStatus2(w3, wh*2, ww, wh*5);
} else{
this._statusWindow2 = new Window_EnemyBookStatus2(w3, wh*2, ww, wh*8);
}
this._statusWindow3 = new Window_EnemyBookStatus3(w3, wh*7, ww, wh*3);
this._statusWindow4 = new Window_EnemyBookStatus4(0, Graphics.boxHeight/2, w3, Graphics.boxHeight/2);
this.addWindow(this._indexWindow);
this.addWindow(this._statusWindow);
if ($gameSwitches.value(ShowDamage) === true || ShowDamage === 0) {
this.addWindow(this._statusWindow4);}
this.addWindow(this._statusWindow2);
if ($gameSwitches.value(ShowStatus) === true || ShowStatus === 0) {
this.addWindow(this._statusWindow3);}
this._indexWindow.setStatusWindow(this._statusWindow);
this._indexWindow.setStatusWindow2(this._statusWindow2);
this._indexWindow.setStatusWindow3(this._statusWindow3);
this._indexWindow.setStatusWindow4(this._statusWindow4);
};

function Window_EnemyBookIndex() {
this.initialize.apply(this, arguments);
}

Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype);
Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;

Window_EnemyBookIndex.lastTopRow = 0;
Window_EnemyBookIndex.lastIndex = 0;

Window_EnemyBookIndex.prototype.initialize = function(x, y) {
var width = Graphics.boxWidth / 3;

if ($gameSwitches.value(ShowDamage) === true || ShowDamage === 0 || HalfIndexHeight === "true") {
var height = Graphics.boxHeight / 2;
}
else{
var height = Graphics.boxHeight;
}


Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this.refresh();
this.setTopRow(Window_EnemyBookIndex.lastTopRow);
this.select(Window_EnemyBookIndex.lastIndex);
this.activate();
};

Window_EnemyBookIndex.prototype.maxCols = function() {
if (listEnemysRow > 4) {
return 4;
}
else{
return listEnemysRow;
}
};

Window_EnemyBookIndex.prototype.maxItems = function() {
return this._list ? this._list.length : 0;
};

Window_EnemyBookIndex.prototype.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
this.updateStatus();
};
Window_EnemyBookIndex.prototype.setStatusWindow2 = function(statusWindow2) {
this._statusWindow2 = statusWindow2;
this.updateStatus();
};
Window_EnemyBookIndex.prototype.setStatusWindow3 = function(statusWindow3) {
this._statusWindow3 = statusWindow3;
this.updateStatus();
};
Window_EnemyBookIndex.prototype.setStatusWindow4 = function(statusWindow4) {
this._statusWindow4 = statusWindow4;
this.updateStatus();
};

Window_EnemyBookIndex.prototype.update = function() {
Window_Selectable.prototype.update.call(this);
this.updateStatus();
};

Window_EnemyBookIndex.prototype.updateStatus = function() {
if (this._statusWindow) {
var enemy = this._list[this.index()];
this._statusWindow.setEnemy(enemy);
}
if (this._statusWindow2) {
var enemy = this._list[this.index()];
this._statusWindow2.setEnemy(enemy);
}
if (this._statusWindow3) {
var enemy = this._list[this.index()];
this._statusWindow3.setEnemy(enemy);
}
if (this._statusWindow4) {
var enemy = this._list[this.index()];
this._statusWindow4.setEnemy(enemy);
}
};

Window_EnemyBookIndex.prototype.refresh = function() {
this._list = [];
for (var i = 1; i < $dataEnemies.length; i++) {
var enemy = $dataEnemies;
if (enemy.name && enemy.meta.book !== 'no') {
this._list.push(enemy);
}
}
this.createContents();
this.drawAllItems();
};

Window_EnemyBookIndex.prototype.drawItem = function(index) {
var enemy = this._list[index];
var rect = this.itemRectForText(index);
var name;
if ($gameSystem.isInEnemyBook(enemy)) {
if (IDatName === 'true') {
name = enemy.id + " - " + enemy.name;
} else {
name = enemy.name;
}
} else {
name = unknownData;
}
this.drawText(name, rect.x, rect.y, rect.width);
};

Window_EnemyBookIndex.prototype.processCancel = function() {
Window_Selectable.prototype.processCancel.call(this);
Window_EnemyBookIndex.lastTopRow = this.topRow();
Window_EnemyBookIndex.lastIndex = this.index();
};

function Window_EnemyBookStatus() {
this.initialize.apply(this, arguments);
}
function Window_EnemyBookStatus2() {
this.initialize.apply(this, arguments);
}
function Window_EnemyBookStatus3() {
this.initialize.apply(this, arguments);
}
function Window_EnemyBookStatus4() {
this.initialize.apply(this, arguments);
}

Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype);
Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus;

Window_EnemyBookStatus2.prototype = Object.create(Window_Base.prototype);
Window_EnemyBookStatus2.prototype.constructor = Window_EnemyBookStatus2;

Window_EnemyBookStatus3.prototype = Object.create(Window_Base.prototype);
Window_EnemyBookStatus3.prototype.constructor = Window_EnemyBookStatus3;

Window_EnemyBookStatus4.prototype = Object.create(Window_Base.prototype);
Window_EnemyBookStatus4.prototype.constructor = Window_EnemyBookStatus4;


Window_EnemyBookStatus2.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._enemy = null;
this._enemySprite = new Sprite();
this._enemySprite.anchor.x = 0.5;
this._enemySprite.anchor.y = 0.5;
this._enemySprite.x = this.contents.width/2;
this._enemySprite.y = (this.contents.height/2)+20;
this.addChildToBack(this._enemySprite);
this.refresh();
};

Window_EnemyBookStatus.prototype.setEnemy = function(enemy) {
if (this._enemy !== enemy) {
this._enemy = enemy;
this.refresh();
}
};
Window_EnemyBookStatus2.prototype.setEnemy = function(enemy) {
if (this._enemy !== enemy) {
this._enemy = enemy;
this.refresh();
}
};
Window_EnemyBookStatus3.prototype.setEnemy = function(enemy) {
if (this._enemy !== enemy) {
this._enemy = enemy;
this.refresh();
}
};
Window_EnemyBookStatus4.prototype.setEnemy = function(enemy) {
if (this._enemy !== enemy) {
this._enemy = enemy;
this.refresh();
}
};
//--------------------------------------------------- Function Animate Enemy ------------------------------------------------
if (AnimEnemy === 'true') {
Window_EnemyBookStatus2.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._enemySprite.bitmap) {
var bitmapHeight = this._enemySprite.bitmap.height;
var contentsHeight = this.contents.height;

var scalex = (Math.cos(Graphics.frameCount*0.01))/AnimIntens;
var scaley = ((Math.cos(Graphics.frameCount*0.01))/AnimIntens);

this._enemySprite.scale.x = (scalex*scalex)+0.9;
this._enemySprite.scale.y = (scaley*scaley)+0.9;

if (bitmapHeight > contentsHeight) {
this._enemySprite.scale.x = ((scaley*scaley)+0.9)-0.3;
this._enemySprite.scale.y = ((scaley*scaley)+0.9)-0.3;
}
}

};
}
else {
Window_EnemyBookStatus2.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._enemySprite.bitmap) {
var bitmapHeight = this._enemySprite.bitmap.height;
var contentsHeight = this.contents.height;

var scale = 1;

this._enemySprite.scale.x = scale;
this._enemySprite.scale.y = scale;

if (bitmapHeight > contentsHeight) {
this._enemySprite.scale.x = contentsHeight/bitmapHeight;
this._enemySprite.scale.y = contentsHeight/bitmapHeight;
}
}

};
}
//-------------------------------------------------------------------------------------------------------------------------------
Window_EnemyBookStatus.prototype.refresh = function() {

this.contents.clear();

var enemy = this._enemy;
var x = 0;
var y = 0;
var lineHeight = this.lineHeight();

if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
return;
}
//--------------------------------------------------- Draw Enemy Discription ----------------------------------------------------

var descWidth = 1;
x = 1;
y = 0;
this.drawTextEx(enemy.meta.desc1, x, (y + lineHeight * 0)-2, descWidth);
this.drawTextEx(enemy.meta.desc2, x, (y + lineHeight * 1)-10, descWidth);
this.drawTextEx(enemy.meta.desc3, x, (y + lineHeight * 2)-18, descWidth);
};
//-------------------------------------------------------------------------------------------------------------------------------

//--------------------------------------------------- Draw Enemy Bitmap ---------------------------------------------------------

Window_EnemyBookStatus2.prototype.refresh = function(actionList) {

this.contents.clear();

var enemy = this._enemy;
var x = 0;
var y = 0;
var lineHeight = this.lineHeight();

if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
this._enemySprite.bitmap = null;
return;
}

var name = enemy.battlerName;
var hue = enemy.battlerHue;
var bitmap;
if ($gameSystem.isSideView()) {
bitmap = ImageManager.loadSvEnemy(name, hue);
} else {
bitmap = ImageManager.loadEnemy(name, hue);
}

this._enemySprite.bitmap = bitmap;

this.resetTextColor();
//-------------------------------------------------------------------------------------------------------------------------------

//--------------------------------------------------- Draw Abilities ------------------------------------------------------------

if ($gameSwitches.value(ShowAbilities) === true || ShowAbilities === 0) {

x = 1;
y = lineHeight*1;

var text = TextManager.skill + ":";

this.contents.paintOpacity = lineOpacity;
this.contents.fillRect(this.contents.width-this.textWidth(text), 30, this.textWidth(text), 2, this.normalColor());
this.contents.paintOpacity = 255;

this.drawText(text, this.contents.width-this.textWidth(text), -5);

for (var j = 0; j < enemy.actions.length && j < maxSkills; j++) {
var ai = enemy.actions[j];
if (ai.skillId > 0) {
var skillName = $dataSkills[ai.skillId].name;
var skillIcon = $dataSkills[ai.skillId].iconIndex;
this.changeTextColor(this.textColor(skillColor));
this.drawText(skillName, this.contents.width-this.textWidth(skillName)-36, y+3);
this.drawIcon(skillIcon, this.contents.width-32, y+3);
this.changeTextColor(this.normalColor());
y += lineHeight
}
}
if (enemy.actions.length <= 0) {
this.contents.paintOpacity = lineOpacity;
this.drawText(noskillText, this.contents.width-this.textWidth(noskillText), y+3);
this.contents.paintOpacity = 255;
}
}
//-------------------------------------------------------------------------------------------------------------------------------


//--------------------------------------------------- Draw Items ----------------------------------------------------------------

if ($gameSwitches.value(ShowItems) === true || ShowItems === 0) {

x = 1;
y = lineHeight*1;

this.contents.paintOpacity = lineOpacity;
this.contents.fillRect(x, 30, this.textWidth(TextManager.item + ':'), 2, this.normalColor());
this.contents.paintOpacity = 255;

this.drawText(TextManager.item + ':', x, -5);
for (var j = 0; j < enemy.dropItems.length; j++) {
var di = enemy.dropItems[j];
if (di.kind > 0) {
var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId);
this.drawItemName(item, x, y+3);
y += lineHeight;
}
}
if (enemy.dropItems[0].kind <= 0) {
this.contents.paintOpacity = lineOpacity;
this.drawText(noitemText, x, y+3);
this.contents.paintOpacity = 255;
}
}
//-------------------------------------------------------------------------------------------------------------------------------
x = 1
y = this.contents.height - 60

var arr = [TextManager.expA, TextManager.currencyUnit];

var lgth = 0;
var longest;

for(var i=0; i < arr.length; i++){
if(arr.length > lgth){
var lgth = arr.length;
longest = arr;
}
}
//--------------------------------------------------- Draw Experience -----------------------------------------------------------
if ($gameSwitches.value(ShowEXP) === true || ShowEXP === 0) {

this.changeTextColor(this.systemColor());
this.drawText(TextManager.expA, x, y - 5);
this.resetTextColor();

if (goldIcon === 'true') {
this.drawText(enemy.exp, x + this.textWidth(TextManager.expA) + 15, y - 5);
} else{
this.drawText(enemy.exp, x + this.textWidth(longest) + 15, y - 5);
}
}
//-------------------------------------------------------------------------------------------------------------------------------

//--------------------------------------------------- Draw Gold -----------------------------------------------------------------
if ($gameSwitches.value(ShowGold) === true || ShowGold === 0) {
this.changeTextColor(this.systemColor());

if (goldIcon === 'true') {
this.drawIcon(Yanfly.Icon.Gold, x, y - 8 + lineHeight)
this.resetTextColor();
this.drawText(enemy.gold, x + this.textWidth(TextManager.expA) + 15, y - 8 + lineHeight);
} else {
this.drawText(TextManager.currencyUnit, x, y - 8 + lineHeight);
this.resetTextColor();
this.drawText(enemy.gold, x + this.textWidth(longest) + 15, y - 8 + lineHeight);
}
}
//-------------------------------------------------------------------------------------------------------------------------------
}

Window_EnemyBookStatus3.prototype.refresh = function() {

this.contents.clear();

var enemy = this._enemy;
var x = 0;
var y = 0;
var lineHeight = this.lineHeight();

if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
return;
}

this.drawText(TextManager.status, (Graphics.boxWidth/3) - (this.textWidth(TextManager.status)/2), -7, 160);
this.resetTextColor();

this.contents.paintOpacity = lineOpacity;
this.contents.fillRect(x, 27, this.contents.width, 2, this.normalColor());
this.contents.paintOpacity = 255;

x = (Graphics.boxWidth/3) - 235
y = 30;

var arr = [TextManager.param(0), TextManager.param(1), TextManager.param(2), TextManager.param(3)];

var lgth = 0;
var longest;

for(var i=0; i < arr.length; i++){
if(arr.length > lgth){
var lgth = arr.length;
longest = arr;
}
}

for (var i = 0; i < 4; i++) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y, 160);
this.resetTextColor();
this.drawText(enemy.params, x + this.textWidth(longest + ' '), y, 60, 'left');
y += lineHeight-5;
}

y = 30;

var arr = [TextManager.param(4), TextManager.param(5), TextManager.param(6), TextManager.param(7)];

var lgth = 0;
var longest2;

for(var i=0; i < arr.length; i++){
if(arr.length > lgth){
var lgth = arr.length;
longest2 = arr;
}
}

x = x + 10 + this.textWidth(longest + ' ') + 90

for (var i = 4; i < 8; i++) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y, 160);
this.resetTextColor();
this.drawText(enemy.params, x + this.textWidth(longest2 + ' '), y, 60, 'left');
y += lineHeight-5;
}
}

Window_EnemyBookStatus4.prototype.refresh = function() {

this.contents.clear();

var enemy = this._enemy;
var x = 1;
var y = 0;
var lineHeight = this.lineHeight()-6;
var ii = 1

if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
return;
}

this.drawText(damageText, ((Graphics.boxWidth/3)/2)-(this.textWidth(damageText)/2)-18, y-5);
this.contents.paintOpacity = lineOpacity;
this.contents.fillRect(x, 29, this.contents.width, 2, this.normalColor());
this.contents.paintOpacity = 255;

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

if (i < enemy.traits.length) {
if (enemy.traits.code === 11) {
this.changeTextColor(this.systemColor());
this.drawText($dataSystem.elements[enemy.traits.dataId], x, y+lineHeight*ii);
if (enemy.traits.value*100 > 101) {
this.changeTextColor(this.textColor(posColor));
}
else{
this.changeTextColor(this.textColor(negColor));
}
this.drawText((Math.round(enemy.traits.value*100)) + "%", (Graphics.boxWidth/3) - 110, y+lineHeight*ii, 70, 'right');
ii += 1
this.changeTextColor(this.normalColor());
}
}
}
};

})();






Aaaand the downloads:


View attachment EnemyBook.js


View attachment ItemBook.js
 
Last edited by a moderator:

Quite.Toxick

Veteran
Veteran
Joined
May 29, 2016
Messages
90
Reaction score
91
First Language
German, English
Primarily Uses
Thanks a lot : )


Quick question, however… After quitting the Item Book I get a weird message box with a sequence of numbers… mostly 1s and 2s...


Did anyone else encounter that?

View attachment 42407
 

KingGodzilla

King of the Monsters
Veteran
Joined
Oct 25, 2015
Messages
27
Reaction score
7
First Language
English
Primarily Uses
I just have a quick question... What exactly was the fix?
 

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
127
First Language
English
Primarily Uses
RMMZ
I would actually have the same question, as both of the plugins were still working perfectly for me? o_O
 

omega9380

Veteran
Veteran
Joined
Mar 24, 2013
Messages
68
Reaction score
9
First Language
English
Primarily Uses
Like I mentioned, mrcopra handled the fixes for these two plugins, so you will need to ask him to see what the issue was.  Several people were having issues where they would open the books and get nothing but blank windows, even with no other plugins loaded, and the general fix from the forums for renaming the plugins to EnemyBook,js and ItemBook.js to replace the originals wasn't working for them.  These now should work fine.
 
Last edited by a moderator:

Quite.Toxick

Veteran
Veteran
Joined
May 29, 2016
Messages
90
Reaction score
91
First Language
German, English
Primarily Uses
mrcopra was being awesome and fixed my problem. 


So if anybody else encountered this issue, here is the updated version of the Item Book!  :D


Remember to rename the file "ItemBook.js".


View attachment ItemBook2.js
 
Last edited by a moderator:

passballtotucker

Villager
Member
Joined
Jul 18, 2016
Messages
28
Reaction score
7
First Language
English
Primarily Uses
With the item book, I set the gold icon to true and show key items to false and nothing changes. In fact, I tried changing other parameters too and none of them have any effect. Does anyone else have this issue? Edit: I fixed the issue. I just redownloaded Itembook2.js and didn't rename it. 


Also, with the enemy book, is there a way to make it show, "??????" for enemy items until they actually drop them? Mr. Trival made a monster book (link below) that does that by default, but I like the look of this one more. 
 
Last edited by a moderator:

zimzim

Yamatcha Game Studio
Veteran
Joined
Dec 7, 2015
Messages
46
Reaction score
35
First Language
Malay
Primarily Uses
RMMV
I found that when I use Yanfly's SV Animated Enemies plugin, and when I use the Sideview Battler notetag in the enemy's notebox, then its image won't appear in the Enemy Book.
 

Quite.Toxick

Veteran
Veteran
Joined
May 29, 2016
Messages
90
Reaction score
91
First Language
German, English
Primarily Uses
@zimzim I had the same issue. Yet again, mrcopra was being awesome and fixed it. 


So if anybody else encountered this issue, here is an updated version of the EnemyBook:D


It solved the issue for me.
 

zimzim

Yamatcha Game Studio
Veteran
Joined
Dec 7, 2015
Messages
46
Reaction score
35
First Language
Malay
Primarily Uses
RMMV
@Quite.Toxick Oh wow thanks for sharing!! That indeed solved my issue as well. My utmost gratitude to mrcopra :D
 

coticka

Veteran
Veteran
Joined
May 30, 2015
Messages
74
Reaction score
10
First Language
English
Primarily Uses
RMMV
Omg finally. I had been looking for this. Thank you. I could never figure out why the other version would always be blank.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

A beloved family member passed away due to complication to combat COVID and diabetes. Rest in peace Grandma.
Just got FES pack for my MZ. The details of the tilesets and chars seem not very compatible with MZ rtp. Look like they are scaled up. Not saying it's bad, but just won't fit well.
I've been busy with other things lately but I'm getting back into working on stuff for my game next month. I think I'm going to fiddle with making NPC busts next, mixing and matching stuff from DLC I've purchased.
Just finished composing a boss battle theme!

Forum statistics

Threads
105,566
Messages
1,014,682
Members
137,239
Latest member
roeselerfinnole
Top