Renamed Type7Param to ItemRefParam. Changed a lot of "inventoryType" names to "itemPackage". Moved inventory code to Character class for easier use and auto-choosing the correct package.

This commit is contained in:
Filip Maj
2017-11-11 13:46:12 -05:00
parent 3850860440
commit bbac4b0fce
6 changed files with 227 additions and 77 deletions

View File

@@ -126,6 +126,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
return INV_ERROR.SYSTEM_ERROR;
}
itemRef.RefreshPositioning(inventoryCode, (ushort) endOfListIndex);
isDirty[endOfListIndex] = true;
list[endOfListIndex++] = itemRef;
DoDatabaseAdd(itemRef);
@@ -265,10 +267,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
public void RemoveItem(InventoryItem item)
{
RemoveItemByUniqueId(item.uniqueId);
}
public void RemoveItemByUniqueId(ulong itemDBId)
RemoveItemByUniqueId(item.uniqueId, 1);
}
public void RemoveItem(InventoryItem item, int quantity)
{
RemoveItemByUniqueId(item.uniqueId, quantity);
}
public void RemoveItemByUniqueId(ulong itemDBId, int quantity)
{
ushort slot = 0;
InventoryItem toDelete = null;
@@ -288,10 +295,18 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
if (toDelete == null)
return;
if (quantity >= toDelete.quantity)
{
DoDatabaseRemove(toDelete.uniqueId);
list[slot] = null;
}
else
{
list[slot].quantity -= quantity;
//DoDatabaseUpdateQuantity(toDelete.uniqueId);
}
DoDatabaseRemove(toDelete.uniqueId);
list[slot] = null;
isDirty[slot] = true;
DoRealign();