I found the following issue in the WarBugs issue tracker.
https://github.com/WarEmu/WarBugs/issues/541
It described a bug in which people cannot send stacks of items to each other via mail. I posted a fix in the comments of that issue.
What is the process for getting it tested/reviewed by others?
I'd like to move on to another bug, I just want to make sure i'm following the proper process.
Cheers!
--
Andrew K
[Possible Fix] - Sending Stacked Items
Forum rules
Before posting on this forum, be sure to read the Terms of Use
Before posting on this forum, be sure to read the Terms of Use
[Possible Fix] - Sending Stacked Items
--
Andrew K | Software Developer & WAR Fan
Andrew K | Software Developer & WAR Fan
Ads
Re: [Possible Fix] - Sending Stacked Items
Good job m8, im sure that some of the devs will contact you
Re: [Possible Fix] - Sending Stacked Items
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:
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
ItemsInterface.cs
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;
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);
}
}
--
Andrew K | Software Developer & WAR Fan
Andrew K | Software Developer & WAR Fan
Re: [Possible Fix] - Sending Stacked Items
you should contact max & comp on war emu irc chat:
http://www.war-emu.com/index.php?sid=17 ... 9c141b1b7b
http://www.war-emu.com/index.php?sid=17 ... 9c141b1b7b
Who is online
Users browsing this forum: No registered users and 54 guests