Includes : Neopets : FlashGame [DEPRECATED]

By w35l3y Last update Mar 6, 2012 — Installed 19,519 times.

Script Summary: FlashGame Function



Version: 4.0.0.0

Copyright: 2012+, w35l3y (http://gm.wesley.eti.br)

License: GNU GPL

PayPal - The safer, easier way to pay online!

This script is deprecated!
New version : http://userscripts.org/scripts/show/127696

FOR SCRIPTERS/PROGRAMMERS only

If you are neither scripter nor programmer, you're discouraged to install this script directly.
In other words, don't install if you don't know what it is or how it works.

Implementing

// @resource       i18n http://i18n.pastebin.com/download.php?i=ULrVTsSg
// @require        http://www.onicos.com/staff/iz/amuse/javascript/expert/md5.txt
// @require        http://userscripts.org/scripts/source/63808.user.js
// @require        http://userscripts.org/scripts/source/85618.user.js
// @require        http://userscripts.org/scripts/source/87940.user.js
// @require        http://userscripts.org/scripts/source/54389.user.js
// @require        http://userscripts.org/scripts/source/54987.user.js
// @require        http://userscripts.org/scripts/source/56489.user.js
// @require        http://userscripts.org/scripts/source/69584.user.js
// @require        http://userscripts.org/scripts/source/66138.user.js

Documentation

Object FlashGame.convert(Document doc, String type)
Returns an object with useful properties from the document.
available types : play_flash|process_flash_score
Object FlashGame.includes
List of encryptions.
You can statically define the encryptions just by using for example FlashGame.includes["np8_include_v17"] = {...};
Void FlashGame.open({
"url" : String url,
"onsuccess" : Void callback_function(Object params)
})
Converts the page into an useful object.
Void FlashGame.url({
"opts" : Object options, // params.list of FlashGame.open callback
"onsuccess" : Void callback_function(Object params)
})
Generates the encrypted url based on the options
Void FlashGame.send({
"url" : String url, // params.output of FlashGame.url callback
"onsuccess" : Void callback_function(Object params)
})
Sends the score and converts the result into a useful object.
Void FlashGame.execute({
"id" : Number game_id,
"score" : Array [score, rnd_score, mod_score],
"time" : Array [time, rnd_time],
"continue" : Void callback_function2(Object params), // triggered when user confirms to send score (optional) "onsuccess" : Void callback_function1(Object params)
})
It's a simplified version of the other functions working together.
If you want to master this include then study the code of this function.

Examples

FlashGame.execute({
	"id" : 381,			// <--><--> s = x + random(y) ; s -= s % z
	"time" : [10718, 3580],		// <--> t = x + random(y)
	"onsuccess" : function(params)
	{
		if (!params.error && confirm("Send again?"))
		{
			params.recursive(params);
		}
		else
		{
			var o = [];
			for ( var p in params.list )
			o.push([p, params.list[p]].join("\t"));
			alert(o.join("\n"));
		}
	}
});