Author Topic: Store capacity  (Read 259 times)

Denes

  • Traveller
  • *
  • Posts: 32
    • View Profile
Store capacity
« on: February 09, 2013, 07:03:03 pm »
   Are you a merchant or perhaps a collector or precious items? Are you living in constant fear of the storekeeper telling you can’t access items because you have overrun your space?
   If you are one fear no more. Kra brings you the designs of a “Tal scale”. This unique device that was named after the famous weapon and armor merchant, can tell you what percent of the storage you are currently using in each category.
Usual “open mechanics” terms apply. Especially the no guarantee and the reusability part.


Be aware! If devs change price / name / code whatever you can end up above 100%. Also remember not to use store for junks, since it slows down data access for everyone not just you.

In the hope, others will find it useful.

Code: [Select]
--- D:/development/ps_prist_20130208/data/gui/storage.xml Fri Feb 08 08:33:45 2013
+++ C:/development/PlaneShift/data/gui/storage.xml Sun Feb 10 00:04:24 2013
@@ -31,6 +31,11 @@
             <text string="SINGLE" horizAdjust="CENTRE" />
     </widget>
 
+    <widget name="Tal_scale" factory="pawsButton" id="160" tooltip="Tal scale">
+        <frame x="560" y="308" width="48" height="48" border="no" />
+        <bgimage resource="ButtonCombine" />
+    </widget>
+
     <widget name="View" factory="pawsButton" id="150" tooltip="View item">
         <frame x="560" y="338" width="48" height="48" border="no" />
         <bgimage resource="view" alpha="0" />


--- D:/development/ps_prist_20130208/src/client/gui/pawsstoragewindow.h Fri Feb 08 08:32:32 2013
+++ C:/development/PlaneShift/src/client/gui/pawsstoragewindow.h Sun Feb 10 00:09:28 2013
@@ -74,6 +74,7 @@
     int merchantID;
     int tradeCommand;
     int selectedItem;   /// index of item, selected in the itemsBox
+ size_t dataSize; ///Last handled ITEMS message size
 
     pawsListBox* categoryBox;
     pawsListBox* itemsBox;


--- D:/development/ps_prist_20130208/src/client/gui/pawsstoragewindow.cpp Fri Feb 08 08:32:32 2013
+++ C:/development/PlaneShift/src/client/gui/pawsstoragewindow.cpp Sun Feb 10 00:16:10 2013
@@ -31,6 +31,7 @@
 /////////////////////////////////////////////////////////////////////////////
 //  CLIENT INCLUDES
 /////////////////////////////////////////////////////////////////////////////
+#include "gui/chatwindow.h"
 
 /////////////////////////////////////////////////////////////////////////////
 //  PAWS INCLUDES
@@ -53,6 +54,7 @@
 #define EXCHANGE_ALL          110
 #define EXCHANGE_SINGLE       120
 #define VIEW_ITEM             150
+#define TAL_SCALE             160
 #define WITHDRAW_RADIO_BUTTON 1000
 #define STORE_RADIO_BUTTON    2000
 /////////////////////////////////////////////////////////////////////////////
@@ -133,6 +135,7 @@
 
         case psGUIStorageMessage::ITEMS:
         {
+ dataSize=sizeof(uint8_t) +incoming.commandData.Length()+1;
             HandleItems( incoming.commandData );
             Show();
             return;
@@ -403,6 +406,7 @@
             psGUIStorageMessage outgoing(psGUIStorageMessage::CATEGORY, commandData);
             outgoing.SendMessage();
         }
+ dataSize=0; //Last incoming ITEMS data size reset. To prevent working before server could respond
     }
     else if ( widget->GetID()==ITEM_LIST  &&  status==LISTBOX_SELECTED )
     {
@@ -482,6 +486,22 @@
             }
             return true;
         }
+ case TAL_SCALE:
+ {
+ pawsChatWindow* chat = static_cast<pawsChatWindow*>(PawsManager::GetSingleton().FindWidget("ChatWindow"));
+ pawsRadioButtonGroup* group = (pawsRadioButtonGroup*)FindWidget("WithdrawStore");
+ if (group->GetActiveID()==WITHDRAW_RADIO_BUTTON && categoryBox->GetSelectedRow()!=NULL && dataSize>0) //We have a healthy selection
+ {
+ csString css;
+ css.Format( "You are using %.1f%% of your storage in %s category.", (float)dataSize*100/MAX_MESSAGE_SIZE,categoryBox->GetSelectedText(0));
+ chat->ChatOutput(css);
+ }
+ else
+ {
+ chat->ChatOutput("You have to select a category of stored items for the scale to work.");
+ }
+ return true;
+ }
     }
 
     return false;
« Last Edit: February 10, 2013, 03:48:34 am by Denes »