Step 1
We need to create two new files.
Right-click the
com/company/assembleegameclient/ui folder. Select
New->ActionScript Class , and give it the name "
TabButton", then click create.
Step 2
Repeat Step 1 but this time name the file "
TabBackground".
Step 3
Replace the entire contents of the "
TabButton.as" script with this:
Code:
package com.company.assembleegameclient.ui
{
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.GraphicsSolidFill;
import flash.display.GraphicsPath;
import flash.display.Bitmap;
import flash.display.IGraphicsData;
import com.company.assembleegameclient.util.TextureRedrawer;
import com.company.util.GraphicHelper;
public class TabButton extends Sprite
{
protected static const WIDTH:int = 28;
protected static const HEIGHT:int = 24;
public var iconRaw_:BitmapData;
public var icon_:BitmapData;
public var selected_:Boolean = false;
public var tabId_:int = 0;
public var holder_:TabBackground;
protected var fill_:GraphicsSolidFill;
protected var path_:GraphicsPath;
private var bmap_:Bitmap;
private var graphicsData_:Vector.<IGraphicsData>;
public function TabButton(_icon:BitmapData, _selected:Boolean, _tabId:int)
{
this.path_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
super();
this.selected_ = _selected;
this.iconRaw_ = _icon;
this.icon_ = TextureRedrawer.redraw(this.iconRaw_, (320 / this.iconRaw_.width), true, 0, 0);
this.holder_ = new TabBackground(186, 98);
this.holder_.x = (-28 * _tabId);
this.holder_.y = 22;
this.holder_.visible = _selected;
this.addChild(this.holder_);
this.tabId_ = _tabId;
this.draw();
}
public function setSelected(_selected:Boolean):void
{
this.selected_ = _selected;
this.holder_.visible = _selected;
this.draw();
}
public function updateFill(_selected:Boolean):void
{
this.fill_ = new GraphicsSolidFill(((_selected) ? 0x242222 : 0x676666), 1);
this.graphicsData_ = new <IGraphicsData>[this.fill_, this.path_, GraphicHelper.END_FILL];
}
public function draw():void
{
this.updateFill(this.selected_);
GraphicHelper._0L_6(this.path_);
GraphicHelper.drawUI(0, 0, WIDTH, (HEIGHT + 4), 2, [1, 1, 0, 0], this.path_);
this.graphics.clear();
this.graphics.drawGraphicsData(this.graphicsData_);
if (this.bmap_ == null)
{
this.bmap_ = new Bitmap(this.icon_);
this.bmap_.x = -6;
this.bmap_.y = -10;
this.addChild(this.bmap_);
};
this.holder_.draw((this.tabId_ == 0));
}
}
}//package com.company.assembleegameclient.ui
Step 4
Replace the entire contents of the "
TabBackground.as" script with this:
Code:
package com.company.assembleegameclient.ui
{
import flash.display.Sprite;
import flash.display.GraphicsSolidFill;
import flash.display.GraphicsPath;
import flash.display.IGraphicsData;
import com.company.util.GraphicHelper;
public class TabBackground extends Sprite
{
public var width_:int;
public var height_:int;
protected var fill_:GraphicsSolidFill;
protected var path_:GraphicsPath;
private var graphicsData_:Vector.<IGraphicsData>;
public function TabBackground(_width:int, _height:int)
{
this.fill_ = new GraphicsSolidFill(0x242222, 1);
this.path_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
this.graphicsData_ = new <IGraphicsData>[this.fill_, this.path_, GraphicHelper.END_FILL];
super();
this.width_ = _width;
this.height_ = _height;
}
public function draw(_firstTab:Boolean)
{
GraphicHelper._0L_6(this.path_);
GraphicHelper.drawUI(0, 0, this.width_, this.height_, 6, [((_firstTab) ? 0 : 1), 1, 1, 1], this.path_);
this.graphics.clear();
this.graphics.drawGraphicsData(this.graphicsData_);
}
}
}//package com.company.assembleegameclient.ui
Step 5
Open
com/company/assembleegameclient/ui/Inventory.as and replace the entire thing with this. You will see an error at this point, don't worry, we'll get to that!
Code:
package com.company.assembleegameclient.ui
{
import flash.display.Sprite;
import com.company.assembleegameclient.game.GameSprite;
import com.company.assembleegameclient.objects.GameObject;
import flash.display.GraphicsSolidFill;
import flash.display.GraphicsPath;
import flash.display.IGraphicsData;
import com.company.util.GraphicHelper;
public class Inventory extends Sprite
{
private static const _pm:Array = [0, 0, 0, 0];
private static const _ls:Object = {
"1":[[1, 1, 1, 1]],
"2":[[1, 0, 0, 1], [0, 1, 1, 0]],
"3":[[1, 0, 0, 1], _pm, [0, 1, 1, 0]],
"4":[[1, 0, 0, 1], _pm, _pm, [0, 1, 1, 0]],
"5":[[1, 0, 0, 1], _pm, _pm, [0, 1, 1, 0], [0, 0, 1, 1]],
"6":[[1, 0, 0, 1], _pm, _pm, [0, 1, 1, 0], [0, 0, 0, 1], [0, 0, 1, 0]],
"7":[[1, 0, 0, 1], _pm, _pm, [0, 1, 1, 0], [0, 0, 0, 1], _pm, [0, 0, 1, 0]],
"8":[[1, 0, 0, 0], _pm, _pm, [0, 1, 0, 0], [0, 0, 0, 1], _pm, _pm, [0, 0, 1, 0]],
"12":[[1, 0, 0, 1], _pm, _pm, [0, 1, 1, 0], [1, 0, 0, 0], _pm, _pm, [0, 1, 0, 0], [0, 0, 0, 1], _pm, _pm, [0, 0, 1, 0]]
};
public var gs_:GameSprite;
public var _iA_:GameObject;
public var _A_H_:String;
public var invsize_:int;
public var slots_:Vector.<_E_6>;
public var equipment_:Boolean;
protected var fill_:GraphicsSolidFill;
protected var path_:GraphicsPath;
private var graphicsData_:Vector.<IGraphicsData>;
public function Inventory(_arg1:GameSprite, _arg2:GameObject, _arg3:String, _arg4:Vector.<int>, _arg5:int, _arg6:Boolean, _offset:int=0, _equipment:Boolean=false):void
{
var _local8:_E_6;
var _local7:int;
var _local10:int;
this.slots_ = new Vector.<_E_6>();
this.fill_ = new GraphicsSolidFill(0x545454);
this.path_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
this.graphicsData_ = new <IGraphicsData>[this.fill_, this.path_, GraphicHelper.END_FILL];
super();
this.gs_ = _arg1;
this._iA_ = _arg2;
this._A_H_ = _arg3;
this.invsize_ = _arg5;
this.equipment_ = _equipment;
if (((_arg1) && ((_arg2 == this.gs_.map_.player_))))
{
this.gs_.map_.player_.inventory = this;
};
while (_local7 < _arg5)
{
_local10 = (_local7 + _offset);
_local8 = new _E_6(this, _local10, _arg4[_local7], ((_arg6) ? (_local10 - 3) : -1), _ls[_arg4.length][_local7], _equipment);
_local8.x = (int((_local7 % 4)) * (Slot.WIDTH + 4));
_local8.y = (int((_local7 / 4)) * (Slot.HEIGHT + 4));
this.slots_.push(_local8);
addChild(_local8);
_local7++;
};
}
public function draw(_arg1:Vector.<int>):void
{
var _local3:_E_6;
var _local2:int;
if (this.equipment_)
{
GraphicHelper._0L_6(this.path_);
GraphicHelper.drawUI(-3, -3, 178, 46, 6, [1, 1, 1, 1], this.path_);
graphics.clear();
graphics.drawGraphicsData(this.graphicsData_);
};
while (_local2 < this.slots_.length)
{
_local3 = this.slots_[_local2];
_local3.draw(((((!((_arg1 == null))) && ((_local2 < _arg1.length)))) ? _arg1[_local2] : -1));
_local2++;
};
}
public function refresh():void
{
var _local1:_E_6;
for each (_local1 in this.slots_)
{
_local1.refresh();
};
}
public function useItem(_arg1:int):void
{
if ((((_arg1 < 0)) || ((_arg1 >= this.slots_.length))))
{
return;
};
this.slots_[_arg1].attemptUse();
}
public function _mK_():Boolean
{
var _local3:_E_6;
if (!(this.gs_))
{
return (false);
};
if (this.invsize_ < 12)
{
return (false);
};
var _local1:Boolean = true;
var _local2:uint = 4;
while (_local2 < 12)
{
_local3 = this.gs_.map_.player_.inventory.slots_[_local2];
if (_local3._X_B_ == null)
{
_local1 = false;
};
_local2++;
};
return (_local1);
}
}
}//package com.company.assembleegameclient.ui
Step 6
Open
com/company/assembleegameclient/ui/_T_W_.as and replace the entire thing with this. You will see another small error here, don't worry, we'll get to that!
Code:
package com.company.assembleegameclient.ui
{
import flash.display.Sprite;
import com.company.assembleegameclient.game.GameSprite;
import com.company.assembleegameclient.objects.Player;
import flash.display.Bitmap;
import com.company.ui.SimpleText;
import flash.filters.DropShadowFilter;
import com.company.assembleegameclient.parameters.Parameters;
import com.company.util.AssetLibrary;
import flash.events.MouseEvent;
import _0C_P_.Options;
public class _T_W_ extends Sprite
{
public var equips_:Inventory;
public var _e9:Inventory;
public var pack_:Inventory;
public var _0E__:int;
private var gs_:GameSprite;
private var go_:Player;
private var w_:int;
private var h_:int;
private var _tm:Bitmap;
private var nameText_:SimpleText;
private var _L_P_:Sprite;
private var _nw:_rN_ = null;
private var _sI_:_0M_Y_;
private var _U_U_:_0M_Y_;
private var _023:_0M_Y_;
private var _F_C_:_0M_Y_;
private var _086:Stats;
private var invTab_:TabButton;
private var statTab_:TabButton;
private var tabBG_:TabBackground;
private var tabList_:Array;
private var selectedTab_:int = 0;
private var stackPots:Boolean = false;
public function _T_W_(_arg1:GameSprite, _arg2:Player, _arg3:int, _arg4:int)
{
this.gs_ = _arg1;
this.go_ = _arg2;
this.w_ = _arg3;
this.h_ = _arg4;
this._tm = new Bitmap(null);
this._tm.x = -2;
this._tm.y = -10;
addChild(this._tm);
this.nameText_ = new SimpleText(20, 0xB3B3B3, false, 0, 0, "Myriad Pro");
this.nameText_.setBold(true);
this.nameText_.x = 36;
this.nameText_.y = -2;
if (this.gs_.charList_.name_ == null)
{
this.nameText_.text = this.go_.name_;
}
else
{
this.nameText_.text = this.gs_.charList_.name_;
};
this.nameText_.updateMetrics();
this.nameText_.filters = [new DropShadowFilter(0, 0, 0)];
addChild(this.nameText_);
if (this.gs_.gsc_.gameId_ != Parameters.NEXUS_ID)
{
this._nw = new _rN_(AssetLibrary._xK_("lofiInterfaceBig", 6), "Nexus", "escapeToNexus");
this._nw.addEventListener(MouseEvent.CLICK, this._Q_C_);
this._nw.x = 172;
this._nw.y = 2;
addChild(this._nw);
}
else
{
this._nw = new _rN_(AssetLibrary._xK_("lofiInterfaceBig", 5), "Options", "options");
this._nw.addEventListener(MouseEvent.CLICK, this._nD_);
this._nw.x = 172;
this._nw.y = 2;
addChild(this._nw);
};
this._sI_ = new _0M_Y_(176, 16, 5931045, 0x545454, "Lvl X");
this._sI_.x = 12;
this._sI_.y = 30;
addChild(this._sI_);
this._sI_.visible = true;
this._U_U_ = new _0M_Y_(176, 16, 0xE25F00, 0x545454, "Fame");
this._U_U_.x = 12;
this._U_U_.y = 30;
addChild(this._U_U_);
this._U_U_.visible = false;
this._023 = new _0M_Y_(176, 16, 14693428, 0x545454, "HP");
this._023.x = 12;
this._023.y = 54;
addChild(this._023);
this._F_C_ = new _0M_Y_(176, 16, 6325472, 0x545454, "MP");
this._F_C_.x = 12;
this._F_C_.y = 78;
addChild(this._F_C_);
this.equips_ = new Inventory(_arg1, _arg2, "Inventory", _arg2._9A_.slice(0, 4), 4, true, 0, true);
this.equips_.x = 14;
this.equips_.y = 104;
addChild(this.equips_);
this.tabList_ = [];
this.invTab_ = new TabButton(AssetLibrary._xK_("lofiInterfaceBig", 32), true, 0);
this.invTab_.addEventListener(MouseEvent.CLICK, this.onTabClick);
this.invTab_.x = 7;
this.invTab_.y = 152;
addChild(this.invTab_);
this.tabList_[0] = this.invTab_;
this.statTab_ = new TabButton(AssetLibrary._xK_("lofiInterfaceBig", 33), false, 1);
this.statTab_.addEventListener(MouseEvent.CLICK, this.onTabClick);
this.statTab_.x = 35;
this.statTab_.y = 152;
addChild(this.statTab_);
this.tabList_[1] = this.statTab_;
this._086 = new Stats(191, 45);
this._086.x = 6;
this._086.y = 7;
this.statTab_.holder_.addChild(this._086);
this._e9 = new Inventory(_arg1, _arg2, "Inventory", _arg2._9A_.slice(4), 8, true, 4);
this._e9.x = 7;
this._e9.y = 7;
this.invTab_.holder_.addChild(this._e9);
mouseEnabled = false;
this.setChildIndex(this.invTab_, (this.numChildren - 1));
this.draw();
}
public function setName(_arg1:String):void
{
this.nameText_.text = _arg1;
this.nameText_.updateMetrics();
}
public function nextTab():void
{
if ((this.selectedTab_ + 1) == this.tabList_.length)
{
this.switchTab((this.tabList_[0] as TabButton));
}
else
{
this.switchTab((this.tabList_[(this.selectedTab_ + 1)] as TabButton));
};
}
public function switchTab(_tab:TabButton):void
{
var _i:TabButton;
if (_tab.selected_)
{
return;
};
for each (_i in this.tabList_)
{
_i.setSelected(false);
};
_tab.setSelected(true);
this.selectedTab_ = _tab.tabId_;
this.setChildIndex(_tab, (this.numChildren - 1));
}
public function draw():void
{
this._tm.bitmapData = this.go_.getPortrait();
var _local1:String = ("Lvl " + this.go_._81);
if (_local1 != this._sI_.labelText_.text)
{
this._sI_.labelText_.text = _local1;
this._sI_.labelText_.updateMetrics();
};
if (this.go_._81 != 20)
{
if (!(this._sI_.visible))
{
this._sI_.visible = true;
this._U_U_.visible = false;
};
this._sI_.draw(this.go_.exp_, this.go_._7V_, 0);
if (this._0E__ != this.go_._gz)
{
this._0E__ = this.go_._gz;
this._sI_._Y_r(this._0E__, this.go_._gz);
};
}
else
{
if (!(this._U_U_.visible))
{
this._U_U_.visible = true;
this._sI_.visible = false;
};
this._U_U_.draw(this.go_._0L_o, this.go_._n8, 0);
};
this._023.draw(this.go_._aY_, this.go_._L_T_, this.go_._P_7, this.go_._uR_);
this._F_C_.draw(this.go_._86, this.go_._a7, this.go_._0D_G_, this.go_._dt);
this._086.draw(this.go_);
this.equips_.draw(this.go_._zq.slice(0, 4));
this._e9.draw(this.go_._zq.slice(4));
}
public function destroy():void
{
}
private function _Q_C_(_arg1:MouseEvent):void
{
this.gs_.gsc_._M_6();
Parameters.data_.needsRandomRealm = false;
Parameters.save();
}
private function _nD_(_arg1:MouseEvent):void
{
this.gs_.mui_.clearInput();
this.gs_.addChild(new Options(this.gs_));
}
private function onTabClick(me:MouseEvent):void
{
if ((me.target is TabButton))
{
this.switchTab((me.target as TabButton));
};
}
}
}//package com.company.assembleegameclient.ui
Step 7
Open
com/company/assembleegameclient/ui/Slot.as and find this:
Code:
public function Slot(_arg1:int, _arg2:int, _arg3:Array){
this._04c = new GraphicsSolidFill(0x545454, 1);
this.path_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
this.graphicsData_ = new <IGraphicsData>[this._04c, this.path_, GraphicHelper.END_FILL];
super();
this.type_ = _arg1;
this._ws = _arg2;
this._07i = _arg3;
this._rC_();
}
Change to this:
Code:
public function Slot(_arg1:int, _arg2:int, _arg3:Array, _equipment:Boolean=false){
this._04c = new GraphicsSolidFill(((_equipment) ? 0x454545 : 0x545454), 1);
this.path_ = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
this.graphicsData_ = new <IGraphicsData>[this._04c, this.path_, GraphicHelper.END_FILL];
super();
this.type_ = _arg1;
this._ws = _arg2;
this._07i = _arg3;
this._rC_();
}
Step 8
Open
com/company/assembleegameclient/ui/_E_6.as and find this:
Code:
public function _E_6(_arg1:Inventory, _arg2:int, _arg3:int, _arg4:int, _arg5:Array){
super(_arg3, _arg4, _arg5);
this._e9 = _arg1;
thi*****_ = _arg2;
type_ = _arg3;
this._D_s = new Shape();
var _local6:GraphicsSolidFill = new GraphicsSolidFill(6036765, 1);
GraphicHelper._0L_6(path_);
var _local7:Vector.<IGraphicsData> = new <IGraphicsData>[_local6, path_, GraphicHelper.END_FILL];
GraphicHelper.drawUI(0, 0, WIDTH, HEIGHT, 4, _07i, path_);
this._D_s.graphics.drawGraphicsData(_local7);
this._D_s.alpha = 0;
addChild(this._D_s);
this._lD_ = new Timer(_0J_o, 1);
this._lD_.addEventListener(TimerEvent.TIMER_COMPLETE, this._W_);
addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
}
Change to this:
Code:
public function _E_6(_arg1:Inventory, _arg2:int, _arg3:int, _arg4:int, _arg5:Array, _equipment:Boolean=false){
super(_arg3, _arg4, _arg5, _equipment);
this._e9 = _arg1;
thi*****_ = _arg2;
type_ = _arg3;
this._D_s = new Shape();
var _local6:GraphicsSolidFill = new GraphicsSolidFill(6036765, 1);
GraphicHelper._0L_6(path_);
var _local7:Vector.<IGraphicsData> = new <IGraphicsData>[_local6, path_, GraphicHelper.END_FILL];
GraphicHelper.drawUI(0, 0, WIDTH, HEIGHT, 4, _07i, path_);
this._D_s.graphics.drawGraphicsData(_local7);
this._D_s.alpha = 0;
addChild(this._D_s);
this._lD_ = new Timer(_0J_o, 1);
this._lD_.addEventListener(TimerEvent.TIMER_COMPLETE, this._W_);
addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
}
Step 9
Open
com/company/assembleegameclient/ui/_0M_Y_.as and find this:
Code:
public function _Y_r(_arg1:Boolean):void{
if (_arg1)
{
addChild(this._5B_);
this._W_K_(3, 9493531, 0xFFFFFF);
} else
{
if (this._5B_.parent)
{
removeChild(this._5B_);
};
};
}
Replace with this:
Code:
public function _Y_r(_arg1:Boolean, _arg2:int):void
{
if (_arg1)
{
if (this._5B_.text != ("x" + _arg2).toString())
{
this._5B_.text = ("x" + _arg2);
};
addChild(this._5B_);
this._W_K_(3, 9493531, 0xFFFFFF);
}
else
{
if (this._5B_.parent)
{
removeChild(this._5B_);
};
};
}
Step 10
Replace the image file named "
_0L_i.png" located in your main AS3 client source directory with the one attached to this post.
Final Step
Click
File->Save all and recompile. There will be no errors unless you did something wrong.
Congratulations! You now have a Stats Tab!
Cyb0r wit i?
Credits
Me - For figuring this out and putting it all together. For creating the image file, and adjusting some values throughout to make it look almost identical to production.
@
Club559 - For the original implementation. This would not be possible without him.
@
Kithio - For his work on the client.