mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat(client): Expanded Inventory, more and smaller items a row
Strawberry Jam's setting, under Settings: the clothes picker and the item, den and gift pickers show 3, 4 or 5 items a row instead of the game's three, each scaled so a row is as wide as before. A + and - at the avatar editor's item counter step between them. User vars 9009 (on) and 9010 (a row; unset is 5). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9985ae7625
commit
3930d2dabe
6 files changed
+207
-6
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.AvatarWorldView;
|
||||
import buddy.Buddy;
|
||||
@@ -1837,6 +1838,8 @@ package
|
||||
// profile changes only optional rendering work, never the
|
||||
// game's native 24 FPS (which would slow its animations).
|
||||
// 9008 Play as your pet (gui.PetInventory, lib/pets.js): 1 on.
|
||||
// 9009 Expanded Inventory (expandedInventoryOn): 1 on.
|
||||
// 9010 Items a row with it on: 3, 4 or 5; unset is 5.
|
||||
|
||||
|
||||
private static var _smoothTimer:Timer;
|
||||
@@ -2068,6 +2071,33 @@ package
|
||||
{
|
||||
return gMainFrame.userInfo.userVarCache.getUserVarValueById(9002) == 1;
|
||||
}
|
||||
|
||||
// "Expanded Inventory" (Strawberry Jam's): the clothes and item
|
||||
// pickers show more, smaller items a row. user var 9009, 1 on; the
|
||||
// + and - by the avatar editor's item counter pick 3, 4 or 5 a row,
|
||||
// user var 9010 (unset is 5, the widest, so turning it on shows).
|
||||
public static function expandedInventoryOn() : Boolean
|
||||
{
|
||||
return settingOf(9009) == 1;
|
||||
}
|
||||
|
||||
public static function inventoryColumns() : int
|
||||
{
|
||||
var _loc1_:int = settingOf(9010);
|
||||
if(!expandedInventoryOn())
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return _loc1_ >= 3 && _loc1_ <= 5 ? _loc1_ : 5;
|
||||
}
|
||||
|
||||
// the next of 3, 4 and 5 a row, round about; param1 is 1 or -1.
|
||||
public static function stepInventoryColumns(param1:int) : void
|
||||
{
|
||||
var _loc2_:int = (inventoryColumns() - 3 + param1 + 3) % 3 + 3;
|
||||
gMainFrame.userInfo.userVarCache.updateUserVar(9010,_loc2_);
|
||||
AchievementXtCommManager.requestSetUserVar(9010,_loc2_);
|
||||
}
|
||||
|
||||
// the arrow key a key stands for: itself, or with the setting on and
|
||||
// nothing being typed, the arrow W, A, S or D stands for.
|
||||
|
||||
+113
-3
@@ -38,6 +38,8 @@ package gui
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import flash.geom.Point;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import gui.itemWindows.ItemWindowNameBarIcon;
|
||||
import gui.itemWindows.ItemWindowOriginal;
|
||||
import inventory.Iitem;
|
||||
@@ -242,6 +244,10 @@ package gui
|
||||
private var _itemClothingWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _itemTradeWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _inventoryPlusBtn:Sprite;
|
||||
|
||||
private var _inventoryMinusBtn:Sprite;
|
||||
|
||||
public var numClothingItemsInTradeListInitially:int;
|
||||
|
||||
@@ -549,6 +555,7 @@ package gui
|
||||
{
|
||||
createItemWindows(_currClothesArray,avEditor.itemBlock);
|
||||
}
|
||||
setupInventoryControls();
|
||||
addListeners();
|
||||
KeepAlive.startKATimer(avEditor);
|
||||
_loadingMediaHelper.destroy();
|
||||
@@ -1920,6 +1927,7 @@ package gui
|
||||
var _loc7_:Boolean = false;
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Object = null;
|
||||
var _loc9_:int = 0;
|
||||
_loc6_ = param1 == _currTradesArray;
|
||||
if(_loc6_)
|
||||
{
|
||||
@@ -1979,7 +1987,9 @@ package gui
|
||||
}
|
||||
_loc5_ = generateItemAndIndexArray(param1);
|
||||
_loc8_ = new WindowAndScrollbarGenerator();
|
||||
_loc8_.init(param2.width,param2.height,3,_loc4_,3,4,12,2,2,2 * 0.5,0,ItemWindowOriginal,_loc5_.items,"icon",0,{
|
||||
// Expanded Inventory: more, smaller items a row (AJClient.inventoryColumns)
|
||||
_loc9_ = AJClient.inventoryColumns();
|
||||
_loc8_.init(param2.width,param2.height,3,_loc4_,_loc9_,4,_loc9_ * 4,2,2,2 * 0.5,0,ItemWindowOriginal,_loc5_.items,"icon",0,{
|
||||
"mouseDown":winMouseClick,
|
||||
"mouseOver":winMouseOver,
|
||||
"mouseOut":winMouseOut,
|
||||
@@ -1990,7 +2000,8 @@ package gui
|
||||
"showAddRemoveBtns":_loc6_,
|
||||
"isChoosingForTradeList":_loc7_,
|
||||
"indexArray":_loc5_.indexes,
|
||||
"mannequinInvIdx":(_mannequinDenItemHelper != null ? _mannequinDenItemHelper.mannequin.invIdx : -1)
|
||||
"mannequinInvIdx":(_mannequinDenItemHelper != null ? _mannequinDenItemHelper.mannequin.invIdx : -1),
|
||||
"itemScale":3 / _loc9_
|
||||
});
|
||||
if(param2 == avEditor.itemBlock)
|
||||
{
|
||||
@@ -2656,7 +2667,106 @@ package gui
|
||||
avEditor.sortPopup.visible = false;
|
||||
createItemWindows(_currClothesArray,avEditor.itemBlock);
|
||||
}
|
||||
|
||||
|
||||
// Expanded Inventory's + and - (Strawberry Jam's), by the item counter:
|
||||
// 3, 4 or 5 items a row (AJClient.inventoryColumns). they are put in
|
||||
// the counter, where Strawberry Jam puts them by it, so they are shown
|
||||
// and hidden with it.
|
||||
private function setupInventoryControls() : void
|
||||
{
|
||||
var _loc1_:MovieClip = null;
|
||||
var _loc2_:Point = null;
|
||||
if(_inventoryPlusBtn && _inventoryPlusBtn.parent)
|
||||
{
|
||||
_inventoryPlusBtn.parent.removeChild(_inventoryPlusBtn);
|
||||
}
|
||||
if(_inventoryMinusBtn && _inventoryMinusBtn.parent)
|
||||
{
|
||||
_inventoryMinusBtn.parent.removeChild(_inventoryMinusBtn);
|
||||
}
|
||||
_inventoryPlusBtn = null;
|
||||
_inventoryMinusBtn = null;
|
||||
if(!AJClient.expandedInventoryOn() || !avEditor || !("itemCounter" in avEditor) || !avEditor.itemCounter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_loc1_ = avEditor.itemCounter;
|
||||
_loc2_ = _loc1_.globalToLocal(avEditor.localToGlobal(new Point(_loc1_.x + _loc1_.counterTxt.width - 30,_loc1_.y - 7)));
|
||||
_inventoryPlusBtn = createSmallButton("+");
|
||||
_inventoryMinusBtn = createSmallButton("-");
|
||||
_inventoryPlusBtn.x = _loc2_.x;
|
||||
_inventoryPlusBtn.y = _loc2_.y;
|
||||
_inventoryMinusBtn.x = _loc2_.x + 18;
|
||||
_inventoryMinusBtn.y = _loc2_.y;
|
||||
_inventoryPlusBtn.addEventListener("mouseDown",onInventoryPlus,false,0,true);
|
||||
_inventoryMinusBtn.addEventListener("mouseDown",onInventoryMinus,false,0,true);
|
||||
_loc1_.addChild(_inventoryPlusBtn);
|
||||
_loc1_.addChild(_inventoryMinusBtn);
|
||||
}
|
||||
|
||||
private function createSmallButton(param1:String) : Sprite
|
||||
{
|
||||
var _loc2_:Sprite = new Sprite();
|
||||
var _loc3_:TextField = new TextField();
|
||||
_loc2_.graphics.beginFill(3355443,0.8);
|
||||
_loc2_.graphics.drawRoundRect(0,0,16,16,3,3);
|
||||
_loc2_.graphics.endFill();
|
||||
_loc2_.graphics.lineStyle(1,16777215,0.5);
|
||||
_loc2_.graphics.drawRoundRect(0,0,16,16,3,3);
|
||||
_loc3_.defaultTextFormat = new TextFormat("_sans",12,16777215,true);
|
||||
_loc3_.text = param1;
|
||||
_loc3_.x = 4;
|
||||
_loc3_.y = 1;
|
||||
_loc3_.width = 12;
|
||||
_loc3_.height = 16;
|
||||
_loc3_.selectable = false;
|
||||
_loc3_.mouseEnabled = false;
|
||||
_loc2_.addChild(_loc3_);
|
||||
_loc2_.buttonMode = true;
|
||||
_loc2_.mouseChildren = false;
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function onInventoryPlus(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
stepInventoryColumns(1);
|
||||
}
|
||||
|
||||
private function onInventoryMinus(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
stepInventoryColumns(-1);
|
||||
}
|
||||
|
||||
private function stepInventoryColumns(param1:int) : void
|
||||
{
|
||||
AJClient.stepInventoryColumns(param1);
|
||||
refreshInventoryLayout();
|
||||
}
|
||||
|
||||
// the clothes drawn again as many a row as now asked for, and the + and
|
||||
// - put up or taken away (also when Settings turns the switch). only
|
||||
// while the clothes are shown (the counter is, then): the trade list's
|
||||
// windows take the new count when they are next made.
|
||||
public function refreshInventoryLayout() : void
|
||||
{
|
||||
if(!avEditor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(_itemClothingWindows && "itemCounter" in avEditor && avEditor.itemCounter && avEditor.itemCounter.visible)
|
||||
{
|
||||
_itemClothingWindows.destroy();
|
||||
_itemClothingWindows = null;
|
||||
if(_currClothesArray)
|
||||
{
|
||||
createItemWindows(_currClothesArray,avEditor.itemBlock);
|
||||
}
|
||||
}
|
||||
setupInventoryControls();
|
||||
}
|
||||
|
||||
private static function sortByName(param1:Object, param2:Object) : int
|
||||
{
|
||||
var _loc3_:String = String(param1.name).toLowerCase();
|
||||
|
||||
@@ -438,6 +438,7 @@ package gui
|
||||
var _loc6_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc17_:int = 0;
|
||||
while(_popup.itemBlock.numChildren > 1)
|
||||
{
|
||||
_popup.itemBlock.removeChildAt(_popup.itemBlock.numChildren - 1);
|
||||
@@ -627,7 +628,9 @@ package gui
|
||||
_itemDenWindows = _currItemWindow;
|
||||
}
|
||||
_popup.searchBar.mouse.searchTxt.text = "";
|
||||
_currItemWindow.init(_popup.itemBlock.width,_popup.itemBlock.height,2,_loc11_,3,4,12,2,2,0,2 * 0.5,ItemWindowOriginal,_loc3_,"icon",0,{
|
||||
// Expanded Inventory: more, smaller items a row (AJClient.inventoryColumns)
|
||||
_loc17_ = AJClient.inventoryColumns();
|
||||
_currItemWindow.init(_popup.itemBlock.width,_popup.itemBlock.height,2,_loc11_,_loc17_,4,_loc17_ * 4,2,2,0,2 * 0.5,ItemWindowOriginal,_loc3_,"icon",0,{
|
||||
"mouseDown":winMouseDown,
|
||||
"mouseOver":winMouseOver,
|
||||
"mouseOut":winMouseOut
|
||||
@@ -635,7 +638,8 @@ package gui
|
||||
"giftItemIdx":_giftItemIdx,
|
||||
"isECard":_type == 1,
|
||||
"isChoosingForTradeList":_type == 0 || _type == 3,
|
||||
"indexArray":_loc5_
|
||||
"indexArray":_loc5_,
|
||||
"itemScale":3 / _loc17_
|
||||
},onListLoaded);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -61,7 +61,11 @@ package gui.itemWindows
|
||||
private var _hasSetState:Boolean;
|
||||
|
||||
private var _isSellShop:Boolean;
|
||||
|
||||
|
||||
// smaller with Expanded Inventory on (AJClient.inventoryColumns): 3
|
||||
// over the items a row, so a row is as wide as the game's three.
|
||||
private var _itemScale:Number = 1;
|
||||
|
||||
public function ItemWindowOriginal(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
var _loc11_:int = 0;
|
||||
@@ -89,6 +93,10 @@ package gui.itemWindows
|
||||
_loc11_ = int(param9.indexArray.length);
|
||||
_loc10_ = int(_loc11_ - 1 >= param4 ? param9.indexArray[param4] : param4);
|
||||
}
|
||||
if(param9.itemScale > 0)
|
||||
{
|
||||
_itemScale = param9.itemScale;
|
||||
}
|
||||
}
|
||||
super("itemWindow",param1,param2,param3,_loc10_,param5,param6,param7,param8,true);
|
||||
}
|
||||
@@ -576,6 +584,19 @@ package gui.itemWindows
|
||||
|
||||
override protected function onWindowLoadCallback() : void
|
||||
{
|
||||
// the generator spaces the windows by their width and height,
|
||||
// which are sizeCont's (ItemWindowBase) and do not shrink with the
|
||||
// window, so sizeCont is made as much smaller.
|
||||
if(_itemScale != 1 && _window)
|
||||
{
|
||||
if(_window.hasOwnProperty("sizeCont") && _window.sizeCont)
|
||||
{
|
||||
_window.sizeCont.width *= _itemScale;
|
||||
_window.sizeCont.height *= _itemScale;
|
||||
}
|
||||
this.scaleX = _itemScale;
|
||||
this.scaleY = _itemScale;
|
||||
}
|
||||
if(_windowLoadedCallback != null)
|
||||
{
|
||||
resetVisibility();
|
||||
|
||||
@@ -188,6 +188,9 @@ package gui.itemWindows
|
||||
case "customArt":
|
||||
showCustomArt();
|
||||
break;
|
||||
case "expandedInventory":
|
||||
showExpandedInventory();
|
||||
break;
|
||||
case "wasd":
|
||||
showWasd();
|
||||
break;
|
||||
@@ -498,6 +501,30 @@ package gui.itemWindows
|
||||
AchievementXtCommManager.requestSetUserVar(9006,param1 ? 0 : 1);
|
||||
showCustomArt();
|
||||
}
|
||||
|
||||
// "Expanded Inventory" (Strawberry Jam's): more, smaller items a row in
|
||||
// the clothes and item pickers, how many by the + and - at the avatar
|
||||
// editor's item counter (AJClient.inventoryColumns). user var 9009.
|
||||
private function showExpandedInventory() : void
|
||||
{
|
||||
var _loc1_:String = AJClient.expandedInventoryOn() ? "Turn off" : "Turn on";
|
||||
_window.goNowBtn.down.txt.text = _loc1_;
|
||||
_window.goNowBtn.mouse.mouse.txt.text = _loc1_;
|
||||
_window.goNowBtn.mouse.up.txt.text = _loc1_;
|
||||
_window.labelTxtCont.labelTxt.text = "Expanded Inventory";
|
||||
}
|
||||
|
||||
private function setExpandedInventory(param1:Boolean) : void
|
||||
{
|
||||
gMainFrame.userInfo.userVarCache.updateUserVar(9009,param1 ? 1 : 0);
|
||||
AchievementXtCommManager.requestSetUserVar(9009,param1 ? 1 : 0);
|
||||
if(GuiManager.avatarEditor)
|
||||
{
|
||||
GuiManager.avatarEditor.refreshInventoryLayout();
|
||||
}
|
||||
showExpandedInventory();
|
||||
}
|
||||
|
||||
|
||||
private function handleMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
@@ -727,6 +754,9 @@ package gui.itemWindows
|
||||
case "customArt":
|
||||
setCustomArt(!AJClient.customArtOn());
|
||||
break;
|
||||
case "expandedInventory":
|
||||
setExpandedInventory(!AJClient.expandedInventoryOn());
|
||||
break;
|
||||
case "wasd":
|
||||
setWasd(!AJClient.wasdOn());
|
||||
break;
|
||||
|
||||
@@ -229,6 +229,12 @@ package gui
|
||||
"type":TOGGLE_TYPE_JOIN,
|
||||
"frame":"customArt",
|
||||
"iconFrame":"redeemCode"
|
||||
},{
|
||||
// more, smaller items a row in the clothes and item pickers
|
||||
// (AJClient.expandedInventoryOn)
|
||||
"type":TOGGLE_TYPE_JOIN,
|
||||
"frame":"expandedInventory",
|
||||
"iconFrame":"redeemCode"
|
||||
},{
|
||||
"type":TOGGLE_TYPE_JOIN,
|
||||
"frame":"redeemCode",
|
||||
|
||||
Reference in new issue
Block a user