DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ OnDropReceivedFromHeader()

override void AttachmentCategoriesRow::OnDropReceivedFromHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected

См. определение в файле AttachmentCategoriesRow.c строка 299

300 {
301 ItemManager.GetInstance().HideDropzones();
302 ItemManager.GetInstance().SetIsDragging( false );
303 SlotsIcon slots_icon;
304 EntityAI receiver_item;
305 int slot_id = -1;
306 bool is_reserved = false;
307 EntityAI attached_entity;
308 receiver.GetUserData(slots_icon);
309 float stackable = 0.0;
310 InventoryLocation il = new InventoryLocation;
311
312 if( slots_icon )
313 {
314 receiver_item = slots_icon.GetEntity();
315 slot_id = slots_icon.GetSlotID();
316 attached_entity = slots_icon.GetSlotParent();
317 is_reserved = slots_icon.IsReserved();
318 }
319
320 EntityAI item = GetItemPreviewItem( w );
321 if( !item )
322 {
323 return;
324 }
325 ItemBase item_base = ItemBase.Cast( item );
326
327 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
328 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
329 return;
330
331 EntityAI target_att_entity = m_Entity;
332 Weapon_Base wpn;
333 Magazine mag;
334 if( Class.CastTo(wpn, m_Entity ) && Class.CastTo(mag, item ) )
335 {
336 if( player.GetWeaponManager().CanAttachMagazine( wpn, mag ) )
337 {
338 player.GetWeaponManager().AttachMagazine( mag );
339 }
340 }
341 else if( receiver_item && !is_reserved )
342 {
343 if( ( ItemBase.Cast( receiver_item ) ).CanBeCombined( ItemBase.Cast( item ) ) )
344 {
345 ( ItemBase.Cast( receiver_item ) ).CombineItemsClient( ItemBase.Cast( item ) );
346 }
347 else if( GameInventory.CanSwapEntitiesEx( receiver_item, item ) )
348 {
349 if( !receiver_item.GetInventory().CanRemoveEntity() )
350 return;
351 GetGame().GetPlayer().PredictiveSwapEntities( receiver_item, item );
352 }
353 else if( receiver_item.GetInventory().CanAddAttachment( item ) )
354 {
355 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
356 }
357 }
358 else if( attached_entity && slot_id != -1 && attached_entity.GetInventory().CanAddAttachmentEx( item, slot_id ) )
359 {
360 item_base = ItemBase.Cast( item );
361 stackable = item_base.GetTargetQuantityMax( slot_id );
362
363 if( stackable == 0 || stackable >= item_base.GetQuantity() )
364 {
365 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, slot_id);
366 }
367 else if( stackable != 0 && stackable < item_base.GetQuantity() )
368 {
369 item_base.SplitIntoStackMaxClient( m_Entity, slot_id );
370 }
371 }
372 else if(attached_entity && slot_id == -1 && attached_entity.GetInventory().FindFreeLocationFor(item,FindInventoryLocationType.ATTACHMENT,il))
373 {
374 item_base = ItemBase.Cast( item );
375 stackable = item_base.GetTargetQuantityMax( il.GetSlot() );
376
377 if( stackable == 0 || stackable >= item_base.GetQuantity() )
378 {
379 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, il.GetSlot());
380 }
381 else if( stackable != 0 && stackable < item_base.GetQuantity() )
382 {
383 item_base.SplitIntoStackMaxClient( m_Entity, il.GetSlot() );
384 }
385 }
386 /*else if( ( m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && ( !player.GetInventory().HasEntityInInventory( item ) || !m_Entity.GetInventory().HasEntityInCargo( item )) ) )
387 {
388 SplitItemUtils.TakeOrSplitToInventory( PlayerBase.Cast( GetGame().GetPlayer() ), m_Entity, item );
389 }*/
390 }
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
EntityAI GetItemPreviewItem(Widget w)
Определения AttachmentCategoriesRow.c:605
proto native DayZPlayer GetPlayer()
proto native int GetSlot()
returns slot id if current type is Attachment
EntityAI GetEntity()
Определения SlotsIcon.c:365
EntityAI GetSlotParent()
Определения SlotsIcon.c:185
bool IsReserved()
Определения SlotsIcon.c:200
int GetSlotID()
Определения SlotsIcon.c:190
proto native CGame GetGame()

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), Class::CastTo(), SlotsIcon::GetEntity(), GetGame(), ItemManager::GetInstance(), GetItemPreviewItem(), CGame::GetPlayer(), GetPlayer(), InventoryLocation::GetSlot(), SlotsIcon::GetSlotID(), SlotsIcon::GetSlotParent(), ItemManager::HideDropzones(), SlotsIcon::IsReserved(), m_Entity, ItemManager::SetIsDragging(), x и y.