33 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
34 newItemAttributes.m_Entity = entity;
35 newItemAttributes.m_Parent = parent;
36 newItemAttributes.m_InventoryDepth = item.GetHierarchyLevel();
37 newItemAttributes.m_SlotIndex = slotId;
41 LogMessage(
string.Format(
"parent:%1 entity:%2 (slot:%3)", parent, entity,
InventorySlots.
GetSlotName(slotId)),
"OnItemAttached");
44 Insert(category, newItemAttributes);
47 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
48 params.m_Entity = item;
49 params.m_GameInventory = item.GetInventory();
50 params.m_SlotId = slotId;
51 params.m_CallerMethod =
"OnItemAttached";
87 if (!item.GetHierarchyParent())
93 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
94 newItemAttributes.m_Entity = entity;
95 newItemAttributes.m_Parent = item.GetHierarchyParent();
96 newItemAttributes.m_InventoryDepth = item.GetHierarchyLevel();
100 LogMessage(
string.Format(
"parent:%1 entity:%2", item.GetHierarchyParent(), entity),
"OnItemCargoIn");
103 Insert(category, newItemAttributes);
106 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
107 params.m_Entity = item;
108 params.m_GameInventory = item.GetInventory();
109 params.m_CallerMethod =
"OnItemCargoIn";
123 #ifdef ENABLE_LOGGING
124 LogMessage(
string.Format(
"parent:%1 entity:%2", item.GetHierarchyParent(), entity),
"OnItemCargoOut");
130 CachedEquipmentStorageInventoryEntry params =
new CachedEquipmentStorageInventoryEntry();
131 params.m_Entity = item;
132 params.m_GameInventory = item.GetInventory();
133 params.m_CallerMethod =
"OnItemCargoOut";
143 CachedItemAttributesPerCategory attachmentAttributesPerCategory =
ProcessAttachments(params);
146 foreach (CachedEquipmentItemAttribute attachmentAttribute : attachmentAttributes)
149 Insert(attachmentCategory, attachmentAttribute);
151 Remove(attachmentCategory, attachmentAttribute.m_Entity);
155 CachedItemAttributesPerCategory cargoAttributesPerCategory =
ProcessCargo(params);
158 foreach (CachedEquipmentItemAttribute cargoAttribute : cargoAttributes)
161 Insert(cargoCategory, cargoAttribute);
163 Remove(cargoCategory, cargoAttribute.m_Entity);
176 CachedItemAttributesPerCategory attachmentAttributesPerCategory =
new CachedItemAttributesPerCategory();
178 int attachments = params.m_GameInventory.AttachmentCount();
179 for (
int attachmentIndex = 0; attachmentIndex < attachments; ++attachmentIndex)
181 EntityAI attachment = params.m_GameInventory.GetAttachmentFromIndex(attachmentIndex);
189 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
190 newItemAttributes.m_Entity = attachment;
191 newItemAttributes.m_Parent = attachment.GetHierarchyParent();
192 newItemAttributes.m_InventoryDepth = attachment.GetHierarchyLevel();
193 newItemAttributes.m_SlotIndex = params.m_SlotId;
197 if (!attachmentAttributesPerCategory.Find(category, arr))
200 attachmentAttributesPerCategory.Set(category, arr);
203 #ifdef ENABLE_LOGGING
204 LogMessage(
string.Format(
"parent:%1 entity:%2", newItemAttributes.m_Parent, attachment),
string.Format(
"%1:ProcessAttachments", params.m_CallerMethod));
207 arr.Insert(newItemAttributes);
210 return attachmentAttributesPerCategory;
221 CachedItemAttributesPerCategory cargoAttributesPerCategory =
new CachedItemAttributesPerCategory();
222 if (params.m_GameInventory.GetCargo())
224 int cargoCount = params.m_GameInventory.GetCargo().GetItemCount();
225 for (
int cargoIndex = 0; cargoIndex < cargoCount; ++cargoIndex)
227 EntityAI cargo = params.m_GameInventory.GetCargo().GetItem(cargoIndex);
235 CachedEquipmentItemAttribute newItemAttributes =
new CachedEquipmentItemAttribute();
237 newItemAttributes.m_Entity = cargo;
238 newItemAttributes.m_Parent = cargo.GetHierarchyParent();
239 newItemAttributes.m_InventoryDepth = cargo.GetHierarchyLevel();
243 if (!cargoAttributesPerCategory.Find(category, arr))
246 cargoAttributesPerCategory.Set(category, arr);
249 #ifdef ENABLE_LOGGING
250 LogMessage(
string.Format(
"parent:%1 entity:%2", newItemAttributes.m_Parent, cargo),
string.Format(
"%1:ProcessCargo", params.m_CallerMethod));
253 arr.Insert(newItemAttributes);
257 return cargoAttributesPerCategory;