/// <summary> /// This method is used to get anything in our posession. Inventory in main or any packs, /// as well as wielded items. If we have it, this will return it. /// </summary> /// <param name="objectGuid"></param> /// <returns></returns> public virtual WorldObject GetInventoryItem(ObjectGuid objectGuid) { WorldObject inventoryItem; if (InventoryObjects.TryGetValue(objectGuid, out inventoryItem)) { return(inventoryItem); } WorldObject item = null; var containers = InventoryObjects.Where(wo => wo.Value.WeenieType == WeenieType.Container).ToList(); foreach (var container in containers) { if (container.Value.InventoryObjects.TryGetValue(objectGuid, out item)) { break; } } // It is not in inventory - main pack or container - last check the wielded items. if (item == null) { WieldedObjects.TryGetValue(objectGuid, out item); } return(item); }
/// <summary> /// GetWilded Items /// </summary> public virtual WorldObject GetWieldedItem(ObjectGuid objectGuid) { // check wielded objects WorldObject inventoryItem; if (WieldedObjects.ContainsKey(objectGuid)) { if (WieldedObjects.TryGetValue(objectGuid, out inventoryItem)) { return(inventoryItem); } } return(null); }