public static NetworkInterfaceResponse HandleNetworkCommand(Player player, NetworkInterfaceCommand nic) { FreightCartStation station = nic.target as FreightCartStation; string command = nic.command; if (command != null) { if (command == InterfaceRemoveReg) { FreightCartWindow.RemoveRegistry(station, nic.itemContext); } else if (command == InterfaceSetLowStock) { int stock = -1; int.TryParse(nic.payload ?? "-1", out stock); FreightCartWindow.SetLowStock(station, nic.itemContext, stock); } else if (command == InterfaceSetHighStock) { int stock = -1; int.TryParse(nic.payload ?? "-1", out stock); FreightCartWindow.SetHighStock(station, nic.itemContext, stock); } else if (command == InterfaceAssignedCarts) { int carts = 0; int.TryParse(nic.payload ?? "-1", out carts); FreightCartWindow.SetCartAssignment(station, carts); } else if (command == InterfaceCartTier) { int carttier = 0; int.TryParse(nic.payload ?? "2", out carttier); FreightCartWindow.ToggleCartTier(station, carttier); } else if (command == InterfaceHopperHigh) { int offer = -1; int.TryParse(nic.payload ?? "-1", out offer); FreightCartWindow.SetHopperOffer(station, offer); } else if (command == InterfaceHopperLow) { int request = -1; int.TryParse(nic.payload ?? "-1", out request); FreightCartWindow.SetHopperRequest(station, request); } else if (command == InterfaceToggleLoad) { FreightCartWindow.ToggleLoadStatus(station, nic.payload); } else if (command == InterfaceToggleOffer) { FreightCartWindow.ToggleOfferAll(station, nic.payload); } else if (command == InterfaceAddReg) { FreightCartWindow.AddRegistry(station, nic.itemContext); } else if (command == InterfaceSetNetwork) { FreightCartWindow.SetNetwork(station, nic.payload); } else if (command == InterfaceSetName) { FreightCartWindow.SetStationName(station, nic.payload); } else if (command == InterfaceSetInventoryName) { FreightCartWindow.NameInventory(station, nic.payload); } else if (command == InterfaceCopyFreight) { FreightCartWindow.CopyFreight(station); } else if (command == InterfacePasteFreight) { FreightCartWindow.PasteFreight(station); } else if (command == InterfaceHopperOffer) { FreightCartWindow.SetHopperOfferItem(station, nic.itemContext); } else if (command == InterfaceHopperRequest) { FreightCartWindow.SetHopperRequestItem(station, nic.itemContext); } } return(new NetworkInterfaceResponse { entity = station, inventory = player.mInventory }); }