Advertisement
jerry2810

currencyWindow

Nov 1st, 2015
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.70 KB | None
  1. //=============================================================================
  2. // currencyWindow.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Add guild currency.
  7.  * @author Jeremy Cannady
  8.  *
  9.  *
  10.  * @help Adds guild currency to main menu and ability to add guild currency via events.
  11.  *
  12.  *
  13.  *
  14.  
  15.     Plugin Commands
  16.     addGuildCurrency ######     where ######## is the amount you want to add
  17.  *
  18.  *
  19. */
  20.  
  21. (function(){
  22.  
  23. Game_Party.prototype.guildCurrency = 0;
  24.  
  25. Window_Gold.prototype.windowHeight = function() {
  26.     return this.fittingHeight(2);
  27. };
  28.  
  29. var copyofWindow_GoldRefresh =Window_Gold.prototype.refresh;
  30. Window_Gold.prototype.refresh = function() {
  31.     copyofWindow_GoldRefresh.call(this);
  32.     var x = this.textPadding();
  33.     var width = this.contents.width - this.textPadding() * 2;
  34.     this.drawGuildCurrencyValue($gameParty.guildCurrency, ' Guild Coins', x, 32, width);
  35. };
  36. Window_Base.prototype.drawGuildCurrencyValue = function(value, unit, x, y, width) {
  37.     var unitWidth = Math.min(80, this.textWidth(unit));
  38.     this.resetTextColor();
  39.     this.drawText(value, x, y, width - unitWidth - 6, 'right');
  40.     this.changeTextColor(this.systemColor());
  41.     this.drawText(unit, x + width - unitWidth, y, unitWidth, 'right');
  42. };
  43.  
  44. Game_Party.prototype.addGuildCurrency = function(value){
  45. this.guildCurrency += value;
  46. }
  47.  
  48. var guildCurrencyAdd = Game_Interpreter.prototype.pluginCommand;
  49. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  50.     guildCurrencyAdd.call(this, command, args);
  51.     if (command === "addGuildCurrency") {
  52.    
  53.         var arg = JSON.parse(args[0]);
  54.         console.log(arg);
  55.         $gameParty.addGuildCurrency(arg);
  56.     };
  57. };
  58. })();
Advertisement
RAW Paste Data Copied
Advertisement