All pastes #1799256 Raw Edit

clueless

public text v1 · immutable
#1799256 ·published 2010-02-17 00:37 UTC
rendered paste body
Index: src/client/gui/inventorywindow.h===================================================================--- src/client/gui/inventorywindow.h	(revision 5568)+++ src/client/gui/inventorywindow.h	(working copy)@@ -73,8 +73,9 @@      *      *  @param itemName The name of the item in the inventory.      *  @param stackCount The amount to try to equip.  +     *  @param toSlotID The slot you want to equip it to.      */-    void Equip( const char* itemName, int stackCount );+    void Equip( const char* itemName, int stackCount, int toSlotID = -1 );               /** Dequips an item into closest available bulk slot. Index: src/client/gui/inventorywindow.cpp===================================================================--- src/client/gui/inventorywindow.cpp	(revision 5568)+++ src/client/gui/inventorywindow.cpp	(working copy)@@ -343,7 +343,7 @@     } } -void pawsInventoryWindow::Equip( const char* itemName, int stackCount )+void pawsInventoryWindow::Equip( const char* itemName, int stackCount, int toSlotID ) {     pawsListBox * bulkList = dynamic_cast <pawsListBox*> (FindWidget("BulkList"));     if ( (itemName != NULL) && (bulkList) )@@ -364,12 +364,13 @@          if ( fromSlot )         {+            fromSlot->Clear();             int container   = fromSlot->ContainerID();             int slot        = fromSlot->ID();              //psItem* item = charData->GetItemInSlot( slot );             psSlotMovementMsg msg( container, slot,-                               CONTAINER_INVENTORY_EQUIPMENT, -1,+                               CONTAINER_INVENTORY_EQUIPMENT, toSlotID,                                stackCount );             msg.SendMessage();         }Index: src/client/cmdusers.cpp===================================================================--- src/client/cmdusers.cpp	(revision 5568)+++ src/client/cmdusers.cpp	(working copy)@@ -45,6 +45,7 @@ #include "gui/pawscontrolwindow.h" #include "gui/psmainwidget.h" #include "gui/pawsgameboard.h"+#include "gui/pawsslot.h"  #include "paws/pawsmanager.h" #include "paws/pawsyesnobox.h"@@ -313,17 +314,28 @@     else if (words[0] == "/equip" || (words[0] == "/use" && words.GetCount() > 1))     {         if ( words.GetCount() < 2 )-            return "Usage: /equip  [stack count] [item name]";+            return "Usage: /equip  [stack count] [slot] [item name]";++        int tail = 1;         int quantity = atoi(words[1]);-        csString itemName;-        if (quantity == 0)+        if (quantity > 0)+            tail++;+        else+            quantity = 1;+        +        pawsInventoryWindow* window = (pawsInventoryWindow*)PawsManager::GetSingleton().FindWidget("InventoryWindow");++        int slotID = -1;+        pawsSlot* toSlot = dynamic_cast <pawsSlot*>(window->FindWidget(words[tail]));+        if (toSlot)         {-            quantity = 1;-            itemName = words.GetTail(1);+            slotID = toSlot->ID();+            tail++;         }-        else itemName = words.GetTail(2);-        pawsInventoryWindow* window = (pawsInventoryWindow*)PawsManager::GetSingleton().FindWidget("InventoryWindow");-        window->Equip( itemName, quantity );+        +        csString itemName;+        itemName = words.GetTail(tail);+        window->Equip( itemName, quantity, slotID );     }      else if ( words[0] == "/dequip" )