Jump to content
Sign in to follow this  
Guest Aurora

[AS3] SAFELY Injecting Actionscript/Incorporating Dependencies into Your Client

Recommended Posts

Hey guys.
 
So, as always, I'm going to give a little back-story of how I came across this method.. which doesn't seem to be known by many (thus why I'm creating this tutorial in the first place). Before even that, though, I would like to thank iWaddle and Shawn personally for helping me out with actionscript stuff. They helped introduce me to these type of modifications and without them, I probably wouldn't have discovered this and have been able to share it with you.
 
Now, this is probably easier than you think. The first thing you have to do is create a file you want to "inject" into the client using Adobe Flash Creative Suite. I'm going to name mine "kitsune." Kitsune consists of the following actionscript

var shell = _global.getCurrentShell();
var airtower = _global.getCurrentAirtower();
var INTERFACE = _global.getCurrentInterface();

var handlePrompt = function (obj) {
    obj.shift();
    INTERFACE.showPrompt('ok', obj[0]);
};

airtower.addListener('cprompt', handlePrompt);
    
var handleCustomError = function (obj) {
    obj.shift();
            
    var windowSize = shell.window_size[WINDOW_SMALL];
    var localizedString = shell.getLocalizedString("Okay");
    var errorText = obj[0];
    var errorType = obj[1];

    var onClickOk = function () {
        shell.closeErrorPrompt();
    };
            
    shell.showErrorPrompt(windowSize, errorText, localizedString, onClickOk, errorType);
};
    
airtower.addListener('cerror', handleCustomError);

Essentially what it does is define functions that allow the creation of custom prompts and error messages.
 
The file is obviously written in Actionscript 2.0, so make sure to choose that file type when you're presented with the "New Document" window.
 
After you've created the file you'd like to inject, save it to the client folder located at play/v2/client/.
 
Then open up dependencies.json which is also located in the client folder and clear the entire file, then paste the following and save it

{
    
    "boot": [
        {
            "id": "party",
            "title": "Party"
        },
        {
            "id": "airtower",
            "title": "Communication"
        },
        {
            "id": "sentry",
            "title": "Communication"
        }
    ],
    
    "login": [
        {
            "id": "login",
            "title": "Login Screen"
        }        
    ],
    
    "join": [
        {
            "id": "engine",
            "title": "Engine"
        },
        {
            "id": "interface",
            "title": "Interface"
        },
        {
            "id": "kitsune",
            "title": "World Customization"
        },
        {
            "id": "gridview",
            "title": "Gridview"
        },
        {
            "id": "mail",
            "title": "Mail"
        },
        {
            "id": "book",
            "title": "Mail"
        },
        {
            "id": "stampbook",
            "title": "StampBook"
        },
        {
            "id": "rooms_common",
            "title": "Rooms Common"
        }
    ],
    
    "merch": [
        {
            "id": "app",
            "folder": "merch/",
            "title": "Communication"
        }
    ]
    
}

Essentially what this is doing is adding your custom file to the client's dependency array, particularly after the interface, so it's requested after the interface has loaded.

 

Then you're done.. well not yet. You need to clear your cache and refresh the play page.. then you're done.

 

You can create custom error messages by sending packets like this

%xt%cerror%-1%Kitsune is a Club Penguin private server program written in PHP by Arthur designed to emulate the AS3 protocol.%Welcome%

Yay, congratulations!

 

Have fun everyone!

Share this post


Link to post
Share on other sites

I believe you can add the custom errors in the interface too but the code needs to be tweeted a bit in order for it to work.

Share this post


Link to post
Share on other sites

If you add the kitsune after the interface, you probably wouldn't need to check if the files are all loaded since kitsune would automatically be loaded after the interface, engine, and airtower are loaded.

Share this post


Link to post
Share on other sites

If you add the kitsune after the interface, you probably wouldn't need to check if the files are all loaded since kitsune would automatically be loaded after the interface, engine, and airtower are loaded.

You're probably right, but I don't I need the checks at all since the file is only really utilizing the shell which is loaded even before kitsune.

 

An example of a custom error

92FEN.png

Edit: My bad, I forgot about the custom prompt stuff.

 

Another edit: I have updated the actionscript; it's now shorter. The dependencies.json code has also been updated.

Share this post


Link to post
Share on other sites

I'm sorry for bringing back such an old topic, but I have a question.

Is there a way to edit listeners using the dependencies and kitsune.swf, just like you did?

Is it possible to add listeners if the packet already has a listener?

I want to edit the function showBalloon to add bubble color but I'm not sure how.

Please help..

Share this post


Link to post
Share on other sites
Sign in to follow this  

×