public static bool OnWarperIconClickPrefix(UIStationWindow __instance, ref int obj) { if ((__instance.stationId == 0 || __instance.factory == null)) { __instance._Close(); return(false); } StationComponent stationComponent = __instance.transport.stationPool[__instance.stationId]; ItemProto gigaProto = LDB.items.Select(__instance.factory.entityPool[stationComponent.entityId].protoId); if (gigaProto.ID != GigaStationsPlugin.pls.ID && gigaProto.ID != GigaStationsPlugin.ils.ID && gigaProto.ID != GigaStationsPlugin.collector.ID) { return(true); // not my ILS, return to original code } if (__instance.stationId == 0 || __instance.factory == null) { return(false); } if (stationComponent.id != __instance.stationId) { return(false); } if (!stationComponent.isStellar) { return(false); } if (__instance.player.inhandItemId > 0 && __instance.player.inhandItemCount == 0) { __instance.player.SetHandItems(0, 0); } else if (__instance.player.inhandItemId > 0 && __instance.player.inhandItemCount > 0) { int num = 1210; ItemProto itemProto = LDB.items.Select(num); if (__instance.player.inhandItemId != num) { UIRealtimeTip.Popup("只能放入".Translate() + itemProto.name); return(false); } int num2 = GigaStationsPlugin.ilsMaxWarps; int warperCount = stationComponent.warperCount; int num3 = num2 - warperCount; if (num3 < 0) { num3 = 0; } int num4 = (__instance.player.inhandItemCount >= num3) ? num3 : __instance.player.inhandItemCount; if (num4 <= 0) { UIRealtimeTip.Popup("栏位已满".Translate()); return(false); } stationComponent.warperCount += num4; __instance.player.AddHandItemCount_Unsafe(-num4); if (__instance.player.inhandItemCount <= 0) { __instance.player.SetHandItemId_Unsafe(0); __instance.player.SetHandItemCount_Unsafe(0); } } else if (__instance.player.inhandItemId == 0 && __instance.player.inhandItemCount == 0) { int warperCount2 = stationComponent.warperCount; int num5 = warperCount2; if (num5 <= 0) { return(false); } if (VFInput.shift || VFInput.control) { num5 = __instance.player.package.AddItemStacked(1210, num5, 0, out int _); if (warperCount2 != num5) { UIRealtimeTip.Popup("无法添加物品".Translate()); } UIItemup.Up(1210, num5); } else { __instance.player.SetHandItemId_Unsafe(1210); __instance.player.SetHandItemCount_Unsafe(num5); } stationComponent.warperCount -= num5; if (stationComponent.warperCount < 0) { Assert.CannotBeReached(); stationComponent.warperCount = 0; } } return(false); }