Some of this is probably irrelevant to backpacks or it might be missing something still. It's impossible for me to do any further testing until the server side is working correctly first.
Once the server side of things are working I can test this further and fix it if need be.
Right now the character state is not saving when a backpack is used. Once you move to a new map the backpack tab will vanish.
You'll need the Stats Tab mod installed first before adding any of this.
Step 1
Insert this Backpack XML into both the client and server somewhere. Make sure the backpack image is also embedded in the correct sprite sheet.
Code:
<Object type="0x1962" id="Backpack">
<Class>Equipment</Class>
<Item />
<Texture>
<File>lofiObj3</File>
<Index>0x315</Index>
</Texture>
<SlotType>10</SlotType>
<Description>A backpack that will double your inventory space.</Description>
<Sound>spell/light_heal</Sound>
<Activate>Backpack</Activate>
<Consumable />
<Backpack />
<BagType>2</BagType>
<Soulbound />
</Object>
Step 2
Navigate to
src\com\company\assembleegameclient\net\messages\d ata\StatData.as
Find this:
Code:
public static const _5J_:int = 64;
public static const _bk:int = 65;
public static const SKIN_STAT:int = 66;
Add this after :
Code:
public static const BACKPACK_0_STAT:int = 67;
public static const BACKPACK_1_STAT:int = 68;
public static const BACKPACK_2_STAT:int = 69;
public static const BACKPACK_3_STAT:int = 70;
public static const BACKPACK_4_STAT:int = 71;
public static const BACKPACK_5_STAT:int = 72;
public static const BACKPACK_6_STAT:int = 73;
public static const BACKPACK_7_STAT:int = 74;
Find this:
Code:
public function _I_3():Boolean{
switch (this._0F_4)
{
case _hK_:
case _07q:
return (true);
};
return (false);
}
Change to this:
Code:
public function _I_3():Boolean{
switch (this._0F_4)
{
case _hK_:
case _07q:
case BACKPACK_0_STAT:
case BACKPACK_1_STAT:
case BACKPACK_2_STAT:
case BACKPACK_3_STAT:
case BACKPACK_4_STAT:
case BACKPACK_5_STAT:
case BACKPACK_6_STAT:
case BACKPACK_7_STAT:
return (true);
};
return (false);
}
Step 3
Navigate to
src\com\company\assembleegameclient\objects\GameOb ject.as
Find this and add the line in bold:
Code:
public var _81:int = -1;
public var _ai:int = 0;
public var _9A_:Vector.<int> = null;
public var equipData_:Vector.<int> = null;
public var backpack_:Vector.<Object> = null;
public var _9B_:uint = 0;
protected var tex1Id_:int = 0;
protected var tex2Id_:int = 0;
Find this and add the lines in bold:
Code:
if (_arg1.hasOwnProperty("SlotTypes"))
{
this._9A_ = ConversionUtil._04n(_arg1.SlotTypes);
this.equipData_ = new Vector.<int>(this._9A_.length);
this.backpack_ = new Vector.<Object>(this._9A_.length);
_local4 = 0;
while (_local4 < this.equipData_.length)
{
this.equipData_[_local4] = -1;
this.backpack_[_local4] = -1;
_local4++;
};
};
Step 4
Navigate to
src\com\company\assembleegameclient\ui\Inventory.a s
Find this and add the line in bold:
Code:
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;
public var backpack_:Boolean;
protected var fill_:GraphicsSolidFill;
protected var path_:GraphicsPath;
private var graphicsData_:Vector.<IGraphicsData>;
Replace this function:
Code:
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++;
};
}
With this:
Code:
public function Inventory(_arg1:GameSprite, _arg2:GameObject, _arg3:String, _arg4:Vector.<int>, _arg5:int, _arg6:Boolean, _offset:int=0, _equipment:Boolean=false, _backpack: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;
this.backpack_ = _backpack;
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++;
};
}
Step 5
Navigate to
src\com\company\assembleegameclient\ui\_E_6.as
Replace this function:
Code:
public function attemptUse():void{
var tmp:_T_W_;
var _local1:XML = ObjectLibrary._Q_F_[this.objectType_];
if (_local1 == null)
{
return;
};
var _local2:Player = this._e9.gs_.map_.player_;
if ((((_local2 == null)) || (_local2.isPaused())))
{
return;
};
var _local3:Boolean = _local1.hasOwnProperty("Consumable");
var _local4:Boolean = _local1.hasOwnProperty("InvUse");
if (((!(_local3)) && (!(_local4))))
{
return;
};
if (_local3)
{
if (this._04q)
{
return;
};
this._04q = true;
};
this._e9.gs_.gsc_.useItem(getTimer(), this._e9._iA_.objectId_, thi*****_, this.objectType_, 0, 0);
_5T_.play("use_potion");
this._X_6();
}
With this:
Code:
public function attemptUse():void{
var tmp:_T_W_;
var _local1:XML = ObjectLibrary._Q_F_[this.objectType_];
if (_local1 == null)
{
return;
};
var _local2:Player = this._e9.gs_.map_.player_;
if ((((_local2 == null)) || (_local2.isPaused())))
{
return;
};
trace(_local1.@id);
if (_local1.@id == "Backpack")
{
tmp = _T_W_(this._e9.parent.parent.parent);
tmp.addBackpackTab();
}
var _local3:Boolean = _local1.hasOwnProperty("Consumable");
var _local4:Boolean = _local1.hasOwnProperty("InvUse");
if (((!(_local3)) && (!(_local4))))
{
return;
};
if (_local3)
{
if (this._04q)
{
return;
};
this._04q = true;
};
this._e9.gs_.gsc_.useItem(getTimer(), this._e9._iA_.objectId_, thi*****_, this.objectType_, 0, 0);
_5T_.play("use_potion");
this._X_6();
}
Step 6
Navigate to
src\com\company\assembleegameclient\ui\_T_W_.as
Replace the entire thing with this (I made several changes here so easier for me to paste the entire thing):
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 stats:Stats;
private var backpackTab_:TabButton;
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.backpackTab_ = new TabButton(AssetLibrary._xK_("lofiInterfaceBig", 34), false, 2);
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);
this.stats = new Stats(191, 45);
this.stats.x = 6;
this.stats.y = 7;
this.statTab_.holder_.addChild(this.stats);
this.pack_ = new Inventory(_arg1, _arg2, "InventoryBackpack", _arg2._9A_.slice(4), 8, true, 4);
mouseEnabled = false;
this.setChildIndex(this.invTab_, (this.numChildren - 1));
this.draw();
}
public function addBackpackTab():void
{
trace("I should be called by the health potion");
this.backpackTab_.addEventListener(MouseEvent.CLICK, this.onTabClick);
this.backpackTab_.x = 63;
this.backpackTab_.y = 152;
addChild(this.backpackTab_);
this.tabList_[2] = this.backpackTab_;
this.pack_.x = 7;
this.pack_.y = 7;
this.backpackTab_.holder_.addChild(this.pack_);
this.setChildIndex(this.backpackTab_, 0);
}
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.stats.draw(this.go_);
this.equips_.draw(this.go_.equipData_.slice(0, 4));
this._e9.draw(this.go_.equipData_.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
Navigate to
src\com\company\assembleegameclient\net\_1f.as
Look for this:
Code:
case StatData.INVENTORY_0_STAT:
case StatData.INVENTORY_1_STAT:
case StatData.INVENTORY_2_STAT:
case StatData.INVENTORY_3_STAT:
case StatData.INVENTORY_4_STAT:
case StatData.INVENTORY_5_STAT:
case StatData.INVENTORY_6_STAT:
case StatData.INVENTORY_7_STAT:
case StatData.INVENTORY_8_STAT:
case StatData.INVENTORY_9_STAT:
case StatData.INVENTORY_10_STAT:
case StatData.INVENTORY_11_STAT:
_arg1.equipData_[(_local4._0F_4 - StatData.INVENTORY_0_STAT)] = _local4._h;
break;
Add this directly underneath:
Code:
case StatData.BACKPACK_0_STAT:
case StatData.BACKPACK_1_STAT:
case StatData.BACKPACK_2_STAT:
case StatData.BACKPACK_3_STAT:
case StatData.BACKPACK_4_STAT:
case StatData.BACKPACK_5_STAT:
case StatData.BACKPACK_6_STAT:
case StatData.BACKPACK_7_STAT:
_arg1.backpack_[(_local4._0F_4 - StatData.BACKPACK_0_STAT)] = _local4._h;
break;
p.s snuffleugapus made dis