Includes : Neopets : The National Neopian Bank

By w35l3y Last update Aug 28, 2009 — Installed 522 times.


Script Summary: Bank Function

Version: 1.0.0.2

Copyright: 2009, w35l3y (http://gm.wesley.eti.br/includes/neopets)

License: GNU GPL

FOR SCRIPTERS/PROGRAMMERS only

If you are neither scripter nor programmer, you're discouraged to install this script directly.
But if you are and intend to use this script, please advice your users to install Mason (Firefox plugin) and follow the steps below (BEFORE INSTALLING section).
At time this is not required, but it may be in near future so it's highly recommended users to install Mason.

BEFORE INSTALLING (not required but highly recommended)

  1. Make sure to install Mason (Firefox plugin) first
  2. Once installed, right-click on Mason icon in statusbar or go to menu Tools > Mason Option...
  3. Click "Add..."
  4. Add:
    Description :	The National Neopian Bank : Bank.process
    URL :		^http:\/\/www\.neopets\.com\/process_bank\.phtml
    Content-Type :	(leave it blank)
    Function :	referrer to specified site
    Config... :	http://www.neopets.com/bank.phtml
    		(click "Config..." button to type the value above)
  5. Click OK
  6. Make sure to have the new option Activated
  7. Click OK again
  8. Then you may install the script

Implementing

// @require        http://userscripts.org/scripts/source/56489.user.js
// @require        http://userscripts.org/scripts/source/56533.user.js

Examples

Bank.collect({
	"onsuccess" : function(params)
	{
		if (!params.error)
			alert('Interest collected!');
		else if (params.message)
			alert(params.message.textContent);
		else
			alert('Unknown error');
	}
});
Bank.withdraw({
	"amount" : 1000,
	"pin" : "1234",
	"onsuccess" : function(params)
	{
		if (!params.error || params.message)
		{
			var hand = (params.response.xml.evaluate("string(id('header')//td/a[contains(@href,'?type=inventory')]/text())", params.response.xml, null, XPathResult.STRING_TYPE, null).stringValue||"unknown error").replace(/[,.]+/g, "");

			alert(params.message && params.message.textContent || "NPs on hand: " + hand);
		}
		else
			alert('Unknown error');
	}
});
Bank.deposit({	// you don't need to define a callback function to any of these functions
	"amount" : 1000
});