Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.clubpenguin.util.*;
- import com.clubpenguin.crypto.*;
- var SHELL = _global.getCurrentShell();
- var AIRTOWER = _global.getCurrentAirtower();
- AIRTOWER.connectToLogin = function(in_username, in_pass, login_response) {
- if (!AIRTOWER.is_logged_in) {
- AIRTOWER.on_login_response = login_response;
- AIRTOWER.username = in_username;
- AIRTOWER.password = in_pass;
- AIRTOWER.server.onConnection = Delegate.create(AIRTOWER, AIRTOWER.handleLoginConnection);
- AIRTOWER.server.onExtensionResponse = Delegate.create(AIRTOWER, AIRTOWER.onAirtowerResponse);
- AIRTOWER.server.debug = true;
- AIRTOWER.addListener(AIRTOWER.HANDLE_LOGIN, AIRTOWER.handleOnLogin);
- var _local1 = SHELL.getWorldCrumbs();
- var _local2;
- var _local3;
- for (_local2 in _local1) {
- _local3 = _local1[_local2];
- break;
- }
- SHELL.world_id_holder = _local3.id;
- AIRTOWER.server.connect(_local3.ip, _local3.port);
- } else {
- AIRTOWER.shell.$e("connectToLogin() -> Your already logged in! Cant login again");
- }
- }
- AIRTOWER.handleLoginConnection = function(success) {
- if(success) {
- AIRTOWER.login();
- } else {
- AIRTOWER.on_login_response(false);
- }
- }
- AIRTOWER.login = function() {
- AIRTOWER.server.login("w1", AIRTOWER.username, AIRTOWER.getLoginHash());
- }
- AIRTOWER.handleOnLogin = function(obj) {
- AIRTOWER.removeListener(AIRTOWER.HANDLE_LOGIN, AIRTOWER.handleOnLogin);
- AIRTOWER.shell.setMyPlayerId(obj[1]);
- AIRTOWER.playerId = obj[1];
- AIRTOWER.login_key = obj[2];
- AIRTOWER.on_login_response(true);
- AIRTOWER.is_logged_in = true;
- SHELL.gotoState(SHELL.PLAY_STATE);
- }
- SHELL.connectToWorld = function() {
- var _local1 = SHELL.getWorldById(SHELL.world_id_holder);
- SHELL.showLoading((SHELL.getLocalizedString("Joining") + " ") + _local1.name);
- AIRTOWER.joinWorld();
- }
- AIRTOWER.handleJoinWorld = function(obj) {
- AIRTOWER.removeListener(AIRTOWER.JOIN_WORLD, AIRTOWER.handleJoinWorld);
- var _local6 = Boolean(Number(obj[1]));
- var _local3 = Boolean(Number(obj[2]));
- var _local5 = Boolean(Number(obj[3]));
- var _local4 = Boolean(Number(obj[4]));
- AIRTOWER.on_world_response(true, _local6, _local3, _local5, _local4);
- AIRTOWER.on_world_response = undefined;
- }
- AIRTOWER.joinWorld = function() {
- AIRTOWER.server.onConnectionLost = Delegate.create(AIRTOWER, AIRTOWER.handleLostConnection);
- var _local2 = new Array();
- _local2.push(AIRTOWER.playerId);
- _local2.push(AIRTOWER.login_key);
- _local2.push(AIRTOWER.shell.getLanguageAbbriviation());
- if (AIRTOWER.isRedemption) {
- AIRTOWER.addListener(AIRTOWER.REDEMPTION_JOIN_WORLD, handleJoinRedemption, AIRTOWER);
- AIRTOWER.send(AIRTOWER.REDEMPTION, AIRTOWER.REDEMPTION_JOIN_WORLD, _local2, "str", -1);
- return(undefined);
- }
- AIRTOWER.on_world_response = SHELL.connectToWorldResponse;
- AIRTOWER.addListener(AIRTOWER.JOIN_WORLD, AIRTOWER.handleJoinWorld);
- AIRTOWER.send(AIRTOWER.PLAY_EXT, (AIRTOWER.NAVIGATION + "#") + AIRTOWER.JOIN_WORLD, _local2, "str", -1);
- }
- AIRTOWER.getLoginHash = function() {
- return SHA256.hash(AIRTOWER.password);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement