Drop/Gold Rate Display

● ARCHIVED · READ-ONLY
Started by Deleted member 113412 10 posts View original ↗
  1. Hello,

    I was wondering if someone could make a plugin that displays your current Drop/Gold rates in % style (with 100% being the default) on either the status page, main menu or the over-world (default screen).

    What I am also hoping for, is for it to be compatible with Yanfly's Status Menu Core if you go down that route.

    Thanks!
  2. Bumping...​
  3. bumping...​
  4. bumping...​
  5. This plugin should check the Gold Double and Item Drop Double party traits and display 100% or 200% as appropriate in Yanfly's Status Menu Core:
    Spoiler
    Code:
    //=========================================================
    // CaeX_YEPStatusMenuExt.js
    //=========================================================
    
    /*:
     * @plugindesc v1.0 - Lets you add more attributes to Yanfly's Status Menu Core.
     * @author Caethyril
     *
     * @help Plugin Commands:
     *   None.
     *
     * Parameters:
     *   - Gold drop rate: 200% if party has Gold Double trait, else 100%.
     *   - Item drop rate: 200% if party has Item Drop Double trait, else 100%.
     *
     * Compatibility:
     *   Must be loaded after Yanfly's Status Menu Core plugin.
     *   Aliases Yanfly's drawAttributeData method on Window_StatusInfo.
     *
     * Terms of use:
     *   Free to use and modify.
     *
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     * Update log:
     *   1.0: Initial release.
     *
     * @param --- Attributes ---
     * @text --- Attributes ---
     * @type select
     * @default
     *
     * @param Gold drop rate key
     * @text Gold drop rate key
     * @parent --- Attributes ---
     * @type text
     * @desc The code for use in Yanfly's Status Menu Core plugin parameters.
     * @default gdr
     *
     * @param Gold drop rate name
     * @text Gold drop rate name
     * @parent --- Attributes ---
     * @type text
     * @desc How this entry will be labelled in-game.
     * @default Gold drop rate
     *
     * @param Item drop rate key
     * @text Item drop rate key
     * @parent --- Attributes ---
     * @type text
     * @desc The code for use in Yanfly's Status Menu Core plugin parameters.
     * @default idr
     *
     * @param Item drop rate name
     * @text Item drop rate name
     * @parent --- Attributes ---
     * @type text
     * @desc How this entry will be labelled in-game.
     * @default Item drop rate
     */
    
    var Imported = Imported || {};				// Import namespace, var can redefine
    Imported.CaeX_YEPStatusMenuExt = 1.0;			// Import declaration
    
    var CAE = CAE || {};					// Author namespace, var can redefine
    CAE.X_YEPStatusMenuExt = CAE.X_YEPStatusMenuExt || {};	// Plugin namespace
    
    (function(_) {
    
    	if (!Imported.YEP_StatusMenuCore) console.error('CaeX_YEPStatusMenuCoreExt.js error! Could not find required plugin YEP_StatusMenuCore.js.');
    
    	_.params = PluginManager.parameters('CaeX_YEPStatusMenuExt');
    
    	_.Window_StatusInfo_drawAttributeData = Window_StatusInfo.prototype.drawAttributeData;
    	Window_StatusInfo.prototype.drawAttributeData = function(attr, dx, dy, dw) {
    		switch (attr) {
    			case _.params['Gold drop rate key']:		// Gold drop rate
    				this.drawAttributeName(_.params['Gold drop rate name'], dx, dy, dw);
    				this.drawAttributeRate($gameParty.hasGoldDouble() ? 2 : 1, dx, dy, dw);
    				break;
    			case _.params['Item drop rate key']:		// Item drop rate
    				this.drawAttributeName(_.params['Item drop rate name'], dx, dy, dw);
    				this.drawAttributeRate($gameParty.hasDropItemDouble() ? 2 : 1, dx, dy, dw);
    				break;
    			default:
    				_.Window_StatusInfo_drawAttributeData.call(this, attr, dx, dy, dw);
    				break;
    		}
    	};
    
    })(CAE.X_YEPStatusMenuExt);
    The default "keys" (like eva, hit, mrg, etc) are gdr and idr, but you can change those, and the display text for each one, via the plugin parameters. Just add the key to whatever Attributes column you like via the appropriate parameter in Yanfly's Status Menu Core and it'll show up in-game. ^_^
  6. caethyril said:
    This plugin should check the Gold Double and Item Drop Double party traits and display 100% or 200% as appropriate in Yanfly's Status Menu Core:
    Spoiler
    Code:
    //=========================================================
    // CaeX_YEPStatusMenuExt.js
    //=========================================================
    
    /*:
     * @plugindesc v1.0 - Lets you add more attributes to Yanfly's Status Menu Core.
     * @author Caethyril
     *
     * @help Plugin Commands:
     *   None.
     *
     * Parameters:
     *   - Gold drop rate: 200% if party has Gold Double trait, else 100%.
     *   - Item drop rate: 200% if party has Item Drop Double trait, else 100%.
     *
     * Compatibility:
     *   Must be loaded after Yanfly's Status Menu Core plugin.
     *   Aliases Yanfly's drawAttributeData method on Window_StatusInfo.
     *
     * Terms of use:
     *   Free to use and modify.
     *
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     * Update log:
     *   1.0: Initial release.
     *
     * @param --- Attributes ---
     * @text --- Attributes ---
     * @type select
     * @default
     *
     * @param Gold drop rate key
     * @text Gold drop rate key
     * @parent --- Attributes ---
     * @type text
     * @desc The code for use in Yanfly's Status Menu Core plugin parameters.
     * @default gdr
     *
     * @param Gold drop rate name
     * @text Gold drop rate name
     * @parent --- Attributes ---
     * @type text
     * @desc How this entry will be labelled in-game.
     * @default Gold drop rate
     *
     * @param Item drop rate key
     * @text Item drop rate key
     * @parent --- Attributes ---
     * @type text
     * @desc The code for use in Yanfly's Status Menu Core plugin parameters.
     * @default idr
     *
     * @param Item drop rate name
     * @text Item drop rate name
     * @parent --- Attributes ---
     * @type text
     * @desc How this entry will be labelled in-game.
     * @default Item drop rate
     */
    
    var Imported = Imported || {};                // Import namespace, var can redefine
    Imported.CaeX_YEPStatusMenuExt = 1.0;            // Import declaration
    
    var CAE = CAE || {};                    // Author namespace, var can redefine
    CAE.X_YEPStatusMenuExt = CAE.X_YEPStatusMenuExt || {};    // Plugin namespace
    
    (function(_) {
    
        if (!Imported.YEP_StatusMenuCore) console.error('CaeX_YEPStatusMenuCoreExt.js error! Could not find required plugin YEP_StatusMenuCore.js.');
    
        _.params = PluginManager.parameters('CaeX_YEPStatusMenuExt');
    
        _.Window_StatusInfo_drawAttributeData = Window_StatusInfo.prototype.drawAttributeData;
        Window_StatusInfo.prototype.drawAttributeData = function(attr, dx, dy, dw) {
            switch (attr) {
                case _.params['Gold drop rate key']:        // Gold drop rate
                    this.drawAttributeName(_.params['Gold drop rate name'], dx, dy, dw);
                    this.drawAttributeRate($gameParty.hasGoldDouble() ? 2 : 1, dx, dy, dw);
                    break;
                case _.params['Item drop rate key']:        // Item drop rate
                    this.drawAttributeName(_.params['Item drop rate name'], dx, dy, dw);
                    this.drawAttributeRate($gameParty.hasDropItemDouble() ? 2 : 1, dx, dy, dw);
                    break;
                default:
                    _.Window_StatusInfo_drawAttributeData.call(this, attr, dx, dy, dw);
                    break;
            }
        };
    
    })(CAE.X_YEPStatusMenuExt);
    The default "keys" (like eva, hit, mrg, etc) are gdr and idr, but you can change those, and the display text for each one, via the plugin parameters. Just add the key to whatever Attributes column you like via the appropriate parameter in Yanfly's Status Menu Core and it'll show up in-game. ^_^

    Oh shoot. I'm sorry, I wasn't being specific enough. Don't get me wrong, this is GREAT and its going down the path I am going, but its not EXACTLY what I am looking for.

    Let me rephrase: I also use Alistairs Gold/Item Drop Rate plugin. This allows for more control over the Gold and Drop Rate (going above the double increase). It would show an increase of Gold/Drop Rate if there was one, with the default being 100%. So lets say I did use Double Gold Rate, it would show a 200% increase. Then the character bought an item that increased it by +50% more, so now we are at 250%. I was hoping that maybe it could be shown in the Status Menu with compatibility to Yanfly's Status Menu Core.

    Thank you tho, this is defiantly part of what I was looking for!
  7. Oh I see, that makes more sense! xP

    I decided to rewrite the plugin a little; now, instead of offering two hard-coded values (gold and item drop rates), this version allows you to add whatever new attributes you like, and specify the formulae for each of them. I also found a way to reference the gold/item drop rates in a way that's compatible with Alistair's (and probably anyone else's) plugin. :kaopride:

    Here are the formulae (I also put them in the plugin help as examples):
    • Gold drop rate:
      Code:
      var trp = new Game_Troop(); trp.setup(1); trp.goldRate()
    • Item drop rate:
      Code:
      var nme = new Game_Enemy(1,0,0); nme.dropItemRate()

    And here's the code (also attached):
    Spoiler
    Code:
    //=========================================================
    // CaeX_YEPStatusMenuExt.js
    //=========================================================
    
    /*:
     * @plugindesc v1.1 - Lets you add more attributes to Yanfly's Status Menu Core.
     * @author Caethyril
     *
     * @help Plugin Commands:
     *   None.
     *
     * Help:
     *   Define new attributes to display by adding to the Custom Attributes list.
     *    - Key is the string used to determine where it shows in YEP_StatusMenuCore
     *    - Label is the name of the attribute, shown to the player in-game
     *    - Value is a formula determining the value of the attribute.
     *   Then just add the new key(s) via the plugin parameters of YEP_StatusMenuCore.
     *
     *   Example formulae (for gold & item drop rates):
     *    - var nme = new Game_Enemy(1,0,0); nme.dropItemRate()
     *        This will return the item drop rate for enemy #1.
     *    - var trp = new Game_Troop(); trp.setup(1); trp.goldRate()
     *        This will return the gold drop rate for troop #1.
     *   Note that typically these rates are identical for all enemies/troops.
     *
     * Compatibility:
     *   Must be loaded after Yanfly's Status Menu Core plugin.
     *   Aliases Yanfly's drawAttributeData method on Window_StatusInfo.
     *
     * Terms of use:
     *   Free to use and modify.
     *
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     * Update log:
     *   1.1: Redesigned, now allows arbitrary new attributes to be added! \o/
     *        Users must design their own formulae for the values, though.
     *        Added a couple of formula examples to the help description.
     *   1.0: Initial release.
     *
     * @param Custom Attributes
     * @text Custom Attributes
     * @type struct<CaeTypeCustomAttr>[]
     * @desc List of custom values to add to the Attributes page of Yanfly's Status Menu Core.
     * @default []
     */
    // ==================================================
    /*~struct~CaeTypeCustomAttr:
     * @param Key
     * @text Key
     * @type text
     * @desc The code for use in Yanfly's Status Menu Core plugin parameters.
     * @default
     *
     * @param Label
     * @text Label
     * @type text
     * @desc How this entry will be labelled in-game.
     * @default
     *
     * @param Value
     * @text Value
     * @type text
     * @desc Formula determining the value to display.
     * Attributes will always display as percentages (1 = 100%).
     * @default
     */
    
    var Imported = Imported || {};				// Import namespace, var can redefine
    Imported.CaeX_YEPStatusMenuExt = 1.1;			// Import declaration
    
    var CAE = CAE || {};					// Author namespace, var can redefine
    CAE.X_YEPStatusMenuExt = CAE.X_YEPStatusMenuExt || {};	// Plugin namespace
    
    (function(_) {
    
    'use strict';
    
    	if (!Imported.YEP_StatusMenuCore) console.error('CaeX_YEPStatusMenuExt.js error! Could not find required plugin YEP_StatusMenuCore.js.');
    
    	// Convert string -> array of {Key, Label, Value} objects
    	_.params = JSON.parse(PluginManager.parameters('CaeX_YEPStatusMenuExt')['Custom Attributes']).map(JSON.parse);
    
    	_.Window_StatusInfo_drawAttributeData = Window_StatusInfo.prototype.drawAttributeData;	// Alias
    	Window_StatusInfo.prototype.drawAttributeData = function(attr, dx, dy, dw) {
    		let ix = _.params.map(function(o) { return o.Key; }).indexOf(attr);		// Match key from plugin params
    		if (ix < 0) {									// If no match
    			_.Window_StatusInfo_drawAttributeData.call(this, attr, dx, dy, dw);	// Call original routine
    		} else {									// Else
    			let label = _.params[ix].Label;						// Get param label
    			let valEv = _.params[ix].Value;						// Get param value string
    			let value = 0;								// Initialise for scope
    			try {
    				value = eval(valEv);						// Attempt eval
    			} catch (ex) {								// On error, log message to console
    				console.log('CaeX_YEPStatusMenuExt.js error! Attribute eval failed:\n' + valEv);
    				value = 0;							// Then zero value
    			}
    			this.drawAttributeName(label, dx, dy, dw);				// Draw label
    			this.drawAttributeRate(value, dx, dy, dw);				// Draw value
    		}
    	};
    
    })(CAE.X_YEPStatusMenuExt);
    I tested quickly with Alistair's plugin and it seemed OK, but let me know if you run into problems with it! :kaojoy:

    Edit: oh and if you're using a pre-1.5 version of the editor I'm not sure whether the code will work but you'll definitely have trouble with the plugin parameter. I've pasted my plaintext version of the plugin parameter below just in case. :kaoswt:
    Code:
    ["{\"Key\":\"gdr\",\"Label\":\"Gold drop rate\",\"Value\":\"var trp = new Game_Troop(); trp.setup(1); trp.goldRate()\"}","{\"Key\":\"idr\",\"Label\":\"Item Drop Rate\",\"Value\":\"var nme = new Game_Enemy(1,0,0); nme.dropItemRate()\"}"]
  8. caethyril said:
    Oh I see, that makes more sense! xP

    I decided to rewrite the plugin a little; now, instead of offering two hard-coded values (gold and item drop rates), this version allows you to add whatever new attributes you like, and specify the formulae for each of them. I also found a way to reference the gold/item drop rates in a way that's compatible with Alistair's (and probably anyone else's) plugin. :kaopride:

    Here are the formulae (I also put them in the plugin help as examples):
    • Gold drop rate:
      Code:
      var trp = new Game_Troop(); trp.setup(1); trp.goldRate()
    • Item drop rate:
      Code:
      var nme = new Game_Enemy(1,0,0); nme.dropItemRate()

    And here's the code (also attached):
    Spoiler
    Code:
    //=========================================================
    // CaeX_YEPStatusMenuExt.js
    //=========================================================
    
    /*:
     * @plugindesc v1.1 - Lets you add more attributes to Yanfly's Status Menu Core.
     * @author Caethyril
     *
     * @help Plugin Commands:
     *   None.
     *
     * Help:
     *   Define new attributes to display by adding to the Custom Attributes list.
     *    - Key is the string used to determine where it shows in YEP_StatusMenuCore
     *    - Label is the name of the attribute, shown to the player in-game
     *    - Value is a formula determining the value of the attribute.
     *   Then just add the new key(s) via the plugin parameters of YEP_StatusMenuCore.
     *
     *   Example formulae (for gold & item drop rates):
     *    - var nme = new Game_Enemy(1,0,0); nme.dropItemRate()
     *        This will return the item drop rate for enemy #1.
     *    - var trp = new Game_Troop(); trp.setup(1); trp.goldRate()
     *        This will return the gold drop rate for troop #1.
     *   Note that typically these rates are identical for all enemies/troops.
     *
     * Compatibility:
     *   Must be loaded after Yanfly's Status Menu Core plugin.
     *   Aliases Yanfly's drawAttributeData method on Window_StatusInfo.
     *
     * Terms of use:
     *   Free to use and modify.
     *
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     * Update log:
     *   1.1: Redesigned, now allows arbitrary new attributes to be added! \o/
     *        Users must design their own formulae for the values, though.
     *        Added a couple of formula examples to the help description.
     *   1.0: Initial release.
     *
     * @param Custom Attributes
     * @text Custom Attributes
     * @type struct<CaeTypeCustomAttr>[]
     * @desc List of custom values to add to the Attributes page of Yanfly's Status Menu Core.
     * @default []
     */
    // ==================================================
    /*~struct~CaeTypeCustomAttr:
     * @param Key
     * @text Key
     * @type text
     * @desc The code for use in Yanfly's Status Menu Core plugin parameters.
     * @default
     *
     * @param Label
     * @text Label
     * @type text
     * @desc How this entry will be labelled in-game.
     * @default
     *
     * @param Value
     * @text Value
     * @type text
     * @desc Formula determining the value to display.
     * Attributes will always display as percentages (1 = 100%).
     * @default
     */
    
    var Imported = Imported || {};                // Import namespace, var can redefine
    Imported.CaeX_YEPStatusMenuExt = 1.1;            // Import declaration
    
    var CAE = CAE || {};                    // Author namespace, var can redefine
    CAE.X_YEPStatusMenuExt = CAE.X_YEPStatusMenuExt || {};    // Plugin namespace
    
    (function(_) {
    
    'use strict';
    
        if (!Imported.YEP_StatusMenuCore) console.error('CaeX_YEPStatusMenuExt.js error! Could not find required plugin YEP_StatusMenuCore.js.');
    
        // Convert string -> array of {Key, Label, Value} objects
        _.params = JSON.parse(PluginManager.parameters('CaeX_YEPStatusMenuExt')['Custom Attributes']).map(JSON.parse);
    
        _.Window_StatusInfo_drawAttributeData = Window_StatusInfo.prototype.drawAttributeData;    // Alias
        Window_StatusInfo.prototype.drawAttributeData = function(attr, dx, dy, dw) {
            let ix = _.params.map(function(o) { return o.Key; }).indexOf(attr);        // Match key from plugin params
            if (ix < 0) {                                    // If no match
                _.Window_StatusInfo_drawAttributeData.call(this, attr, dx, dy, dw);    // Call original routine
            } else {                                    // Else
                let label = _.params[ix].Label;                        // Get param label
                let valEv = _.params[ix].Value;                        // Get param value string
                let value = 0;                                // Initialise for scope
                try {
                    value = eval(valEv);                        // Attempt eval
                } catch (ex) {                                // On error, log message to console
                    console.log('CaeX_YEPStatusMenuExt.js error! Attribute eval failed:\n' + valEv);
                    value = 0;                            // Then zero value
                }
                this.drawAttributeName(label, dx, dy, dw);                // Draw label
                this.drawAttributeRate(value, dx, dy, dw);                // Draw value
            }
        };
    
    })(CAE.X_YEPStatusMenuExt);
    I tested quickly with Alistair's plugin and it seemed OK, but let me know if you run into problems with it! :kaojoy:

    Edit: oh and if you're using a pre-1.5 version of the editor I'm not sure whether the code will work but you'll definitely have trouble with the plugin parameter. I've pasted my plaintext version of the plugin parameter below just in case. :kaoswt:
    Code:
    ["{\"Key\":\"gdr\",\"Label\":\"Gold drop rate\",\"Value\":\"var trp = new Game_Troop(); trp.setup(1); trp.goldRate()\"}","{\"Key\":\"idr\",\"Label\":\"Item Drop Rate\",\"Value\":\"var nme = new Game_Enemy(1,0,0); nme.dropItemRate()\"}"]

    OMG THANK YOU. THIS WORKS.

    I had figured this was a low priority plugin request based on the context, but you came through and fast. Thank you so much. This helps a lot!

    Now if only I can get Mobile_UI to work the way I want it to...:hswt2:
  9. Ah, you'll have to ask Aloe about that. :kaoswt: (I did notice your screenshots in that plugin's thread don't seem to display, even via right-click > view image; maybe try hosting the images elsewhere and ask again?)

    Either way, happy to help! ^_^
  10. caethyril said:
    Ah, you'll have to ask Aloe about that. :kaoswt: (I did notice your screenshots in that plugin's thread don't seem to display, even via right-click > view image; maybe try hosting the images elsewhere and ask again?)

    Either way, happy to help! ^_^

    Yeah, that's because I was hosting the images on my personal website and I moved hosts/domains and effectively guillotined any linked images.

    But yes, when I get around to focusing on Mobile Depolyment again, I will prolly ask him.

    Right now it's about patchs and balance, lol.

    Thank you again!