Added seek nameplate code. Added bazaar transaction stuff to WorldManager and DB. Added Item Gamedata to InventoryItem class.

This commit is contained in:
Filip Maj
2017-11-11 10:56:15 -05:00
parent b191da416b
commit 3850860440
5 changed files with 512 additions and 47 deletions

View File

@@ -110,6 +110,29 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
public INV_ERROR AddItem(uint itemId, int quantity)
{
return AddItem(itemId, quantity, 1);
}
public INV_ERROR AddItem(InventoryItem itemRef)
{
if (!IsSpaceForAdd(itemRef.itemId, itemRef.quantity, itemRef.quality))
return INV_ERROR.INVENTORY_FULL;
ItemData gItem = Server.GetItemGamedata(itemRef.itemId);
if (gItem == null)
{
Program.Log.Error("Inventory.AddItem: unable to find item %u", itemRef.itemId);
return INV_ERROR.SYSTEM_ERROR;
}
isDirty[endOfListIndex] = true;
list[endOfListIndex++] = itemRef;
DoDatabaseAdd(itemRef);
SendUpdatePackets();
return INV_ERROR.SUCCESS;
}
public INV_ERROR AddItem(uint itemId, int quantity, byte quality)
@@ -154,12 +177,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
//New item that spilled over
while (quantityCount > 0)
{
byte[] tags = new byte[4];
byte[] values = new byte[4];
if (gItem.isExclusive)
tags[1] = 3;
InventoryItem.ItemModifier modifiers = null;
if (gItem.durability != 0)
{
@@ -167,7 +184,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
modifiers.durability = (uint)gItem.durability;
}
InventoryItem addedItem = Database.CreateItem(itemId, Math.Min(quantityCount, gItem.maxStack), tags, values, quality, modifiers);
InventoryItem addedItem = Database.CreateItem(itemId, Math.Min(quantityCount, gItem.maxStack), quality, modifiers);
addedItem.slot = (ushort)endOfListIndex;
isDirty[endOfListIndex] = true;
list[endOfListIndex++] = addedItem;
@@ -244,6 +261,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
DoRealign();
SendUpdatePackets();
}
public void RemoveItem(InventoryItem item)
{
RemoveItemByUniqueId(item.uniqueId);
}
public void RemoveItemByUniqueId(ulong itemDBId)
@@ -641,7 +663,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
endOfListIndex = lastNullSlot;
}
#endregion
#endregion
public int GetCount()
{
return endOfListIndex;
}
}
}