[TUTORIAL]How to Add Skins to the AS3 Client/Server

Posts 1–15 of 66 · Page 1 of 5
[TUTORIAL]How to Add Skins to the AS3 Client/Server
Here's another highly sought after feature from yours truly.

 
Screenshots





Disclaimer: This is not for the faint of heart as it requires editing/creating a massive amount of files, both for the client and server. I use IntelliJ IDEA for client editing and Visual Studio Express 2013 for server edits.

What this does: Adds fully functioning skins to the game in the form of dyes. Walk over them to see a preview, see them on character select, legends screen, death screen, graveyard, and merchants. They work exactly as dye textures now.

Credits to @Kithio and @Travoos for the coding behind this.

Let's begin...

AS3 CLIENT

Step 1

Right click the folder where all the main assets are located and select New->ActionScript Class. Name it "Embeds_skinsEmbed_" and click Create.

Step 2

Repeat Step 1 but this time name the file "Embeds_playersSkinsEmbed_".

Step 3

Repeat Step 1 but this time name the file "Embeds_playersSkinsMaskEmbed_".

Step 4

Replace the entire contents of "Embeds_skinsEmbed_.as" with this:

Code:
package
{
import mx.core.*;

[Embed(source="Embeds_skinsEmbed_.dat", mimeType="application/octet-stream")]
public class Embeds_skinsEmbed_ extends mx.core.ByteArrayAsset
{
    public function Embeds_skinsEmbed_()
    {
        super();
        return;
    }
}
}
Step 5

Replace the entire contents of "Embeds_playersSkinsEmbed_.as" with this:

Code:
package
{
import mx.core.*;

[Embed(source="Embeds_playersSkinsEmbed_.png")]
public class Embeds_playersSkinsEmbed_ extends mx.core.BitmapAsset
{
    public function Embeds_playersSkinsEmbed_()
    {
        super();
        return;
    }
}
}
Step 6

Replace the entire contents of "Embeds_playersSkinsMaskEmbed_.as" with this:

Code:
package
{
import mx.core.*;

[Embed(source="Embeds_playersSkinsMaskEmbed_.png")]
public class Embeds_playersSkinsMaskEmbed_ extends mx.core.BitmapAsset
{
    public function Embeds_playersSkinsMaskEmbed_()
    {
        super();
        return;
    }
}
}
Step 7

Download the attached file, extract it somewhere, and then navigate to that directory. It contains the necessary data and image files.

Step 8

Select the three files that were extracted all at once and click copy. Go back to IntelliJ, right click the main project folder again and select Paste. Now click Ok to import the files to your project.

Step 9

Navigate to com>company>assembleegameclient>util>loadEmbeds.as and add the following lines in bold to the correct spots:

Code:
_0B_c.add("players", new Embeds.playersEmbed_().bitmapData, new Embeds.playersMaskEmbed_().bitmapData, 8, 8, 56, 24, _lJ_.RIGHT);
_0B_c.add("playerskins", new Embeds.playerSkinsEmbed_().bitmapData, new Embeds.playerSkinsMaskEmbed_().bitmapData, 8, 8, 56, 24, _lJ_.RIGHT);
_0B_c.add("chars8x8rPets1", new Embeds.chars8x8rPets1Embed_().bitmapData, new Embeds.chars8x8rPets1MaskEmbed_().bitmapData, 8, 8, 56, 8, _lJ_.RIGHT);
Code:
public static var playersMaskEmbed_:Class = _tI_;
public static var playerSkinsEmbed_:Class = Embeds_playersSkinsEmbed_;
public static var playerSkinsMaskEmbed_:Class = Embeds_playersSkinsMaskEmbed_;
public static var chars8x8rPets1Embed_:Class = Embeds_chars8x8rPets1Embed_;
Step 10

Navigate to com>company>assembleegameclient>util>_H_f.as and make the following changes:

Code:
private static const _xE_:Class = _yq;
private static const skinsEmbed_:Class=Embeds_skinsEmbed_;
public static const _use:Array = [new _dv(), new _0I_f(), new _R_p(), new _0E_3(), new __if(), new _P_o(), new _84(), new _0L_x(), new _01O_(), new _0F_L_(), new _h9(), new _0J_O_(), new _7d(), new _xf(), new _S_U_(), new _0G_c(), new _py(), new _tJ_(), new _gA_(), new _hL_(), new _3q(), new _bp(), new _m3(), new _Y_b(), new _L_s(), new _package(), new _vT_(), new _080(), new _0K_a(), new _5o(), new _0_K_(), new _x6(), new _00b(), new _00T_(), new _xE_(), new skinsEmbed_()];
private static const _uX_:Class = _G_z;
Step 11

Now, at this point we have added the base code and files for skins and everything should compile just fine right now. Unfortunately, all you did up until now is add the data and textures to the source. Now it's time to actually get the skins to work just like dyes. So, take a leak, smoke a cig, grab a coffee and get ready for the real fun!

Step 12

Open com>company>assembleegameclient> appengine>SavedCharacter.as and find this:

Code:
public static function getImage(_arg1:SavedCharacter, _arg2:XML, _arg3:int, _arg4:int, _arg5:Number, _arg6:Boolean, _arg7:Boolean):BitmapData{
            var _local8:_lJ_ = _0B_c._J_v(String(_arg2.AnimatedTexture.File), int(_arg2.AnimatedTexture.Index));
            var _local9:_J_H_ = _local8.imageFromDir(_arg3, _arg4, _arg5);
            var _local10:int = (((_arg1)!=null) ? _arg1.tex1() : null);
            var _local11:int = (((_arg1)!=null) ? _arg1.tex2() : null);
            var _local12:BitmapData = TextureRedrawer.resize(_local9.image_, _local9.mask_, 100, false, _local10, _local11);
            _local12 = TextureRedrawer.outlineGlow(_local12, 0, 0);
            if (!_arg6)
            {
                _local12 = _G_._B_2(_local12, new ColorTransform(0, 0, 0, 0.5, 0, 0, 0, 0));
            } else
            {
                if (!_arg7)
                {
                    _local12 = _G_._B_2(_local12, new ColorTransform(0.75, 0.75, 0.75, 1, 0, 0, 0, 0));
                };
            };
            return (_local12);
        }
Replace with this:

Code:
public static function getImage(_arg1:SavedCharacter, _arg2:XML, _arg3:int, _arg4:int, _arg5:Number, _arg6:Boolean, _arg7:Boolean):BitmapData
        {
            var _skinx:XML;
            var _local10:int = (((_arg1)!=null) ? _arg1.tex1() : null);
            var _local11:int = (((_arg1)!=null) ? _arg1.tex2() : null);
            var _skin:int = ((!((_arg1 == null))) ? _arg1.skin() : -1);
            var _local8:_lJ_ = _0B_c._J_v(String(_arg2.AnimatedTexture.File), int(_arg2.AnimatedTexture.Index));
            if (_skin != -1)
            {
                _skinx = ObjectLibrary._Q_F_[_arg1.skin()];
                if (_skinx != null)
                {
                    _local8 = _0B_c._J_v(String(_skinx.AnimatedTexture.File), int(_skinx.AnimatedTexture.Index));
                };
            };
            var _local9:_J_H_ = _local8.imageFromDir(_arg3, _arg4, _arg5);
            var _local12:BitmapData = TextureRedrawer.resize(_local9.image_, _local9.mask_, 100, false, _local10, _local11);
            _local12 = TextureRedrawer.outlineGlow(_local12, 0, 0);
            if (!(_arg6))
            {
                _local12 = _G_._B_2(_local12, new ColorTransform(0, 0, 0, 0.5, 0, 0, 0, 0));
            }
            else
            {
                if (!(_arg7))
                {
                    _local12 = _G_._B_2(_local12, new ColorTransform(0.75, 0.75, 0.75, 1, 0, 0, 0, 0));
                };
            };
            return (_local12);
        }
Find this and add the line in bold:

Code:
public function tex1():int{
            return (int(this._iJ_.Tex1));
        }
public function tex2():int{
            return (int(this._iJ_.Tex2));
        }
public function skin():int
        {
            return (int(this._iJ_.Skin));
        }
Step 13

Open com>company>assembleegameclient>net>_1f.as and add the code in bold:

Code:
case StatData.TEX1_STAT:
                        _arg1.setTex1(_local4._h);
                        break;
case StatData.TEX2_STAT:
                        _arg1.setTex2(_local4._h);
                        break;
case StatData.SKIN_STAT:
                        _arg1.setSkin(_local4._h);
                        break;
Step 14

Open com>company>assembleegameclient>net>messages>data> StatData.as and add the line in bold:

Code:
public static const _5J_:int = 64;
public static const _bk:int = 65;
public static const SKIN_STAT:int = 66;
Step 15

Open com>company>assembleegameclient>objects>GameObject .as and add the lines in bold:

Code:
protected var tex1Id_:int = 0;
protected var tex2Id_:int = 0;
public var skinId_:int = -1;
public var tempSkinId_:int = -1;
Code:
if (_arg1.hasOwnProperty("Tex1"))
            {
                this.tex1Id_ = int(_arg1.Tex1);
            };
if (_arg1.hasOwnProperty("Tex2"))
            {
                this.tex2Id_ = int(_arg1.Tex2);
            };
if (_arg1.hasOwnProperty("Skin"))
            {
                this.setSkin(int(_arg1.SkinId));
            };
Code:
public function setTex1(_arg1:int):void{
            if (_arg1 == this.tex1Id_)
            {
                return;
            };
            this.tex1Id_ = _arg1;
            this._qm = new Dictionary();
            this._tm = null;
        }
public function setTex2(_arg1:int):void{
            if (_arg1 == this.tex2Id_)
            {
                return;
            };
            this.tex2Id_ = _arg1;
            this._qm = new Dictionary();
            this._tm = null;
        }
public function setSkin(_arg1:int, preview:Boolean=false):void
        {
            var _local2:_Z_H_;
            if ((((_arg1 == this.skinId_)) && (!(preview))))
            {
                return;
            };
            if (!(preview))
            {
                this.skinId_ = _arg1;
            };
            if ((((_arg1 == -1)) || ((ObjectLibrary._V_a[_arg1] == null))))
            {
                _local2 = ObjectLibrary._V_a[this.objectType_];
                this.texture_ = _local2.texture_;
                this.mask_ = _local2.mask_;
                this._yN_ = _local2._yN_;
                this._07_ = _local2._07_;
            }
            else
            {
                _local2 = ObjectLibrary._V_a[_arg1];
                this.texture_ = _local2.texture_;
                this.mask_ = _local2.mask_;
                this._yN_ = _local2._yN_;
                this._07_ = _local2._07_;
            };
        }

public function previewSkin(_arg1:int):void
        {
            if (_arg1 == this.tempSkinId_)
            {
                return;
            };
            if (_arg1 == -1)
            {
                this.setSkin(this.skinId_, true);
            }
            else
            {
                this.setSkin(_arg1, true);
            };
            this.tempSkinId_ = _arg1;
        }
Step 16

open com>company>assembleegameclient>objects>Merchant.a s and add the code in bold:

Code:
public function getTex2Id(_arg1:int):int{
            var _local2:XML = ObjectLibrary._Q_F_[this._0E_];
            if (_local2 == null)
            {
                return (_arg1);
            };
            if ((((_local2.Activate == "Dye")) && (_local2.hasOwnProperty("Tex2"))))
            {
                return (int(_local2.Tex2));
            };
            return (_arg1);
        }
public function getSkinId(_arg1:int, player:Player):int
        {
            var _skin:XML;
            var _local2:XML = ObjectLibrary._Q_F_[this._0E_];
            if (_local2 == null)
            {
                return (_arg1);
            };
            if ((((_local2.Activate == "UnlockSkin")) && (_local2.Activate.hasOwnProperty(      @skinType"))))
            {
                _skin = ObjectLibrary._Q_F_[int(_local2.Activate      @skinType)];
                if (_skin == null)
                {
                    return (_arg1);
                };
                if (!(_skin.hasOwnProperty("PlayerClassType")))
                {
                    return (_arg1);
                };
                if (int(_skin.PlayerClassType) != player.objectType_)
                {
                    return (_arg1);
                };
                return (int(_local2.Activate      @skinType));
            };
            return (_arg1);
        }
Step 17

Open com>company>assembleegameclient>objects>ObjectLibr ary.as and replace this function:

Code:
public static function _d1(_arg1:int, _arg2:Player):Boolean{
            if (_arg2 == null)
            {
                return (true);
            };
            var _local3:XML = _Q_F_[_arg1];
            if ((((_local3 == null)) || (!(_local3.hasOwnProperty("SlotType")))))
            {
                return (false);
            };
            var _local4:int = _local3.SlotType;
            if (_local4 == Slot._U_l)
            {
                return (true);
            };
            var _local5:int;
            while (_local5 < _arg2._9A_.length)
            {
                if (_arg2._9A_[_local5] == _local4)
                {
                    return (true);
                };
                _local5++;
            };
            return (false);
        }
With this:

Code:
public static function _d1(_arg1:int, _arg2:Player):Boolean{
            var _local5:int;
            var _skin:XML;
            if (_arg2 == null)
            {
                return (true);
            };
            var _local3:XML = _Q_F_[_arg1];
            if ((((_local3 == null)) || (!(_local3.hasOwnProperty("SlotType")))))
            {
                return (false);
            };
            if ((((_local3.Activate == "UnlockSkin")) && (_local3.Activate.hasOwnProperty(      @skinType"))))
            {
                _skin = ObjectLibrary._Q_F_[int(_local3.Activate      @skinType)];
                if ((((((_skin == null)) || (!(_skin.hasOwnProperty("PlayerClassType"))))) || (!((int(_skin.PlayerClassType) == _arg2.objectType_)))))
                {
                    return (false);
                };
            };
            var _local4:int = _local3.SlotType;
            if (_local4 == Slot._U_l)
            {
                return (true);
            };
            while (_local5 < _arg2._9A_.length)
            {
                if (_arg2._9A_[_local5] == _local4)
                {
                    return (true);
                };
                _local5++;
            };
            return (false);
        }
Then replace this fuction:
Code:
public static function _7S_(_arg1:int):Vector.<String>{
            var _local5:XML;
            var _local6:Vector.<int>;
            var _local7:int;
            var _local2:XML = _Q_F_[_arg1];
            if ((((_local2 == null)) || (!(_local2.hasOwnProperty("SlotType")))))
            {
                return (null);
            };
            var _local3:int = _local2.SlotType;
            if ((((_local3 == Slot._U_l)) || ((_local3 == Slot._yW_))))
            {
                return (null);
            };
            var _local4:Vector.<String> = new Vector.<String>();
            for each (_local5 in _tj)
            {
                _local6 = ConversionUtil._04n(_local5.SlotTypes);
                _local7 = 0;
                while (_local7 < _local6.length)
                {
                    if (_local6[_local7] == _local3)
                    {
                        _local4.push(_0D_N_[int(_local5      @Type)]);
                        break;
                    };
                    _local7++;
                };
            };
            return (_local4);
        }
With this:

Code:
public static function _7S_(_arg1:int):Vector.<String>{
            var _local5:XML;
            var _local6:Vector.<int>;
            var _local7:int;
            var _skin:XML;
            var _local2:XML = _Q_F_[_arg1];
            if ((((_local2 == null)) || (!(_local2.hasOwnProperty("SlotType")))))
            {
                return (null);
            };
            var _local3:int = _local2.SlotType;
            if ((((_local2.Activate == "UnlockSkin")) && (_local2.Activate.hasOwnProperty(      @skinType"))))
            {
                _skin = ObjectLibrary._Q_F_[int(_local2.Activate      @skinType)];
                if (((!((_skin == null))) && (_skin.hasOwnProperty("PlayerClassType"))))
                {
                    return (new <String>[_0D_N_[int(_skin.PlayerClassType)]]);
                };
            };
            if ((((_local3 == Slot._U_l)) || ((_local3 == Slot._yW_))))
            {
                return (null);
            };
            var _local4:Vector.<String> = new Vector.<String>();
            for each (_local5 in _tj)
            {
                _local6 = ConversionUtil._04n(_local5.SlotTypes);
                _local7 = 0;
                while (_local7 < _local6.length)
                {
                    if (_local6[_local7] == _local3)
                    {
                        _local4.push(_0D_N_[int(_local5      @Type)]);
                        break;
                    };
                    _local7++;
                };
            };
            return (_local4);
        }
Step 18

Open com>company>assembleegameclient>objects>Player.as and add the lines in bold:

Code:
_local5.tex1Id_ = int(_arg2.Tex1);
_local5.tex2Id_ = int(_arg2.Tex2);
_local5.setSkin(int(_arg2.Skin));
Code:
_local6 = this._0D_8.getTex1Id(tex1Id_);
                _local7 = this._0D_8.getTex2Id(tex2Id_);
                this.previewSkin(this._0D_8.getSkinId(skinId_, this));
            } else
            {
                _local8 = _qm[_local5];
                this.previewSkin(-1);
            };
            if (_local8 == null)
Step 19

Open com>company>assembleegameclient>ui>_Q_y.as and replace this function:

Code:
public function _Q_y(_arg1:Boolean, _arg2:int, _arg3:XML){
            var _local5:XML;
            super();
            this.accountId_ = _arg3      @accountid;
            this.charId_ = _arg3      @charId;
            var _local4:uint = 0xFFFFFF;
            if (_arg1)
            {
                _local4 = 16564761;
            } else
            {
                if (_arg2 == 1)
                {
                    _local4 = 16646031;
                };
            };
            this._30 = new SimpleText(22, _local4, false, 0, 0, "Myriad Pro");
            this._30.setBold(!((_arg2 == -1)));
            this._30.text = (((_arg2)==-1) ? "---" : (_arg2.toString() + "."));
            this._30._08S_();
            this._30.filters = [new DropShadowFilter(0, 0, 0, 1, 8, 8)];
            this._30.x = (82 - this._30.width);
            this._30.y = ((HEIGHT / 2) - (this._30.height / 2));
            addChild(this._30);
            _local5 = ObjectLibrary._Q_F_[int(_arg3.ObjectType)];
            var _local6:_lJ_ = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
            var _local7:_J_H_ = _local6.imageFromDir(_lJ_.RIGHT, _lJ_._sS_, 0);
            var _local8:int = ((_arg3.hasOwnProperty("Tex1")) ? _arg3.Tex1 : 0);
            var _local9:int = ((_arg3.hasOwnProperty("Tex2")) ? _arg3.Tex2 : 0);
            var _local10:BitmapData = TextureRedrawer.resize(_local7.image_, _local7.mask_, 100, false, _local8, _local9);
            _local10 = TextureRedrawer.outlineGlow(_local10, 0, 0);
            _local10 = BitmapUtil._Y_d(_local10, 6, 6, (_local10.width - 12), (_local10.height - 6));
            this.bitmap_ = new Bitmap(_local10);
            this.bitmap_.x = 104;
            this.bitmap_.y = (((HEIGHT / 2) - (this.bitmap_.height / 2)) - 2);
            addChild(this.bitmap_);
            this.nameText_ = new SimpleText(22, _local4, false, 0, 0, "Myriad Pro");
            this.nameText_.setBold(true);
            this.nameText_.text = _arg3.Name;
            this.nameText_._08S_();
            this.nameText_.filters = [new DropShadowFilter(0, 0, 0, 1, 8, 8)];
            this.nameText_.x = 170;
            this.nameText_.y = ((HEIGHT / 2) - (this.nameText_.height / 2));
            addChild(this.nameText_);
            this._4N_ = ConversionUtil._04n(_arg3.Equipment);
            this._4N_.length = 4;
            var _local11:Vector.<int> = ConversionUtil._04n(_local5.SlotTypes);
            _local11.length = 4;
            this._e9 = new Inventory(null, null, "Inventory", _local11, 4, false);
            this._e9.x = 400;
            this._e9.y = ((HEIGHT / 2) - (Slot.HEIGHT / 2));
            addChild(this._e9);
            this._D_a = new SimpleText(22, _local4, false, 0, 0, "Myriad Pro");
            this._D_a.setBold(true);
            this._D_a.text = _arg3.TotalFame;
            this._D_a._08S_();
            this._D_a.filters = [new DropShadowFilter(0, 0, 0, 1, 8, 8)];
            this._D_a.x = (660 - this._D_a.width);
            this._D_a.y = ((HEIGHT / 2) - (this._D_a.height / 2));
            addChild(this._D_a);
            var _local12:BitmapData = AssetLibrary._xK_("lofiObj3", 224);
            this._0H_ = new Bitmap(TextureRedrawer.redraw(_local12, 40, true, 0, 0));
            this._0H_.x = 652;
            this._0H_.y = ((HEIGHT / 2) - (this._0H_.height / 2));
            addChild(this._0H_);
            this.draw();
            addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
            addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
            addEventListener(MouseEvent****LL_OUT, this.onRollOut);
        }
With this:

Code:
public function _Q_y(_arg1:Boolean, _arg2:int, _arg3:XML)
        {
            var _local5:XML;
            var _local6:_lJ_;
            var _skinx:XML;
            super();
            this.accountId_ = _arg3      @accountid;
            this.charId_ = _arg3      @charId;
            var _local4:uint = 0xFFFFFF;
            if (_arg1)
            {
                _local4 = 16564761;
            }
            else
            {
                if (_arg2 == 1)
                {
                    _local4 = 16646031;
                };
            };
            this._30 = new SimpleText(22, _local4, false, 0, 0, "Myriad Pro");
            this._30.setBold(!((_arg2 == -1)));
            this._30.text = (((_arg2)==-1) ? "---" : (_arg2.toString() + "."));
            this._30._08S_();
            this._30.filters = [new DropShadowFilter(0, 0, 0, 1, 8, 8)];
            this._30.x = (82 - this._30.width);
            this._30.y = ((HEIGHT / 2) - (this._30.height / 2));
            addChild(this._30);
            _local5 = ObjectLibrary._Q_F_[int(_arg3.ObjectType)];
            var _local8:int = ((_arg3.hasOwnProperty("Tex1")) ? _arg3.Tex1 : 0);
            var _local9:int = ((_arg3.hasOwnProperty("Tex2")) ? _arg3.Tex2 : 0);
            var _skin:int = ((_arg3.hasOwnProperty("Skin")) ? _arg3.Skin : -1);
            if (_skin == -1)
            {
                _local6 = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
            }
            else
            {
                _skinx = ObjectLibrary._Q_F_[_skin];
                if (_skinx == null)
                {
                    _local6 = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
                }
                else
                {
                    _local6 = _0B_c._J_v(String(_skinx.AnimatedTexture.File), int(_skinx.AnimatedTexture.Index));
                };
            };
            var _local7:_J_H_ = _local6.imageFromDir(_lJ_.RIGHT, _lJ_._sS_, 0);
            var _local10:BitmapData = TextureRedrawer.resize(_local7.image_, _local7.mask_, 100, false, _local8, _local9);
            _local10 = TextureRedrawer.outlineGlow(_local10, 0, 0);
            _local10 = BitmapUtil._Y_d(_local10, 6, 6, (_local10.width - 12), (_local10.height - 6));
            this.bitmap_ = new Bitmap(_local10);
            this.bitmap_.x = 104;
            this.bitmap_.y = (((HEIGHT / 2) - (this.bitmap_.height / 2)) - 2);
            addChild(this.bitmap_);
            this.nameText_ = new SimpleText(22, _local4, false, 0, 0, "Myriad Pro");
            this.nameText_.setBold(true);
            this.nameText_.text = _arg3.Name;
            this.nameText_._08S_();
            this.nameText_.filters = [new DropShadowFilter(0, 0, 0, 1, 8, 8)];
            this.nameText_.x = 170;
            this.nameText_.y = ((HEIGHT / 2) - (this.nameText_.height / 2));
            addChild(this.nameText_);
            this._4N_ = ConversionUtil._04n(_arg3.Equipment);
            this._4N_.length = 4;
            var _local11:Vector.<int> = ConversionUtil._04n(_local5.SlotTypes);
            _local11.length = 4;
            this._e9 = new Inventory(null, null, "Inventory", _local11, 4, false);
            this._e9.x = 400;
            this._e9.y = ((HEIGHT / 2) - (Slot.HEIGHT / 2));
            addChild(this._e9);
            this._D_a = new SimpleText(22, _local4, false, 0, 0, "Myriad Pro");
            this._D_a.setBold(true);
            this._D_a.text = _arg3.TotalFame;
            this._D_a._08S_();
            this._D_a.filters = [new DropShadowFilter(0, 0, 0, 1, 8, 8)];
            this._D_a.x = (660 - this._D_a.width);
            this._D_a.y = ((HEIGHT / 2) - (this._D_a.height / 2));
            addChild(this._D_a);
            var _local12:BitmapData = AssetLibrary._xK_("lofiObj3", 224);
            this._0H_ = new Bitmap(TextureRedrawer.redraw(_local12, 40, true, 0, 0));
            this._0H_.x = 652;
            this._0H_.y = ((HEIGHT / 2) - (this._0H_.height / 2));
            addChild(this._0H_);
            this.draw();
            addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
            addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
            addEventListener(MouseEvent****LL_OUT, this.onRollOut);
        }
Step 20

Open _F_1>_U_W_.as and replace this function:

Code:
public function _sQ_(_arg1:XML):void{
            var _local9:Bitmap;
            var _local2:Sprite = new Sprite();
            var _local3:Sprite = new FameIconBackgroundDesign();
            _local3.filters = [new DropShadowFilter(0, 0, 0, 0.5, 12, 12)];
            _local2.addChild(_local3);
            var _local4:XML = new XML(_arg1);
            var _local5:XML = ObjectLibrary._Q_F_[int(_local4.ObjectType)];
            var _local6:_lJ_ = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
            var _local7:_J_H_ = _local6.imageFromDir(_lJ_.RIGHT, _lJ_._sS_, 0);
            var _local8:BitmapData = TextureRedrawer.resize(_local7.image_, _local7.mask_, 250, true, int(_local4.Tex1), int(_local4.Tex2));
            _local8 = TextureRedrawer.outlineGlow(_local8, 0, 0);
            _local9 = new Bitmap(_local8);
            _local9.x = ((_local2.width / 2) - (_local9.width / 2));
            _local9.y = ((_local2.height / 2) - (_local9.height / 2));
            _local2.addChild(_local9);
            _local2.y = 20;
            stage;
            _local2.x = ((800 / 2) - (_local2.width / 2));
            this._9N_.addChild(_local2);
        }
With this:

Code:
public function _sQ_(_arg1:XML):void
        {
            var _local9:Bitmap;
            var _local2:Sprite;
            var _skinx:XML;
            _local2 = new Sprite();
            var _local3:Sprite = new FameIconBackgroundDesign();
            _local3.filters = [new DropShadowFilter(0, 0, 0, 0.5, 12, 12)];
            _local2.addChild(_local3);
            var _local4:XML = new XML(_arg1);
            var _local5:XML = ObjectLibrary._Q_F_[int(_local4.ObjectType)];
            var _skin:int = int(((_local4.hasOwnProperty("Skin")) ? _local4.Skin : -1));
            var _local6:_lJ_ = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
            if (_skin == -1)
            {
                _local6 = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
            }
            else
            {
                _skinx = ObjectLibrary._Q_F_[_skin];
                if (_skinx == null)
                {
                    _local6 = _0B_c._J_v(String(_local5.AnimatedTexture.File), int(_local5.AnimatedTexture.Index));
                };
                _local6 = _0B_c._J_v(String(_skinx.AnimatedTexture.File), int(_skinx.AnimatedTexture.Index));
            };
            var _local7:_J_H_ = _local6.imageFromDir(_lJ_.RIGHT, _lJ_._sS_, 0);
            var _local8:BitmapData = TextureRedrawer.resize(_local7.image_, _local7.mask_, 250, true, int(_local4.Tex1), int(_local4.Tex2));
            _local8 = TextureRedrawer.outlineGlow(_local8, 0, 0);
            _local9 = new Bitmap(_local8);
            _local9.x = ((_local2.width / 2) - (_local9.width / 2));
            _local9.y = ((_local2.height / 2) - (_local9.height / 2));
            _local2.addChild(_local9);
            _local2.y = 20;
            stage;
            _local2.x = ((800 / 2) - (_local2.width / 2));
            this._9N_.addChild(_local2);
        }
Step 21

Open _zD_>_jT_.as and replace this function:

Code:
private function _07R_(_arg1:_wx):void{
            var _local2:SavedCharacter;
            var _local3:int;
            var _local4:XML;
            var _local5:_lJ_;
            var _local6:_J_H_;
            var _local7:int;
            var _local8:int;
            var _local9:BitmapData;
            var _local10:BitmapData;
            _local2 = null;
            for each (_local2 in this._eJ_._T_1.savedChars_)
            {
                if (this._eJ_._sy == _local2.charId()) break;
            };
            if (_local2)
            {
                _local3 = int(_local2._iJ_.ObjectType);
                _local4 = ObjectLibrary._Q_F_[_local3];
                _local5 = _0B_c._J_v(String(_local4.AnimatedTexture.File), int(_local4.AnimatedTexture.Index));
                _local6 = _local5.imageFromDir(_lJ_.RIGHT, _lJ_._m1, 0);
                _local7 = (((_local2)!=null) ? _local2.tex1() : null);
                _local8 = (((_local2)!=null) ? _local2.tex2() : null);
                _local9 = TextureRedrawer.resize(_local6.image_, _local6.mask_, 100, false, _local7, _local8);
                _local6 = _local5.imageFromDir(_lJ_.RIGHT, _lJ_._m1, 0.5);
                _local7 = (((_local2)!=null) ? _local2.tex1() : null);
                _local8 = (((_local2)!=null) ? _local2.tex2() : null);
                _local10 = TextureRedrawer.resize(_local6.image_, _local6.mask_, 100, false, _local7, _local8);
            };
            this.view.display(_arg1.name_, 0, _local9, _local10);
        }
With this:

Code:
private function _07R_(_arg1:_wx):void
        {
            var _local2:SavedCharacter;
            var _local3:int;
            var _local4:XML;
            var _local5:_lJ_;
            var _local6:_J_H_;
            var _local7:int;
            var _local8:int;
            var _local9:BitmapData;
            var _local10:BitmapData;
            var _skin:int;
            var _skinx:XML;
            _local2 = null;
            for each (_local2 in this._eJ_._T_1.savedChars_)
            {
                if (this._eJ_._sy == _local2.charId()) break;
            };
            if (_local2)
            {
                _local3 = int(_local2._iJ_.ObjectType);
                _local4 = ObjectLibrary._Q_F_[_local3];
                _skin = ((!((_local2 == null))) ? _local2.skin() : -1);
                _local5 = _0B_c._J_v(String(_local4.AnimatedTexture.File), int(_local4.AnimatedTexture.Index));
                if (_skin != -1)
                {
                    _skinx = ObjectLibrary._Q_F_[_local2.skin()];
                    if (_skinx != null)
                    {
                        _local5 = _0B_c._J_v(String(_skinx.AnimatedTexture.File), int(_skinx.AnimatedTexture.Index));
                    };
                };
                _local6 = _local5.imageFromDir(_lJ_.RIGHT, _lJ_._m1, 0);
                _local7 = (((_local2)!=null) ? _local2.tex1() : null);
                _local8 = (((_local2)!=null) ? _local2.tex2() : null);
                _local9 = TextureRedrawer.resize(_local6.image_, _local6.mask_, 100, false, _local7, _local8);
                _local6 = _local5.imageFromDir(_lJ_.RIGHT, _lJ_._m1, 0.5);
                _local7 = (((_local2)!=null) ? _local2.tex1() : null);
                _local8 = (((_local2)!=null) ? _local2.tex2() : null);
                _local10 = TextureRedrawer.resize(_local6.image_, _local6.mask_, 100, false, _local7, _local8);
            };
            this.view.display(_arg1.name_, 0, _local9, _local10);
        }
Step 22

Click file->Save All. Then Build->Rebuild Project. There should be no errors and if there are you did something wrong. Also note that the file _1f.as might already have an error before doing any of this so it's advisable to fix that first which is mentioned in another thread. Your client is now capable of skins.

Now, let's move on and get this all added to the server source and database.

C# Server

Step 1

Open up your server database with your favorite SQL program. Find the "death" table and create a new column right after "tex2" called "skin" with the following values: Name: skin , Datatype: INT , Length: 11 , Null: NOT NULL. You should now have a new column called "skin" in your "death" table. Do the same exact thing to the "characters" table by adding this after the "tex2" column there as well.

Step 2

Open wserver>realm>Stats.cs and add this to the end of the list:

Code:
Skins = 66
Step 3

Open wserver>realm/entities/player/Player.cs and add the following lines in bold throughout:

Code:
public int Texture1 { get; set; }
public int Texture2 { get; set; }
public int Skins { get; set; }
Code:
case StatsType.Texture1: Texture1 = (int)val; break;
case StatsType.Texture2: Texture2 = (int)val; break;
case StatsType.Skins: Skins = (int)val; break;
Code:
stats[StatsType.Texture1] = Texture1;
stats[StatsType.Texture2] = Texture2;
stats[StatsType.Skins] = Skins;
Code:
chr.Tex1 = Texture1;
chr.Tex2 = Texture2;
chr.Skin = Skins;
Code:
Texture1 = client.Character.Tex1;
Texture2 = client.Character.Tex2;
Skins = client.Character.Skin;
Step 4

Open wserver/realm/entities/Decoy.cs and add the line in bold:

Code:
protected override void ExportStats(IDictionary<StatsType, object> stats)
        {
            stats[StatsType.Texture1] = player.Texture1;
            stats[StatsType.Texture2] = player.Texture2;
            stats[StatsType.Skins] = player.Skins;
            base.ExportStats(stats);
        }
Step 5

Open db>Database.cs and add the following lines in bold throughout:

Code:
Tex1 = rdr.GetInt32("tex1"),
Tex2 = rdr.GetInt32("tex2"),
Skin = rdr.GetInt32("skin"),
Dead = false,
Code:
Tex1 = 0,
Tex2 = 0,
Skin = 0,
Dead = false,
Code:
Tex1 = rdr.GetInt32("tex1"),
Tex2 = rdr.GetInt32("tex2"),
Skin = rdr.GetInt32("skin"),
Dead = rdr.GetBoolean("dead"),
Code:
tex1      @tex1, 
tex2      @tex2, 
skin      @skin,
pet=@pet,
Code:
cmd.Parameters.AddWithValue(      @tex1", chr.Tex1);
cmd.Parameters.AddWithValue(      @tex2", chr.Tex2);
cmd.Parameters.AddWithValue(      @skin", chr.Skin);
cmd.Parameters.AddWithValue("@pet", chr.Pet);
Find this segment and make the changes in bold:

Code:
cmd.CommandText = @"INSERT INTO death(accId, chrId, name, charType, tex1, tex2, skin, items, fame, fameStats, totalFame, firstBorn, killer) 
VALUES      @AccId,      @CHRID,      @NaMe..,      @objType,      @tex1,      @tex2,      @skin,      @Items,      @Fame,      @famestats,      @TotalFame,      @Firstborn,      @Killer);";
Code:
cmd.Parameters.AddWithValue(      @tex1", chr.Tex1);
cmd.Parameters.AddWithValue(      @tex2", chr.Tex2);
cmd.Parameters.AddWithValue(      @skin", chr.Skin);
cmd.Parameters.AddWithValue(      @Items", chr._Equipment);
Step 6

Open server>fame>list.cs and add the lines in bold:

Code:
var tex1Elem = doc.CreateElement("Tex1");
                            tex1Elem.InnerText = rdr.GetString("tex1");
                            elem.AppendChild(tex1Elem);
                            var tex2Elem = doc.CreateElement("Tex2");
                            tex2Elem.InnerText = rdr.GetString("tex2");
                            elem.AppendChild(tex2Elem);
                            var skinElem = doc.CreateElement("Skin");
                            skinElem.InnerText = rdr.GetString("skin");
                            elem.AppendChild(skinElem);
                            var equElem = doc.CreateElement("Equipment");
                            equElem.InnerText = rdr.GetString("items");
                            elem.AppendChild(equElem);
Step 7

Open db>Models.cs and add the line in bold:

Code:
    public int Tex1 { get; set; }
    public int Tex2 { get; set; }
    public int Skin { get; set; }
    public string PCStats { get; set; }
Step 8

Open proxy>s.cs and add this somewhere:

Code:
Skins = 66
Step 9

Right click the db>data directory and Add->New Item. Select XML File, name it "dat36.xml" and click Add.

Final Step

Go back to the files you extracted earlier from the attachment and open "Embeds_skinsEmbed_.dat" in a text editor. Copy the entire contents and paste it to the new file you created in Visual Studio "dat36.xml"

Congratulations! You now have fully working skins! I recommend making your own skins with a mixture from production instead of using these straight out.

Cyb0r wit i?

 
Credits

Me - This took a TON of work to put together as you can imagine. Please enjoy!


Scans:
http://virusscan.jotti.org/en/scanre...192ba1c97b86e4
https://www.virustotal.com/en/file/d...is/1423008510/
data_images_mpgh.net.zip61 KB · 149 downloads Clean
If this works then I shall rep.
Quote Originally Posted by sacredmike View Post
If this works then I shall rep.
I had to go back and do this all from scratch in order to write such a detailed tutorial since I've had this for a while.

I made sure it absolutely works 100%.

It's possible I may have missed something on the server side but I don't think so. If you run into any problems and you know for a fact you did it correctly then I will help.

Also keep in mind that MPGH can be strange with the "dots" in code sometimes and will spell an actual period out as "(dot)" sometimes. I didn't see any of that nonsense going on here but I didn't check the MPGH conversion thoroughly either.
Quote Originally Posted by Snuffleupagus View Post
I had to go back and do this all from scratch in order to write such a detailed tutorial since I've had this for a while.

I made sure it absolutely works 100%.

It's possible I may have missed something on the server side but I don't think so. If you run into any problems and you know for a fact you did it correctly then I will help.

Also keep in mind that MPGH can be strange with the "dots" in code sometimes and will spell an actual period out as "(dot)" sometimes. I didn't see any of that nonsense going on here but I didn't check the MPGH conversion thoroughly either.
I do not have the time right now to try. But, I did look through the code. Amazingly done!
I can confirm that this works. (even though I haven't tested it, I've looked at it's code and it's solid)

+5 for great tutorial and code.
Looks a lot like travs work but slightly modified... I should have him take a look at it and actually see...

I know I had skins in my client that was publicly released that was later decompiled
Quote Originally Posted by Kithio View Post
Looks a lot like travs work but slightly modified... I should have him take a look at it and actually see...

I know I had skins in my client that was publicly released that was later decompiled
From what I see, yeah, this is pretty much a slightly modified version of my code. What else would it be? Nobody else on MPGH can code things themselves anyways.
Quote Originally Posted by Kithio View Post
Looks a lot like travs work but slightly modified... I should have him take a look at it and actually see...

I know I had skins in my client that was publicly released that was later decompiled
You need to get a life instead of trying to shit on every post I make.

I'm sharing my knowledge with this community in the form of highly detailed tutorials because I don't believe in keeping these things a secret unlike you. Just remember where you got the original source code for both the client and server, from someone elses hard work. You wouldn't even have a source to call "yours" if it wasn't for the selfless effort of others so you have no room to talk about what's yours and what isn't. My tutorials actually help to advance private servers which is what the original authors intended for us to do. Not to keep it private like a selfish prick and tell everyone else "learn2code".

This is my code, my tutorial, and my thread, end of story.

Also as you said, just for giggles, your client is publicly available which means that anything in it is fair game. So please quit your whining.

Quote Originally Posted by ~V~ View Post
I just find out that wServer crash when you give yourself actual skin item
Give your character a skin in the database and see if that works. Try 835 which is a wizard skin. These aren't meant to be "given".

Quote Originally Posted by Travoos View Post
From what I see, yeah, this is pretty much a slightly modified version of my code. What else would it be? Nobody else on MPGH can code things themselves anyways.
There's only one way to code skins as dyes and I'm sure they all look similar. You know what they say about assumptions.

Quote Originally Posted by sacredmike View Post
It's not a give item. It's what your player changes into. You have to make a new item for the skin and activate it.
Bingo.
Quote Originally Posted by Travoos View Post
From what I see, yeah, this is pretty much a slightly modified version of my code. What else would it be? Nobody else on MPGH can code things themselves anyways.
nah, there are a few more guys who can do stuff for themselves, but lets say 99% cant code
Awesome tutorial its work for me but there is some errors if you just copy paste most of it is just line line break and missing dots but its still awesome


EDIT:
I just find out that wServer crash when you give yourself actual skin item
Quote Originally Posted by ~V~ View Post
Awesome tutorial its work for me but there is some errors if you just copy paste most of it is just line line break and missing dots but its still awesome


EDIT:
I just find out that wServer crash when you give yourself actual skin item
It's not a give item. It's what your player changes into. You have to make a new item for the skin and activate it.
Quote Originally Posted by sacredmike View Post
It's not a give item. It's what your player changes into. You have to make a new item for the skin and activate it.
Thanks didn't even look at xml's


Quote Originally Posted by Snuffleupagus View Post
Give your character a skin in the database and see if that works. Try 835 which is a wizard skin. These aren't meant to be "given".
Thats the first thing i tried
Quote Originally Posted by ~V~ View Post
Thanks didn't even look at xml's




Thats the first thing i tried
It does work that way. Just convert your hex value of the skin to a decimal. Then set that decimal in the skins tab in your database. Worked for me.

Edit: I made it work for an Item. Where you use and item and it sets a skin to you.

Quote Originally Posted by sacredmike View Post
It does work that way. Just convert your hex value of the skin to a decimal. Then set that decimal in the skins tab in your database. Worked for me.

Edit: I made it work for an Item. Where you use and item and it sets a skin to you.

Pretty sweet, eh?

Do you mind telling others how to make it into a useable item here to keep the questions down? I would do it but I'm in lazy mode right now.
Quote Originally Posted by Snuffleupagus View Post
Pretty sweet, eh?

Do you mind telling others how to make it into a useable item here to keep the questions down? I would do it but I'm in lazy mode right now.
It's pretty buggy. The PlayerClassType doesn't seem to be working the way it should. Right now the skin can do any class.

But the thing is. I'm using MMOE's source. Not the as3 source.
Posts 1–15 of 66 · Page 1 of 5

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?