Initial fixes for ContainerSetSlotPacket and CraftItemPacket (#649)
This commit is contained in:
@@ -343,6 +343,18 @@ bool Inventory::hasResource(int type)
|
||||
return true;
|
||||
}
|
||||
|
||||
int Inventory::countResource(int type, int auxVal)
|
||||
{
|
||||
int count = 0;
|
||||
for (unsigned int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (items[i] != NULL && items[i]->id == type &&
|
||||
(auxVal == -1 || items[i]->getAuxValue() == auxVal))
|
||||
count += items[i]->count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void Inventory::swapSlots(int from, int to)
|
||||
{
|
||||
shared_ptr<ItemInstance> tmp = items[to];
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
shared_ptr<ItemInstance> getResourceItem(int type,int iAuxVal);
|
||||
|
||||
bool hasResource(int type);
|
||||
int countResource(int type, int auxVal);
|
||||
void swapSlots(int from, int to);
|
||||
bool add(shared_ptr<ItemInstance> item);
|
||||
shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
|
||||
|
||||
Reference in New Issue
Block a user