1115 {
1118 int slot_id = -1;
1119
1120 SlotsIcon slots_icon;
1121 receiver.GetUserData(slots_icon);
1122 if( slots_icon )
1123 {
1127 }
1128
1130 if( !item )
1131 {
1132 return;
1133 }
1134
1136 float stack_max = item_base.GetTargetQuantityMax(slot_id);
1137
1139 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
1140 return;
1141
1143 Weapon_Base wpn;
1144 Magazine mag;
1145 if( Class.CastTo(wpn, target_att_entity ) && Class.CastTo(mag, item ) )
1146 {
1147 if( player.GetWeaponManager().CanAttachMagazine( wpn, mag ) )
1148 {
1149 player.GetWeaponManager().AttachMagazine( mag );
1150 }
1151 else if(player.GetWeaponManager().CanSwapMagazine( wpn, mag ))
1152 {
1153 player.GetWeaponManager().SwapMagazine( mag );
1154 }
1155 }
1156 else if( receiver_item )
1157 {
1158 if( receiver_item != item )
1159 {
1160 if( (
ItemBase.Cast( receiver_item ) ).CanBeCombined(
ItemBase.Cast( item ) ) )
1161 {
1162 (
ItemBase.Cast( receiver_item ) ).CombineItemsClient(
ItemBase.Cast( item ) );
1163 }
1164 else if( GameInventory.CanSwapEntitiesEx( receiver_item, item ) )
1165 {
1166 if( !receiver_item.GetInventory().CanRemoveEntity() )
1167 return;
1169 }
1170 }
1171 }
1172 else if( slot_owner && slot_owner.GetInventory().CanAddAttachmentEx( item, slot_id ) )
1173 {
1174 if( stack_max == 0 || stack_max >= item_base.GetQuantity() )
1175 {
1176 player.PredictiveTakeEntityToTargetAttachmentEx(slot_owner, item, slot_id);
1177 }
1178 else if( stack_max != 0 && stack_max < item_base.GetQuantity() )
1179 {
1180 item_base.SplitIntoStackMaxClient( slot_owner, slot_id );
1181 }
1182 }
1183 else if( slot_owner && slot_owner.GetInventory().CanAddAttachment( item ) )
1184 {
1185 if( stack_max == 0 || stack_max >= item_base.GetQuantity() )
1186 {
1187 player.PredictiveTakeEntityToTargetAttachment(slot_owner, item);
1188 }
1189 else if( stack_max != 0 && stack_max < item_base.GetQuantity() )
1190 {
1191 item_base.SplitIntoStackMaxClient( slot_owner, -1 );
1192 }
1193 }
1194 else if( target_att_entity.GetInventory().CanAddAttachment( item ) )
1195 {
1196 if( stack_max == 0 || stack_max >= item_base.GetQuantity() )
1197 {
1198 player.PredictiveTakeEntityToTargetAttachment(target_att_entity, item);
1199 }
1200 else if( stack_max != 0 && stack_max < item_base.GetQuantity() )
1201 {
1202 item_base.SplitIntoStackMaxClient( target_att_entity, -1 );
1203 }
1204 }
1205 else if( ( target_att_entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && ( !player.GetInventory().HasEntityInInventory( item ) || !
m_Entity.GetInventory().HasEntityInCargo( item )) ) || player.GetHumanInventory().HasEntityInHands( item ) )
1206 {
1207 SplitItemUtils.TakeOrSplitToInventory( PlayerBase.Cast(
GetGame().
GetPlayer() ), target_att_entity, item );
1208 }
1209
1210
1211
1212
1213
1214 ItemManager.GetInstance().HideDropzones();
1215 ItemManager.GetInstance().SetIsDragging( false );
1216 }
class GP5GasMask extends MaskBase ItemBase
proto native DayZPlayer GetPlayer()
EntityAI GetItemPreviewItem(Widget w)
proto native CGame GetGame()