Inventory Reference System
While working on the ResyncInventory method, I found that most of the code was repeating itself. As a result, I decided to find a way of eliminating this redundant code and process the actions in a condensed manner. What came out of this was a new bitmasked inventory reference system.
By passing a pre-defined or bitwised value into the appropriate function, a single list of slots is returned for processing. Incorporating a loop and a shifting-bit bitmask, numerous slot ranges can be processed in about the same amount of code that a single range took before. A modified client deletion method 'should' eliminate the worry of what slots can be deleted from while attempting to avoid crashing the client.
In addition, the research performed during the initial creation of ResyncInventory has led to alternate deletion methods that allow the server to 'properly' delete items from slot ranges that were previously unavailable using standard methods. (There are still a few ranges that cannot be accessed from the server, but, a notification message is sent to the client when a deletion occurs in these slots.)
Here is an overview of what I have in work at the moment. (This is mainly for add-to suggestions.)
INVENTORY REFERENCE SYSTEM:
GetWorkingRangeList - Returns a list of multiple slot ranges (Accepts client version parameter)
GetRangeSlotList - Returns a list of a single slot range (Accepts client version parameter)
GetRangeBySlot - Returns the range of a provided slot
GetParentRange - Checks for and returns the parent range of a provided range
GetChildRange - Checks for and returns the child range of a provided range
GetRangeNameByRanges - Returns a comma-space delimited string of range names (Optional: returns range slot name)
GetRangeNameBySlot - Returns the range name of a provided slot (Optional: returns range slot name)
GetRangeDeleteMethod - Returns the deletion method of a given range (Used in SendDeleteItemPacket below)
GetWhereToRangeConversion - Converts 'invWhere' bitmask to 'invRange'
GetRangeToWhereConversion - Converts 'invRange' bitmask to 'invWhere'
GetChildSlotList - Returns a list of slots by provided parent slot
GetParentSlot (Renamed: CalcSlotId(arg1))
GetChildSlot (Renamed: CalcSlotId(arg1, arg2))
GetBagIndex (Renamed: CalcBagIdx)
GetMaterialFromSlot (Renamed: CalcMaterialFromSlot)
GetSlotFromMaterial (Renamed: CalcSlotFromMaterial)
MODIFIED CLIENT DELETE METHOD:
DeleteItemInInventory - Moved packet creation into helper procedures
SendDeleteChargePacket - Added alternate update method that overwrites existing client item
SendDeleteCountPacket - Added alternate update method that overwrites existing client item
SendDeleteItemPacket - Added slot range discrimination with unique deletion methods
IsClientRestrictedSlot - Returns bool value for client-related slot restrictions
RESYNCRONIZATION METHOD:
ResyncInventory - Updated version of unpublished/uncommitted resync method..uses new inventory reference system
ResyncInvProcSlots - Helper procedure for ResyncInventory
ResyncInvSetCBDelay - Helper procedure for ResyncInventory
command_resyncinv - Added command to manually call this method
PEEKINV UPDATE:
command_peekinv - Reworked to use new inventory reference system and added published/uncommitted 'money' sub-command
GetBankMoney - Added for 'money' sub-command
GetSharedBankMoney - Added for 'money' sub-command
GetCursorMoney - Added for 'money' sub-command
GetBankCopper - Added for 'money' sub-command
GetBankSilver - Added for 'money' sub-command
GetBankGold - Added for 'money' sub-command
GetBankPlatinum - Added for 'money' sub-command
GetSharedPlatinum - Added for 'money' sub-command
GetCursorCopper - Added for 'money' sub-command
GetCursorSilver - Added for 'money' sub-command
GetCursorGold - Added for 'money' sub-command
GetCursorPlatinum - Added for 'money' sub-command
MISC:
NukeItem - Reworked to use new inventory reference system (Added container override requisite)
BulkSendInventoryItems - Reworked to use new inventory reference system
RemoveNoRent - Reworked to use new inventory reference system
TakeMoneyFromPP - Added published/uncommitted rework of this procedure
AddMoneyToPP - Added published/uncommitted rework of this procedure (Copper-only version)
SummonItem - Reworked augment lore-check
I believe this is everything, but there may be a few minor changes elsewhere.
I'd like to add functions that return a pointer to the actual maps associated with the 'invWhere' buckets to fully integrate both methods and allow more redundant code reduction. I haven't looked into how to do this just yet.
__________________
Uleat of Bertoxxulous
Compilin' Dirty
|