I noticed the other devs posted there code in the forums. I figured I'd do the same.
The item count is being persisted down to the database. However in memory the count gets zero'd out. Notice here in MailInterface.cs` line 114-116:
Code: Select all
CMail.ItemsReqInfo.Add(itm.CharItem);
Plr.ItmInterface.DeleteItem(itmslot, itm.CharItem.Counts, false);
itm.Owner = null;
DeleteItem has a third parameter which indicates if it should actually delete or not. However the second parameter seems to be the quantity that are deleted. In this case the quantity should be zero since none are actually being deleted. However the existing logic would only null the slot in inventory when the count was set to zero.
The below fixes will address this by allowing the count to be persisted in memory as well.
MailInterface.cs
Code: Select all
CMail.ItemsReqInfo.Add(itm.CharItem);
Plr.ItmInterface.DeleteItem(itmslot, 0, false);
itm.Owner = null;
ItemsInterface.cs
Code: Select all
public void DeleteItem(UInt16 SlotId,UInt16 Count,bool Delete)
{
//Log.Success("DeleteItem", "SlotId=" + SlotId);
Item IFrom = GetItemInSlot(SlotId);
if (IFrom != null)
{
if (Count == 0) // Remove from inventory but retain count (added to persist count when sending stacks)
{
Items[SlotId] = null;
if (Delete)
IFrom.Delete();
Count = IFrom.Count;
}
else
{
IFrom.Count -= Count;
if (IFrom.Count <= 0)
{
Items[SlotId] = null;
if (Delete)
IFrom.Delete();
}
}
if (_Owner.IsPlayer())
{
SendItems(_Owner.GetPlayer(), SlotId);
_Owner.GetPlayer().QtsInterface.HandleEvent(Objective_Type.QUEST_GET_ITEM, IFrom.Info.Entry, Count, false);
}
if (IsEquipedSlot(SlotId))
SendEquiped(null, SlotId);
}
}