mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added errors to AddItem so a script writer knows if the inventory was full or not.
This commit is contained in:
parent
06e0c32062
commit
e581727625
@ -23,6 +23,13 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
public const ushort EQUIPMENT = 0x00FE; //Max 0x23
|
public const ushort EQUIPMENT = 0x00FE; //Max 0x23
|
||||||
public const ushort EQUIPMENT_OTHERPLAYER = 0x00F9; //Max 0x23
|
public const ushort EQUIPMENT_OTHERPLAYER = 0x00F9; //Max 0x23
|
||||||
|
|
||||||
|
public enum INV_ERROR {
|
||||||
|
SUCCESS = 0,
|
||||||
|
INVENTORY_FULL,
|
||||||
|
ALREADY_HAS_UNIQUE,
|
||||||
|
SYSTEM_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
private Character owner;
|
private Character owner;
|
||||||
private ushort inventoryCapacity;
|
private ushort inventoryCapacity;
|
||||||
private ushort inventoryCode;
|
private ushort inventoryCode;
|
||||||
@ -87,7 +94,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddItem(uint itemId)
|
public INV_ERROR AddItem(uint itemId)
|
||||||
{
|
{
|
||||||
return AddItem(itemId, 1, 1);
|
return AddItem(itemId, 1, 1);
|
||||||
}
|
}
|
||||||
@ -98,22 +105,22 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
AddItem(itemId[i]);
|
AddItem(itemId[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddItem(uint itemId, int quantity)
|
public INV_ERROR AddItem(uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
return AddItem(itemId, quantity, 1);
|
return AddItem(itemId, quantity, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddItem(uint itemId, int quantity, byte quality)
|
public INV_ERROR AddItem(uint itemId, int quantity, byte quality)
|
||||||
{
|
{
|
||||||
if (!IsSpaceForAdd(itemId, quantity, quality))
|
if (!IsSpaceForAdd(itemId, quantity, quality))
|
||||||
return false;
|
return INV_ERROR.INVENTORY_FULL;
|
||||||
|
|
||||||
ItemData gItem = Server.GetItemGamedata(itemId);
|
ItemData gItem = Server.GetItemGamedata(itemId);
|
||||||
|
|
||||||
if (gItem == null)
|
if (gItem == null)
|
||||||
{
|
{
|
||||||
Program.Log.Error("Inventory.AddItem: unable to find item %u", itemId);
|
Program.Log.Error("Inventory.AddItem: unable to find item %u", itemId);
|
||||||
return false;
|
return INV_ERROR.SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if item id exists
|
//Check if item id exists
|
||||||
@ -139,12 +146,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If it's unique, abort
|
//If it's unique, abort
|
||||||
//if (quantityCount > 0 && storedItem.isUnique)
|
if (quantityCount > 0 && gItem.isExclusive)
|
||||||
// return ITEMERROR_UNIQUE;
|
return INV_ERROR.ALREADY_HAS_UNIQUE;
|
||||||
|
|
||||||
//If Inventory is full
|
|
||||||
//if (quantityCount > 0 && isInventoryFull())
|
|
||||||
// return ITEMERROR_FULL;
|
|
||||||
|
|
||||||
//New item that spilled over
|
//New item that spilled over
|
||||||
while (quantityCount > 0)
|
while (quantityCount > 0)
|
||||||
@ -160,7 +163,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
SendUpdatePackets();
|
SendUpdatePackets();
|
||||||
|
|
||||||
return true;
|
return INV_ERROR.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveItem(uint itemId)
|
public void RemoveItem(uint itemId)
|
||||||
|
Loading…
Reference in New Issue
Block a user